Translated using Weblate (Ukrainian)
[phpmyadmin.git] / server_user_groups.php
blob3f11f59fcba31b9574dcbfaaa478a2f561d025ff
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Displays the 'User groups' sub page under 'Users' page.
6 * @package PhpMyAdmin
7 */
8 use PhpMyAdmin\Relation;
9 use PhpMyAdmin\Response;
10 use PhpMyAdmin\Server\UserGroups;
11 use PhpMyAdmin\Server\Users;
13 require_once 'libraries/common.inc.php';
15 Relation::getRelationsParam();
16 if (! $GLOBALS['cfgRelation']['menuswork']) {
17 exit;
20 $response = Response::getInstance();
21 $header = $response->getHeader();
22 $scripts = $header->getScripts();
23 $scripts->addFile('server_user_groups.js');
25 /**
26 * Only allowed to superuser
28 if (! $GLOBALS['dbi']->isSuperuser()) {
29 $response->addHTML(
30 PhpMyAdmin\Message::error(__('No Privileges'))
31 ->getDisplay()
33 exit;
36 $response->addHTML('<div>');
37 $response->addHTML(Users::getHtmlForSubMenusOnUsersPage('server_user_groups.php'));
39 /**
40 * Delete user group
42 if (! empty($_REQUEST['deleteUserGroup'])) {
43 UserGroups::delete($_REQUEST['userGroup']);
46 /**
47 * Add a new user group
49 if (! empty($_REQUEST['addUserGroupSubmit'])) {
50 UserGroups::edit($_REQUEST['userGroup'], true);
53 /**
54 * Update a user group
56 if (! empty($_REQUEST['editUserGroupSubmit'])) {
57 UserGroups::edit($_REQUEST['userGroup']);
60 if (isset($_REQUEST['viewUsers'])) {
61 // Display users belonging to a user group
62 $response->addHTML(UserGroups::getHtmlForListingUsersofAGroup($_REQUEST['userGroup']));
65 if (isset($_REQUEST['addUserGroup'])) {
66 // Display add user group dialog
67 $response->addHTML(UserGroups::getHtmlToEditUserGroup());
68 } elseif (isset($_REQUEST['editUserGroup'])) {
69 // Display edit user group dialog
70 $response->addHTML(UserGroups::getHtmlToEditUserGroup($_REQUEST['userGroup']));
71 } else {
72 // Display user groups table
73 $response->addHTML(UserGroups::getHtmlForUserGroupsTable());
76 $response->addHTML('</div>');