You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

users.php 2.8KB

12 jaren geleden
11 jaren geleden
12 jaren geleden
12 jaren geleden
11 jaren geleden
11 jaren geleden
11 jaren geleden
11 jaren geleden
11 jaren geleden
12 jaren geleden
12 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. // We have some javascript foo!
  9. OC_Util::addScript( 'settings', 'users' );
  10. OC_Util::addScript( 'core', 'multiselect' );
  11. OC_Util::addScript( 'core', 'singleselect' );
  12. OC_Util::addScript('core', 'jquery.inview');
  13. OC_Util::addStyle( 'settings', 'settings' );
  14. OC_App::setActiveNavigationEntry( 'core_users' );
  15. $users = array();
  16. $groups = array();
  17. $isadmin = OC_User::isAdminUser(OC_User::getUser());
  18. $recoveryAdminEnabled = OC_App::isEnabled('files_encryption') &&
  19. OC_Appconfig::getValue( 'files_encryption', 'recoveryAdminEnabled' );
  20. if($isadmin) {
  21. $accessiblegroups = OC_Group::getGroups();
  22. $accessibleusers = OC_User::getDisplayNames('', 30);
  23. $subadmins = OC_SubAdmin::getAllSubAdmins();
  24. }else{
  25. $accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
  26. $accessibleusers = OC_Group::displayNamesInGroups($accessiblegroups, '', 30);
  27. $subadmins = false;
  28. }
  29. // load preset quotas
  30. $quotaPreset=OC_Appconfig::getValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
  31. $quotaPreset=explode(',', $quotaPreset);
  32. foreach($quotaPreset as &$preset) {
  33. $preset=trim($preset);
  34. }
  35. $quotaPreset=array_diff($quotaPreset, array('default', 'none'));
  36. $defaultQuota=OC_Appconfig::getValue('files', 'default_quota', 'none');
  37. $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false
  38. && array_search($defaultQuota, array('none', 'default'))===false;
  39. // load users and quota
  40. foreach($accessibleusers as $uid => $displayName) {
  41. $quota=OC_Preferences::getValue($uid, 'files', 'quota', 'default');
  42. $isQuotaUserDefined=array_search($quota, $quotaPreset)===false
  43. && array_search($quota, array('none', 'default'))===false;
  44. $name = $displayName;
  45. if ( $displayName !== $uid ) {
  46. $name = $name . ' ('.$uid.')';
  47. }
  48. $users[] = array(
  49. "name" => $uid,
  50. "displayName" => $displayName,
  51. "groups" => OC_Group::getUserGroups($uid),
  52. 'quota' => $quota,
  53. 'isQuotaUserDefined' => $isQuotaUserDefined,
  54. 'subadmin' => OC_SubAdmin::getSubAdminsGroups($uid),
  55. );
  56. }
  57. foreach( $accessiblegroups as $i ) {
  58. // Do some more work here soon
  59. $groups[] = array( "name" => $i );
  60. }
  61. $tmpl = new OC_Template( "settings", "users", "user" );
  62. $tmpl->assign( 'users', $users );
  63. $tmpl->assign( 'groups', $groups );
  64. $tmpl->assign( 'isadmin', (int) $isadmin);
  65. $tmpl->assign( 'subadmins', $subadmins);
  66. $tmpl->assign( 'numofgroups', count($accessiblegroups));
  67. $tmpl->assign( 'quota_preset', $quotaPreset);
  68. $tmpl->assign( 'default_quota', $defaultQuota);
  69. $tmpl->assign( 'defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined);
  70. $tmpl->assign( 'recoveryAdminEnabled', $recoveryAdminEnabled);
  71. $tmpl->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true));
  72. $tmpl->printPage();