diff --git a/lib/Service/AssignmentService.php b/lib/Service/AssignmentService.php index 734f7a5f9..dd8d8f17a 100644 --- a/lib/Service/AssignmentService.php +++ b/lib/Service/AssignmentService.php @@ -48,7 +48,7 @@ public function __construct( public function assignUser(int $cardId, string $userId, int $type = Assignment::TYPE_USER): Assignment { $this->assignmentServiceValidator->check(compact('cardId', 'userId')); - if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP && $type !== Assignment::TYPE_REMOTE) { + if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP && $type !== Assignment::TYPE_REMOTE && $type !== Assignment::TYPE_CIRCLE) { throw new BadRequestException('Invalid type provided for assignemnt'); } @@ -63,10 +63,14 @@ public function assignUser(int $cardId, string $userId, int $type = Assignment:: $card = $this->cardMapper->find($cardId); $boardId = $this->cardMapper->findBoardId($cardId); $boardUsers = array_keys($this->permissionService->findUsers($boardId, true)); - $groups = array_filter($this->aclMapper->findAll($boardId), function (Acl $acl) use ($userId) { + $acls = $this->aclMapper->findAll($boardId); + $groups = array_filter($acls, function (Acl $acl) use ($userId) { return $acl->getType() === Acl::PERMISSION_TYPE_GROUP && $acl->getParticipant() === $userId; }); - if (!in_array($userId, $boardUsers, true) && count($groups) !== 1) { + $teams = array_filter($acls, function (Acl $acl) use ($userId) { + return $acl->getType() === Acl::PERMISSION_TYPE_CIRCLE && $acl->getParticipant() === $userId; + }); + if (!in_array($userId, $boardUsers, true) && count($groups) !== 1 && count($teams) !== 1) { throw new BadRequestException('The user is not part of the board'); } diff --git a/src/components/board/SharingTabSidebar.vue b/src/components/board/SharingTabSidebar.vue index 3d0a3de03..035b1f363 100644 --- a/src/components/board/SharingTabSidebar.vue +++ b/src/components/board/SharingTabSidebar.vue @@ -91,6 +91,7 @@ const SOURCE_TO_SHARE_TYPE = { emails: 4, remotes: 6, circles: 7, + teams: 7, } export default {