diff --git a/settings/ajax/grouplist.php b/settings/ajax/grouplist.php new file mode 100644 index 0000000000..99acf50c76 --- /dev/null +++ b/settings/ajax/grouplist.php @@ -0,0 +1,75 @@ +. + * + */ + +// This file is repsonsible for the Ajax Request for Group list +// Outputs are Names of Groups and IDs of users which are a part of them + +OC_JSON::checkSubAdminUser(); + +$users = array(); +$groupname = array(); +$useringroup = array(); +$userUid = OC_User::getUser(); +$isAdmin = OC_User::isAdminUser($userUid); + +if (isset($_GET['offset'])) { + $offset = $_GET['offset']; +} else { + $offset = 0; +} +if (isset($_GET['limit'])) { + $limit = $_GET['limit']; +} else { + $limit = 10; +} + +if ($isAdmin) { + $groups = OC_Group::getGroups(); + $batch = OC_User::getDisplayNames('', $limit, $offset); + foreach ($batch as $user) { + $users['users'][] = array( 'user' => $user ); + } +} +else { + $groups = OC_SubAdmin::getSubAdminsGroups($userUid); + $batch = OC_Group::usersInGroups($groups, '', $limit, $offset); + foreach ($batch as $user) { + $users['users'][] = array( 'user' => $user ); + } +} + +// convert them to the needed format +foreach( $groups as $gid ) { + $groupname[] = array( + 'id' => str_replace(' ','', $gid ), + 'name' => $gid, + 'useringroup' => OC_Group::usersInGroup($gid, '', $limit, $offset), + 'isAdmin' => !OC_User::isAdminUser($gid), + ); +} + +OCP\JSON::success(array('result' => $groupname )); + +?> \ No newline at end of file diff --git a/settings/css/settings.css b/settings/css/settings.css index 7d33d2afb9..37cd1b6f13 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -65,7 +65,7 @@ tr:hover>td.remove>a, tr:hover>td.password>img,tr:hover>td.displayName>img, tr:h tr:hover>td.remove>a { float:right; } div.quota { - float: right; + margin: 10px; display: block; } div.quota-select-wrapper { position: relative; } diff --git a/settings/routes.php b/settings/routes.php index 0e0f293b9b..77a10f68d6 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -25,6 +25,8 @@ $this->create('settings_admin', '/settings/admin') // users $this->create('settings_ajax_userlist', '/settings/ajax/userlist') ->actionInclude('settings/ajax/userlist.php'); +$this->create('settings_ajax_grouplist', '/settings/ajax/grouplist') + ->actionInclude('settings/ajax/grouplist.php'); $this->create('settings_ajax_createuser', '/settings/ajax/createuser.php') ->actionInclude('settings/ajax/createuser.php'); $this->create('settings_ajax_removeuser', '/settings/ajax/removeuser.php')