Add ChangeLog entry for #15695
[phpmyadmin.git] / server_user_groups.php
blobbf5e92d7879c68102d6a6e42ea8b4f26b5f35d75
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 = new Relation();
16 $cfgRelation = $relation->getRelationsParam();
17 if (! $cfgRelation['menuswork']) {
18 exit;
21 $response = Response::getInstance();
22 $header = $response->getHeader();
23 $scripts = $header->getScripts();
24 $scripts->addFile('server_user_groups.js');
26 /**
27 * Only allowed to superuser
29 if (! $GLOBALS['dbi']->isSuperuser()) {
30 $response->addHTML(
31 PhpMyAdmin\Message::error(__('No Privileges'))
32 ->getDisplay()
34 exit;
37 $response->addHTML('<div>');
38 $response->addHTML(Users::getHtmlForSubMenusOnUsersPage('server_user_groups.php'));
40 /**
41 * Delete user group
43 if (! empty($_POST['deleteUserGroup'])) {
44 UserGroups::delete($_POST['userGroup']);
47 /**
48 * Add a new user group
50 if (! empty($_POST['addUserGroupSubmit'])) {
51 UserGroups::edit($_POST['userGroup'], true);
54 /**
55 * Update a user group
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']));
72 } else {
73 // Display user groups table
74 $response->addHTML(UserGroups::getHtmlForUserGroupsTable());
77 $response->addHTML('</div>');