summaryrefslogtreecommitdiffstats
path: root/settings/users.php
diff options
context:
space:
mode:
Diffstat (limited to 'settings/users.php')
-rw-r--r--settings/users.php42
1 files changed, 24 insertions, 18 deletions
diff --git a/settings/users.php b/settings/users.php
index f09d0e90d3c..8f72fc9d5c8 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -8,7 +8,10 @@
OC_Util::checkSubAdminUser();
// We have some javascript foo!
-OC_Util::addScript( 'settings', 'users' );
+OC_Util::addScript('settings', 'users/deleteHandler');
+OC_Util::addScript('settings', 'users/filter');
+OC_Util::addScript( 'settings', 'users/users' );
+OC_Util::addScript( 'settings', 'users/groups' );
OC_Util::addScript( 'core', 'multiselect' );
OC_Util::addScript( 'core', 'singleselect' );
OC_Util::addScript('core', 'jquery.inview');
@@ -16,19 +19,23 @@ OC_Util::addStyle( 'settings', 'settings' );
OC_App::setActiveNavigationEntry( 'core_users' );
$users = array();
-$groups = array();
+$userManager = \OC_User::getManager();
+$groupManager = \OC_Group::getManager();
+
+$isAdmin = OC_User::isAdminUser(OC_User::getUser());
+
+$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager);
+$groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
+list($adminGroup, $groups) = $groupsInfo->get();
-$isadmin = OC_User::isAdminUser(OC_User::getUser());
$recoveryAdminEnabled = OC_App::isEnabled('files_encryption') &&
OC_Appconfig::getValue( 'files_encryption', 'recoveryAdminEnabled' );
-if($isadmin) {
- $accessiblegroups = OC_Group::getGroups();
- $accessibleusers = OC_User::getDisplayNames('', 30);
+if($isAdmin) {
+ $accessibleUsers = OC_User::getDisplayNames('', 30);
$subadmins = OC_SubAdmin::getAllSubAdmins();
}else{
- $accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
- $accessibleusers = OC_Group::displayNamesInGroups($accessiblegroups, '', 30);
+ $accessibleUsers = OC_Group::displayNamesInGroups($groups, '', 30);
$subadmins = false;
}
@@ -45,7 +52,7 @@ $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false
&& array_search($defaultQuota, array('none', 'default'))===false;
// load users and quota
-foreach($accessibleusers as $uid => $displayName) {
+foreach($accessibleUsers as $uid => $displayName) {
$quota=OC_Preferences::getValue($uid, 'files', 'quota', 'default');
$isQuotaUserDefined=array_search($quota, $quotaPreset)===false
&& array_search($quota, array('none', 'default'))===false;
@@ -55,6 +62,7 @@ foreach($accessibleusers as $uid => $displayName) {
$name = $name . ' ('.$uid.')';
}
+ $user = $userManager->get($uid);
$users[] = array(
"name" => $uid,
"displayName" => $displayName,
@@ -62,23 +70,21 @@ foreach($accessibleusers as $uid => $displayName) {
'quota' => $quota,
'isQuotaUserDefined' => $isQuotaUserDefined,
'subadmin' => OC_SubAdmin::getSubAdminsGroups($uid),
+ 'storageLocation' => $user->getHome(),
+ 'lastLogin' => $user->getLastLogin(),
);
}
-foreach( $accessiblegroups as $i ) {
- // Do some more work here soon
- $groups[] = array( "name" => $i );
-}
-
-$tmpl = new OC_Template( "settings", "users", "user" );
+$tmpl = new OC_Template( "settings", "users/main", "user" );
$tmpl->assign( 'users', $users );
$tmpl->assign( 'groups', $groups );
-$tmpl->assign( 'isadmin', (int) $isadmin);
+$tmpl->assign( 'adminGroup', $adminGroup );
+$tmpl->assign( 'isAdmin', (int) $isAdmin);
$tmpl->assign( 'subadmins', $subadmins);
-$tmpl->assign( 'numofgroups', count($accessiblegroups));
+$tmpl->assign( 'numofgroups', count($groups) + count($adminGroup));
$tmpl->assign( 'quota_preset', $quotaPreset);
$tmpl->assign( 'default_quota', $defaultQuota);
$tmpl->assign( 'defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined);
$tmpl->assign( 'recoveryAdminEnabled', $recoveryAdminEnabled);
-$tmpl->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true));
+$tmpl->assign( 'enableAvatars', \OC_Config::getValue('enable_avatars', true));
$tmpl->printPage();