예제 #1
0
if (! $GLOBALS['is_superuser']) {
    $response->addHTML(
        PMA\libraries\Message::error(__('No Privileges'))
            ->getDisplay()
    );
    exit;
}

$response->addHTML('<div>');
$response->addHTML(PMA_getHtmlForSubMenusOnUsersPage('server_user_groups.php'));

/**
 * Delete user group
 */
if (! empty($_REQUEST['deleteUserGroup'])) {
    PMA_deleteUserGroup($_REQUEST['userGroup']);
}

/**
 * Add a new user group
 */
if (! empty($_REQUEST['addUserGroupSubmit'])) {
    PMA_editUserGroup($_REQUEST['userGroup'], true);
}

/**
 * Update a user group
 */
if (! empty($_REQUEST['editUserGroupSubmit'])) {
    PMA_editUserGroup($_REQUEST['userGroup']);
}
 /**
  * Tests PMA_deleteUserGroup() function
  *
  * @return void
  */
 public function testDeleteUserGroup()
 {
     $userDelQuery = "DELETE FROM `pmadb`.`users`" . " WHERE `usergroup`='ug'";
     $userGrpDelQuery = "DELETE FROM `pmadb`.`usergroups`" . " WHERE `usergroup`='ug'";
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->at(0))->method('query')->with($userDelQuery);
     $dbi->expects($this->at(1))->method('query')->with($userGrpDelQuery);
     $GLOBALS['dbi'] = $dbi;
     PMA_deleteUserGroup('ug');
 }