summaryrefslogtreecommitdiffstats
path: root/lib/private/util.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-05-13 15:22:18 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-05-22 10:43:44 +0200
commit12338e0ef07c409156fa9cd1008bb981bda20461 (patch)
treefe859814a2321ab98f498a623db39dab892b8153 /lib/private/util.php
parent14a953fbe01a3d26e1330ea224ab71928a2f93c1 (diff)
downloadnextcloud-server-12338e0ef07c409156fa9cd1008bb981bda20461.tar.gz
nextcloud-server-12338e0ef07c409156fa9cd1008bb981bda20461.zip
allow admin to disable sharing for specific groups of users
Diffstat (limited to 'lib/private/util.php')
-rwxr-xr-xlib/private/util.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/private/util.php b/lib/private/util.php
index c018721afe3..23c7053002c 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -97,6 +97,29 @@ class OC_Util {
}
/**
+ * check if sharing is disabled for the current user
+ *
+ * @return boolean
+ */
+ public static function isSharingDisabledForUser() {
+ if (\OC_Appconfig::getValue('core', 'shareapi_exclude_groups', 'no') === 'yes') {
+ $user = \OCP\User::getUser();
+ $groupsList = \OC_Appconfig::getValue('core', 'shareapi_exclude_groups_list', '');
+ $excludedGroups = explode(',', $groupsList);
+ $usersGroups = \OC_Group::getUserGroups($user);
+ if (!empty($usersGroups)) {
+ $remainingGroups = array_diff($usersGroups, $excludedGroups);
+ // if the user is only in groups which are disabled for sharing then
+ // sharing is also disabled for the user
+ if (empty($remainingGroups)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
* Get the quota of a user
* @param string $user
* @return int Quota bytes