OC_Util::addScript('core', 'multiselect'); OC_Util::addScript('core', 'singleselect'); OC_Util::addScript('core', 'jquery.inview'); OC_Util::addStyle('settings', 'settings'); OC_App::setActiveNavigationEntry('core_users'); $users = array(); $groups = array(); $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); $subadmins = OC_SubAdmin::getAllSubAdmins(); } else { $accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); $accessibleusers = OC_Group::displayNamesInGroups($accessiblegroups, '', 30); $subadmins = false; } // load preset quotas $quotaPreset = OC_Appconfig::getValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); $quotaPreset = explode(',', $quotaPreset); foreach ($quotaPreset as &$preset) { $preset = trim($preset); } $quotaPreset = array_diff($quotaPreset, array('default', 'none')); $defaultQuota = OC_Appconfig::getValue('files', 'default_quota', 'none'); $defaultQuotaIsUserDefined = array_search($defaultQuota, $quotaPreset) === false && array_search($defaultQuota, array('none', 'default')) === false; // load users and quota 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;
$sharedGroups = $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]; } if (isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_SHARING_GROUP]) && is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_SHARING_GROUP])) { $sharedSharingGroups = $_GET['itemShares'][OCP\Share::SHARE_TYPE_SHARING_GROUP]; } } $count = 0; $users = array(); $limit = 0; $offset = 0; // limit defaults to 15 if not specified via request parameter and can be no larger than 500 $request_limit = min((int) $_GET['limit'] ?: 15, 500); while ($count < $request_limit && count($users) == $limit) { $limit = $request_limit - $count; if ($shareWithinGroupOnly) { $users = OC_Group::displayNamesInGroups($usergroups, (string) $_GET['search'], $limit, $offset); } else { $users = OC_User::getDisplayNames((string) $_GET['search'], $limit, $offset); } $offset += $limit; foreach ($users as $uid => $displayName) { if (in_array($uid, $sharedUsers)) { continue; } if ((!isset($_GET['itemShares']) || !is_array((string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) || !in_array($uid, (string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) && $uid != OC_User::getUser()) { $shareWith[] = array('label' => $displayName, 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER, 'shareWith' => $uid)); $count++; } } } $count = 0;
$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager); $groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT); list($adminGroup, $groups) = $groupsInfo->get(); $recoveryAdminEnabled = OC_App::isEnabled('files_encryption') && OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled'); if ($isAdmin) { $accessibleUsers = OC_User::getDisplayNames('', 30); $subadmins = OC_SubAdmin::getAllSubAdmins(); } else { /* Retrieve group IDs from $groups array, so we can pass that information into OC_Group::displayNamesInGroups() */ $gids = array(); foreach ($groups as $group) { if (isset($group['id'])) { $gids[] = $group['id']; } } $accessibleUsers = OC_Group::displayNamesInGroups($gids, '', 30); $subadmins = false; } // load preset quotas $quotaPreset = OC_Appconfig::getValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); $quotaPreset = explode(',', $quotaPreset); foreach ($quotaPreset as &$preset) { $preset = trim($preset); } $quotaPreset = array_diff($quotaPreset, array('default', 'none')); $defaultQuota = OC_Appconfig::getValue('files', 'default_quota', 'none'); $defaultQuotaIsUserDefined = array_search($defaultQuota, $quotaPreset) === false && array_search($defaultQuota, array('none', 'default')) === false; // load users and quota 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;