Translated using Weblate (Norwegian Bokmål)
[phpmyadmin.git] / server_user_groups.php
blob211ccfe39a78a2766c5eda080c38ef3a7dedbff3
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 PMA\libraries\Response;
10 require_once 'libraries/common.inc.php';
11 require_once 'libraries/server_users.lib.php';
12 require_once 'libraries/server_user_groups.lib.php';
14 PMA_getRelationsParam();
15 if (! $GLOBALS['cfgRelation']['menuswork']) {
16 exit;
19 $response = Response::getInstance();
20 $header = $response->getHeader();
21 $scripts = $header->getScripts();
22 $scripts->addFile('server_user_groups.js');
24 /**
25 * Only allowed to superuser
27 if (! $GLOBALS['is_superuser']) {
28 $response->addHTML(
29 PMA\libraries\Message::error(__('No Privileges'))
30 ->getDisplay()
32 exit;
35 $response->addHTML('<div>');
36 $response->addHTML(PMA_getHtmlForSubMenusOnUsersPage('server_user_groups.php'));
38 /**
39 * Delete user group
41 if (! empty($_REQUEST['deleteUserGroup'])) {
42 PMA_deleteUserGroup($_REQUEST['userGroup']);
45 /**
46 * Add a new user group
48 if (! empty($_REQUEST['addUserGroupSubmit'])) {
49 PMA_editUserGroup($_REQUEST['userGroup'], true);
52 /**
53 * Update a user group
55 if (! empty($_REQUEST['editUserGroupSubmit'])) {
56 PMA_editUserGroup($_REQUEST['userGroup']);
59 if (isset($_REQUEST['viewUsers'])) {
60 // Display users belonging to a user group
61 $response->addHTML(PMA_getHtmlForListingUsersofAGroup($_REQUEST['userGroup']));
64 if (isset($_REQUEST['addUserGroup'])) {
65 // Display add user group dialog
66 $response->addHTML(PMA_getHtmlToEditUserGroup());
67 } elseif (isset($_REQUEST['editUserGroup'])) {
68 // Display edit user group dialog
69 $response->addHTML(PMA_getHtmlToEditUserGroup($_REQUEST['userGroup']));
70 } else {
71 // Display user groups table
72 $response->addHTML(PMA_getHtmlForUserGroupsTable());
75 $response->addHTML('</div>');