diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-07-09 12:19:50 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-07-15 08:31:43 +0200 |
commit | 334ace90802a224f60e9dfb942e4581739ddd3c2 (patch) | |
tree | 9daad4358aec60e14b5c5ef616456e642e70bfdf /settings | |
parent | 8ec00dcb6604b395620efb7b36ac36a47b90d2c5 (diff) | |
download | nextcloud-server-334ace90802a224f60e9dfb942e4581739ddd3c2.tar.gz nextcloud-server-334ace90802a224f60e9dfb942e4581739ddd3c2.zip |
Backport of #9562
remove dead code
do not filter groups. but update the user count according to the filter
improve phpdoc
improve metadata runtime cache
add metadata tests
fixing PHPDoc
Diffstat (limited to 'settings')
-rw-r--r-- | settings/ajax/grouplist.php | 14 | ||||
-rw-r--r-- | settings/js/users/filter.js | 6 | ||||
-rw-r--r-- | settings/js/users/groups.js | 5 |
3 files changed, 16 insertions, 9 deletions
diff --git a/settings/ajax/grouplist.php b/settings/ajax/grouplist.php index 91700adc359..52df98c4e5e 100644 --- a/settings/ajax/grouplist.php +++ b/settings/ajax/grouplist.php @@ -27,6 +27,12 @@ if (isset($_GET['pattern']) && !empty($_GET['pattern'])) { } else { $pattern = ''; } +if (isset($_GET['filterGroups']) && !empty($_GET['filterGroups'])) { + $filterGroups = intval($_GET['filterGroups']) === 1; +} else { + $filterGroups = false; +} +$groupPattern = $filterGroups ? $pattern : ''; $groups = array(); $adminGroups = array(); $groupManager = \OC_Group::getManager(); @@ -36,13 +42,7 @@ $isAdmin = OC_User::isAdminUser(OC_User::getUser()); //groups will be filtered out later $groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), true, $groupManager); $groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT); -list($adminGroups, $groups) = $groupsInfo->get($pattern); - -$accessibleGroups = $groupManager->search($pattern); -if(!$isAdmin) { - $subadminGroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); - $accessibleGroups = array_intersect($groups, $subadminGroups); -} +list($adminGroups, $groups) = $groupsInfo->get($groupPattern, $pattern); OC_JSON::success( array('data' => array('adminGroups' => $adminGroups, 'groups' => $groups))); diff --git a/settings/js/users/filter.js b/settings/js/users/filter.js index 1f7a29de0c9..c5944e9b4b1 100644 --- a/settings/js/users/filter.js +++ b/settings/js/users/filter.js @@ -14,6 +14,7 @@ function UserManagementFilter(filterInput, userList, groupList) { this.filterInput = filterInput; this.userList = userList; this.groupList = groupList; + this.filterGroups = false; this.thread = undefined; this.oldval = this.filterInput.val(); @@ -55,7 +56,10 @@ UserManagementFilter.prototype.init = function() { UserManagementFilter.prototype.run = _.debounce(function() { this.userList.empty(); this.userList.update(GroupList.getCurrentGID()); - this.groupList.empty(); + if(this.filterGroups) { + // user counts are being updated nevertheless + this.groupList.empty(); + } this.groupList.update(); }, 300 diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index 22f5c9d2a72..b4cf73c59f2 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -114,7 +114,10 @@ GroupList = { GroupList.updating = true; $.get( OC.generateUrl('/settings/ajax/grouplist'), - {pattern: filter.getPattern()}, + { + pattern: filter.getPattern(), + filterGroups: filter.filterGroups ? 1 : 0 + }, function (result) { var lis = []; |