Browse Source

display shares to circles moderator

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/12105/head
Maxence Lange 7 years ago
committed by Julius Härtl
parent
commit
72ad2d60b5
No known key found for this signature in database GPG Key ID: 4C614C6ED2CDE6DF
  1. 22
      apps/files_sharing/lib/Controller/ShareAPIController.php

22
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;
}

Loading…
Cancel
Save