Skip to content

Commit 120a6e2

Browse files
Merge pull request #7880 from nextcloud/backport/7687/stable32
[stable32] fix: share and assign team issue
2 parents c655886 + 73138c3 commit 120a6e2

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
@@ -103,7 +103,7 @@ public function __construct(
103103
public function assignUser($cardId, $userId, int $type = Assignment::TYPE_USER) {
104104
$this->assignmentServiceValidator->check(compact('cardId', 'userId'));
105105

106-
if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP) {
106+
if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP && $type !== Assignment::TYPE_CIRCLE) {
107107
throw new BadRequestException('Invalid type provided for assignemnt');
108108
}
109109

@@ -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)