2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Displays the 'User groups' sub page under 'Users' page.
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']) {
20 $response = Response
::getInstance();
21 $header = $response->getHeader();
22 $scripts = $header->getScripts();
23 $scripts->addFile('server_user_groups.js');
26 * Only allowed to superuser
28 if (! $GLOBALS['dbi']->isSuperuser()) {
30 PhpMyAdmin\Message
::error(__('No Privileges'))
36 $response->addHTML('<div>');
37 $response->addHTML(Users
::getHtmlForSubMenusOnUsersPage('server_user_groups.php'));
42 if (! empty($_REQUEST['deleteUserGroup'])) {
43 UserGroups
::delete($_REQUEST['userGroup']);
47 * Add a new user group
49 if (! empty($_REQUEST['addUserGroupSubmit'])) {
50 UserGroups
::edit($_REQUEST['userGroup'], true);
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']));
72 // Display user groups table
73 $response->addHTML(UserGroups
::getHtmlForUserGroupsTable());
76 $response->addHTML('</div>');