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 = new Relation();
16 $cfgRelation = $relation->getRelationsParam();
17 if (! $cfgRelation['menuswork']) {
21 $response = Response
::getInstance();
22 $header = $response->getHeader();
23 $scripts = $header->getScripts();
24 $scripts->addFile('server_user_groups.js');
27 * Only allowed to superuser
29 if (! $GLOBALS['dbi']->isSuperuser()) {
31 PhpMyAdmin\Message
::error(__('No Privileges'))
37 $response->addHTML('<div>');
38 $response->addHTML(Users
::getHtmlForSubMenusOnUsersPage('server_user_groups.php'));
43 if (! empty($_POST['deleteUserGroup'])) {
44 UserGroups
::delete($_POST['userGroup']);
48 * Add a new user group
50 if (! empty($_POST['addUserGroupSubmit'])) {
51 UserGroups
::edit($_POST['userGroup'], true);
57 if (! empty($_POST['editUserGroupSubmit'])) {
58 UserGroups
::edit($_POST['userGroup']);
61 if (isset($_POST['viewUsers'])) {
62 // Display users belonging to a user group
63 $response->addHTML(UserGroups
::getHtmlForListingUsersofAGroup($_POST['userGroup']));
66 if (isset($_GET['addUserGroup'])) {
67 // Display add user group dialog
68 $response->addHTML(UserGroups
::getHtmlToEditUserGroup());
69 } elseif (isset($_POST['editUserGroup'])) {
70 // Display edit user group dialog
71 $response->addHTML(UserGroups
::getHtmlToEditUserGroup($_POST['userGroup']));
73 // Display user groups table
74 $response->addHTML(UserGroups
::getHtmlForUserGroupsTable());
77 $response->addHTML('</div>');