Skip to content

Commit aad6858

Browse files
authored
Merge pull request #7687 from nextcloud/fix-share-and-assign-team
fix: share and assign team issue
2 parents b3c2a0a + 42f1f7a commit aad6858

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

lib/Service/AssignmentService.php

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

51-
if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP && $type !== Assignment::TYPE_REMOTE) {
51+
if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP && $type !== Assignment::TYPE_REMOTE && $type !== Assignment::TYPE_CIRCLE) {
5252
throw new BadRequestException('Invalid type provided for assignemnt');
5353
}
5454

@@ -63,10 +63,14 @@ public function assignUser(int $cardId, string $userId, int $type = Assignment::
6363
$card = $this->cardMapper->find($cardId);
6464
$boardId = $this->cardMapper->findBoardId($cardId);
6565
$boardUsers = array_keys($this->permissionService->findUsers($boardId, true));
66-
$groups = array_filter($this->aclMapper->findAll($boardId), function (Acl $acl) use ($userId) {
66+
$acls = $this->aclMapper->findAll($boardId);
67+
$groups = array_filter($acls, function (Acl $acl) use ($userId) {
6768
return $acl->getType() === Acl::PERMISSION_TYPE_GROUP && $acl->getParticipant() === $userId;
6869
});
69-
if (!in_array($userId, $boardUsers, true) && count($groups) !== 1) {
70+
$teams = array_filter($acls, function (Acl $acl) use ($userId) {
71+
return $acl->getType() === Acl::PERMISSION_TYPE_CIRCLE && $acl->getParticipant() === $userId;
72+
});
73+
if (!in_array($userId, $boardUsers, true) && count($groups) !== 1 && count($teams) !== 1) {
7074
throw new BadRequestException('The user is not part of the board');
7175
}
7276

src/components/board/SharingTabSidebar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ const SOURCE_TO_SHARE_TYPE = {
9191
emails: 4,
9292
remotes: 6,
9393
circles: 7,
94+
teams: 7,
9495
}
9596
9697
export default {

0 commit comments

Comments
 (0)