Skip to content

Commit 1d41ecd

Browse files
luka-nextcloudbackportbot[bot]
authored andcommitted
fix: share and assign team issue
fix: share and assign team issue Signed-off-by: Luka Trovic <luka@nextcloud.com> [skip ci]
1 parent 85f31bf commit 1d41ecd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/Service/AssignmentService.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,14 @@ public function assignUser($cardId, $userId, int $type = Assignment::TYPE_USER)
118118
$card = $this->cardMapper->find($cardId);
119119
$boardId = $this->cardMapper->findBoardId($cardId);
120120
$boardUsers = array_keys($this->permissionService->findUsers($boardId, true));
121-
$groups = array_filter($this->aclMapper->findAll($boardId), function (Acl $acl) use ($userId) {
121+
$acls = $this->aclMapper->findAll($boardId);
122+
$groups = array_filter($acls, function (Acl $acl) use ($userId) {
122123
return $acl->getType() === Acl::PERMISSION_TYPE_GROUP && $acl->getParticipant() === $userId;
123124
});
124-
if (!in_array($userId, $boardUsers, true) && count($groups) !== 1) {
125+
$teams = array_filter($acls, function (Acl $acl) use ($userId) {
126+
return $acl->getType() === Acl::PERMISSION_TYPE_CIRCLE && $acl->getParticipant() === $userId;
127+
});
128+
if (!in_array($userId, $boardUsers, true) && count($groups) !== 1 && count($teams) !== 1) {
125129
throw new BadRequestException('The user is not part of the board');
126130
}
127131

0 commit comments

Comments
 (0)