aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-10-30 09:58:43 +0100
committerJulius Härtl <jus@bitgrid.net>2018-11-02 12:09:28 +0100
commit72ad2d60b576f182d152735e749aa7e27ff05919 (patch)
treee76dcd0aca01ed20a06949cb8764d9689fab41eb /apps/files_sharing/lib
parent68c44bb6427632e237792bd75d874be4b4562f3f (diff)
downloadnextcloud-server-72ad2d60b576f182d152735e749aa7e27ff05919.tar.gz
nextcloud-server-72ad2d60b576f182d152735e749aa7e27ff05919.zip
display shares to circles moderator
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index fc03a357f35..0e53863f9b5 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -240,6 +240,9 @@ class ShareAPIController extends OCSController {
$shareWithStart = ($hasCircleId? strrpos($share->getSharedWith(), '[') + 1: 0);
$shareWithLength = ($hasCircleId? -1: strpos($share->getSharedWith(), ' '));
+ if (is_bool($shareWithLength)) {
+ $shareWithLength = -1;
+ }
$result['share_with'] = substr($share->getSharedWith(), $shareWithStart, $shareWithLength);
} else if ($share->getShareType() === Share::SHARE_TYPE_ROOM) {
$result['share_with'] = $share->getSharedWith();
@@ -1137,6 +1140,25 @@ class ShareAPIController extends OCSController {
return true;
}
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE && \OC::$server->getAppManager()->isEnabledForUser('circles') &&
+ class_exists('\OCA\Circles\Api\v1\Circles')) {
+ $hasCircleId = (substr($share->getSharedWith(), -1) === ']');
+ $shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0);
+ $shareWithLength = ($hasCircleId ? -1 : strpos($share->getSharedWith(), ' '));
+ if (is_bool($shareWithLength)) {
+ $shareWithLength = -1;
+ }
+ $sharedWith = substr($share->getSharedWith(), $shareWithStart, $shareWithLength);
+ try {
+ $member = \OCA\Circles\Api\v1\Circles::getMember($sharedWith, $userId, 1);
+ if ($member->getLevel() > 0) {
+ return true;
+ }
+ } catch (QueryException $e) {
+ return false;
+ }
+ }
+
return false;
}