Skip to content

Commit b06c0a7

Browse files
Merge pull request #7881 from nextcloud/backport/7687/stable33
[stable33] fix: share and assign team issue
2 parents 773ab60 + 244ccbb commit b06c0a7

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

lib/Service/AssignmentService.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function __construct(
9999
public function assignUser(int $cardId, string $userId, int $type = Assignment::TYPE_USER): Assignment {
100100
$this->assignmentServiceValidator->check(compact('cardId', 'userId'));
101101

102-
if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP) {
102+
if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP && $type !== Assignment::TYPE_CIRCLE) {
103103
throw new BadRequestException('Invalid type provided for assignemnt');
104104
}
105105

@@ -114,10 +114,14 @@ public function assignUser(int $cardId, string $userId, int $type = Assignment::
114114
$card = $this->cardMapper->find($cardId);
115115
$boardId = $this->cardMapper->findBoardId($cardId);
116116
$boardUsers = array_keys($this->permissionService->findUsers($boardId, true));
117-
$groups = array_filter($this->aclMapper->findAll($boardId), function (Acl $acl) use ($userId) {
117+
$acls = $this->aclMapper->findAll($boardId);
118+
$groups = array_filter($acls, function (Acl $acl) use ($userId) {
118119
return $acl->getType() === Acl::PERMISSION_TYPE_GROUP && $acl->getParticipant() === $userId;
119120
});
120-
if (!in_array($userId, $boardUsers) && count($groups) !== 1) {
121+
$teams = array_filter($acls, function (Acl $acl) use ($userId) {
122+
return $acl->getType() === Acl::PERMISSION_TYPE_CIRCLE && $acl->getParticipant() === $userId;
123+
});
124+
if (!in_array($userId, $boardUsers, true) && count($groups) !== 1 && count($teams) !== 1) {
121125
throw new BadRequestException('The user is not part of the board');
122126
}
123127

0 commit comments

Comments
 (0)