Translated using Weblate (French)
[phpmyadmin.git] / server_user_groups.php
blob609a18ed70c291f0e1babe4ccce8d37539ebe4d0
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 $relation->getRelationsParam();
17 if (! $GLOBALS['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($_REQUEST['deleteUserGroup'])) {
44 UserGroups::delete($_REQUEST['userGroup']);
47 /**
48 * Add a new user group
50 if (! empty($_REQUEST['addUserGroupSubmit'])) {
51 UserGroups::edit($_REQUEST['userGroup'], true);
54 /**
55 * Update a user group
57 if (! empty($_REQUEST['editUserGroupSubmit'])) {
58 UserGroups::edit($_REQUEST['userGroup']);
61 if (isset($_REQUEST['viewUsers'])) {
62 // Display users belonging to a user group
63 $response->addHTML(UserGroups::getHtmlForListingUsersofAGroup($_REQUEST['userGroup']));
66 if (isset($_REQUEST['addUserGroup'])) {
67 // Display add user group dialog
68 $response->addHTML(UserGroups::getHtmlToEditUserGroup());
69 } elseif (isset($_REQUEST['editUserGroup'])) {
70 // Display edit user group dialog
71 $response->addHTML(UserGroups::getHtmlToEditUserGroup($_REQUEST['userGroup']));
72 } else {
73 // Display user groups table
74 $response->addHTML(UserGroups::getHtmlForUserGroupsTable());
77 $response->addHTML('</div>');