users.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
  4. * This file is licensed under the Affero General Public License version 3 or later.
  5. * See the COPYING-README file.
  6. */
  7. OC_Util::checkSubAdminUser();
  8. OC_App::setActiveNavigationEntry( 'core_users' );
  9. $userManager = \OC_User::getManager();
  10. $groupManager = \OC_Group::getManager();
  11. $config = \OC::$server->getConfig();
  12. $isAdmin = OC_User::isAdminUser(OC_User::getUser());
  13. $groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager);
  14. $groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
  15. list($adminGroup, $groups) = $groupsInfo->get();
  16. $recoveryAdminEnabled = OC_App::isEnabled('files_encryption') &&
  17. $config->getAppValue( 'files_encryption', 'recoveryAdminEnabled', null );
  18. if($isAdmin) {
  19. $subadmins = OC_SubAdmin::getAllSubAdmins();
  20. }else{
  21. /* Retrieve group IDs from $groups array, so we can pass that information into OC_Group::displayNamesInGroups() */
  22. $gids = array();
  23. foreach($groups as $group) {
  24. if (isset($group['id'])) {
  25. $gids[] = $group['id'];
  26. }
  27. }
  28. $subadmins = false;
  29. }
  30. // load preset quotas
  31. $quotaPreset=$config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
  32. $quotaPreset=explode(',', $quotaPreset);
  33. foreach($quotaPreset as &$preset) {
  34. $preset=trim($preset);
  35. }
  36. $quotaPreset=array_diff($quotaPreset, array('default', 'none'));
  37. $defaultQuota=$config->getAppValue('files', 'default_quota', 'none');
  38. $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false
  39. && array_search($defaultQuota, array('none', 'default'))===false;
  40. $tmpl = new OC_Template("settings", "users/main", "user");
  41. $tmpl->assign('groups', $groups);
  42. $tmpl->assign('adminGroup', $adminGroup);
  43. $tmpl->assign('isAdmin', (int)$isAdmin);
  44. $tmpl->assign('subadmins', $subadmins);
  45. $tmpl->assign('numofgroups', count($groups) + count($adminGroup));
  46. $tmpl->assign('quota_preset', $quotaPreset);
  47. $tmpl->assign('default_quota', $defaultQuota);
  48. $tmpl->assign('defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined);
  49. $tmpl->assign('recoveryAdminEnabled', $recoveryAdminEnabled);
  50. $tmpl->assign('enableAvatars', \OC::$server->getConfig()->getSystemValue('enable_avatars', true));
  51. $tmpl->printPage();