Check if sharing is disabled for a user via core settings
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -94,6 +94,7 @@ class BoardService {
|
|||||||
$groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since);
|
$groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since);
|
||||||
$complete = array_merge($userBoards, $groupBoards);
|
$complete = array_merge($userBoards, $groupBoards);
|
||||||
$result = [];
|
$result = [];
|
||||||
|
/** @var Board $item */
|
||||||
foreach ($complete as &$item) {
|
foreach ($complete as &$item) {
|
||||||
if (!array_key_exists($item->getId(), $result)) {
|
if (!array_key_exists($item->getId(), $result)) {
|
||||||
$this->boardMapper->mapOwner($item);
|
$this->boardMapper->mapOwner($item);
|
||||||
|
|||||||
@@ -84,7 +84,8 @@ class PermissionService {
|
|||||||
Acl::PERMISSION_READ => $owner || $this->userCan($acls, Acl::PERMISSION_READ),
|
Acl::PERMISSION_READ => $owner || $this->userCan($acls, Acl::PERMISSION_READ),
|
||||||
Acl::PERMISSION_EDIT => $owner || $this->userCan($acls, Acl::PERMISSION_EDIT),
|
Acl::PERMISSION_EDIT => $owner || $this->userCan($acls, Acl::PERMISSION_EDIT),
|
||||||
Acl::PERMISSION_MANAGE => $owner || $this->userCan($acls, Acl::PERMISSION_MANAGE),
|
Acl::PERMISSION_MANAGE => $owner || $this->userCan($acls, Acl::PERMISSION_MANAGE),
|
||||||
Acl::PERMISSION_SHARE => $owner || $this->userCan($acls, Acl::PERMISSION_SHARE),
|
Acl::PERMISSION_SHARE => ($owner || $this->userCan($acls, Acl::PERMISSION_SHARE))
|
||||||
|
&& (!\OC::$server->getShareManager()->sharingDisabledForUser($this->userId))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +103,8 @@ class PermissionService {
|
|||||||
Acl::PERMISSION_READ => $owner || $this->userCan($acls, Acl::PERMISSION_READ),
|
Acl::PERMISSION_READ => $owner || $this->userCan($acls, Acl::PERMISSION_READ),
|
||||||
Acl::PERMISSION_EDIT => $owner || $this->userCan($acls, Acl::PERMISSION_EDIT),
|
Acl::PERMISSION_EDIT => $owner || $this->userCan($acls, Acl::PERMISSION_EDIT),
|
||||||
Acl::PERMISSION_MANAGE => $owner || $this->userCan($acls, Acl::PERMISSION_MANAGE),
|
Acl::PERMISSION_MANAGE => $owner || $this->userCan($acls, Acl::PERMISSION_MANAGE),
|
||||||
Acl::PERMISSION_SHARE => $owner || $this->userCan($acls, Acl::PERMISSION_SHARE),
|
Acl::PERMISSION_SHARE => ($owner || $this->userCan($acls, Acl::PERMISSION_SHARE))
|
||||||
|
&& (!\OC::$server->getShareManager()->sharingDisabledForUser($this->userId))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +127,10 @@ class PermissionService {
|
|||||||
throw new NoPermissionException('Permission denied');
|
throw new NoPermissionException('Permission denied');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($permission === Acl::PERMISSION_SHARE && !\OC::$server->getShareManager()->sharingDisabledForUser($this->userId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->userIsBoardOwner($boardId)) {
|
if ($this->userIsBoardOwner($boardId)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -150,7 +156,7 @@ class PermissionService {
|
|||||||
} catch (DoesNotExistException $e) {
|
} catch (DoesNotExistException $e) {
|
||||||
} catch (MultipleObjectsReturnedException $e) {
|
} catch (MultipleObjectsReturnedException $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user