summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2012-10-09 10:36:24 +0200
committerBjörn Schießle <schiessle@owncloud.com>2012-10-09 10:36:24 +0200
commit003241e8474da4239d69fc63b3e812b86d0e3667 (patch)
tree8041f4e7b7d93845cceb898d3f8d5151e3b0a0c4 /lib
parentf1fc73ea5b35eb7a260ad6f4cf267555c11b5c48 (diff)
downloadnextcloud-server-003241e8474da4239d69fc63b3e812b86d0e3667.tar.gz
nextcloud-server-003241e8474da4239d69fc63b3e812b86d0e3667.zip
fix for bug #1942: Allow user to share with every group if "allow users to share with anyone" is set
Diffstat (limited to 'lib')
-rw-r--r--lib/public/share.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index 75363d081c0..1db3a0b2c1d 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -173,6 +173,7 @@ class Share {
*/
public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions) {
$uidOwner = \OC_User::getUser();
+ $sharingPolicy = \OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global');
// Verify share type and sharing conditions are met
if ($shareType === self::SHARE_TYPE_USER) {
if ($shareWith == $uidOwner) {
@@ -185,7 +186,7 @@ class Share {
\OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
throw new \Exception($message);
}
- if (\OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global') == 'groups_only') {
+ if ($sharingPolicy == 'groups_only') {
$inGroup = array_intersect(\OC_Group::getUserGroups($uidOwner), \OC_Group::getUserGroups($shareWith));
if (empty($inGroup)) {
$message = 'Sharing '.$itemSource.' failed, because the user '.$shareWith.' is not a member of any groups that '.$uidOwner.' is a member of';
@@ -208,7 +209,7 @@ class Share {
\OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
throw new \Exception($message);
}
- if (!\OC_Group::inGroup($uidOwner, $shareWith)) {
+ if ($sharingPolicy == 'groups_only' && !\OC_Group::inGroup($uidOwner, $shareWith)) {
$message = 'Sharing '.$itemSource.' failed, because '.$uidOwner.' is not a member of the group '.$shareWith;
\OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
throw new \Exception($message);