display shares to circles moderator
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
parent
68c44bb642
commit
72ad2d60b5
|
@ -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…
Reference in New Issue