users.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * @author Arthur Schiwon <blizzz@owncloud.com>
  4. * @author Bart Visscher <bartv@thisnet.nl>
  5. * @author Björn Schießle <schiessle@owncloud.com>
  6. * @author Clark Tomlinson <fallen013@gmail.com>
  7. * @author Daniel Molkentin <daniel@molkentin.de>
  8. * @author Georg Ehrke <georg@owncloud.com>
  9. * @author Jakob Sack <mail@jakobsack.de>
  10. * @author Lukas Reschke <lukas@owncloud.com>
  11. * @author Morris Jobke <hey@morrisjobke.de>
  12. * @author Robin Appelman <icewind@owncloud.com>
  13. * @author Stephan Peijnik <speijnik@anexia-it.com>
  14. * @author Thomas Müller <thomas.mueller@tmit.eu>
  15. *
  16. * @copyright Copyright (c) 2015, ownCloud, Inc.
  17. * @license AGPL-3.0
  18. *
  19. * This code is free software: you can redistribute it and/or modify
  20. * it under the terms of the GNU Affero General Public License, version 3,
  21. * as published by the Free Software Foundation.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU Affero General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU Affero General Public License, version 3,
  29. * along with this program. If not, see <http://www.gnu.org/licenses/>
  30. *
  31. */
  32. OC_Util::checkSubAdminUser();
  33. OC_App::setActiveNavigationEntry( 'core_users' );
  34. $userManager = \OC_User::getManager();
  35. $groupManager = \OC_Group::getManager();
  36. $config = \OC::$server->getConfig();
  37. $isAdmin = OC_User::isAdminUser(OC_User::getUser());
  38. $groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager);
  39. $groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
  40. list($adminGroup, $groups) = $groupsInfo->get();
  41. $recoveryAdminEnabled = OC_App::isEnabled('encryption') &&
  42. $config->getAppValue( 'encryption', 'recoveryAdminEnabled', null );
  43. if($isAdmin) {
  44. $subadmins = OC_SubAdmin::getAllSubAdmins();
  45. }else{
  46. /* Retrieve group IDs from $groups array, so we can pass that information into OC_Group::displayNamesInGroups() */
  47. $gids = array();
  48. foreach($groups as $group) {
  49. if (isset($group['id'])) {
  50. $gids[] = $group['id'];
  51. }
  52. }
  53. $subadmins = false;
  54. }
  55. // load preset quotas
  56. $quotaPreset=$config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
  57. $quotaPreset=explode(',', $quotaPreset);
  58. foreach($quotaPreset as &$preset) {
  59. $preset=trim($preset);
  60. }
  61. $quotaPreset=array_diff($quotaPreset, array('default', 'none'));
  62. $defaultQuota=$config->getAppValue('files', 'default_quota', 'none');
  63. $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false
  64. && array_search($defaultQuota, array('none', 'default'))===false;
  65. $tmpl = new OC_Template("settings", "users/main", "user");
  66. $tmpl->assign('groups', $groups);
  67. $tmpl->assign('adminGroup', $adminGroup);
  68. $tmpl->assign('isAdmin', (int)$isAdmin);
  69. $tmpl->assign('subadmins', $subadmins);
  70. $tmpl->assign('numofgroups', count($groups) + count($adminGroup));
  71. $tmpl->assign('quota_preset', $quotaPreset);
  72. $tmpl->assign('default_quota', $defaultQuota);
  73. $tmpl->assign('defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined);
  74. $tmpl->assign('recoveryAdminEnabled', $recoveryAdminEnabled);
  75. $tmpl->assign('enableAvatars', \OC::$server->getConfig()->getSystemValue('enable_avatars', true));
  76. $tmpl->printPage();