2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Displays the 'User groups' sub page under 'Users' page.
9 require_once 'libraries/common.inc.php';
10 require_once 'libraries/server_users.lib.php';
11 require_once 'libraries/server_user_groups.lib.php';
13 PMA_getRelationsParam();
14 if (! $GLOBALS['cfgRelation']['menuswork']) {
18 $response = PMA_Response
::getInstance();
19 $header = $response->getHeader();
20 $scripts = $header->getScripts();
21 $scripts->addFile('server_user_groups.js');
24 * Only allowed to superuser
26 if (! $GLOBALS['is_superuser']) {
27 $response->addHTML(PMA_Message
::error(__('No Privileges'))->getDisplay());
31 $response->addHTML('<div>');
32 $response->addHTML(PMA_getHtmlForSubMenusOnUsersPage('server_user_groups.php'));
37 if (! empty($_REQUEST['deleteUserGroup'])) {
38 PMA_deleteUserGroup($_REQUEST['userGroup']);
42 * Add a new user group
44 if (! empty($_REQUEST['addUserGroupSubmit'])) {
45 PMA_editUserGroup($_REQUEST['userGroup'], true);
51 if (! empty($_REQUEST['editUserGroupSubmit'])) {
52 PMA_editUserGroup($_REQUEST['userGroup']);
55 if (isset($_REQUEST['viewUsers'])) {
56 // Display users belonging to a user group
57 $response->addHTML(PMA_getHtmlForListingUsersofAGroup($_REQUEST['userGroup']));
60 if (isset($_REQUEST['addUserGroup'])) {
61 // Display add user group dialog
62 $response->addHTML(PMA_getHtmlToEditUserGroup());
63 } elseif (isset($_REQUEST['editUserGroup'])) {
64 // Display edit user group dialog
65 $response->addHTML(PMA_getHtmlToEditUserGroup($_REQUEST['userGroup']));
67 // Display user groups table
68 $response->addHTML(PMA_getHtmlForUserGroupsTable());
71 $response->addHTML('</div>');