Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/Service/AssignmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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');
}

Expand Down
1 change: 1 addition & 0 deletions src/components/board/SharingTabSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
emails: 4,
remotes: 6,
circles: 7,
teams: 7,
}

export default {
Expand Down Expand Up @@ -139,7 +140,7 @@
displayName: item.displayname || item.name || item.label || item.id,
user: item.id,
subname: item.shareWithDisplayNameUnique || item.subline || item.id, // NcSelectUser does its own pattern matching to filter things out
type: SOURCE_TO_SHARE_TYPE[item.source]

Check warning on line 143 in src/components/board/SharingTabSidebar.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Missing trailing comma
}
return res
}).slice(0, 10)
Expand Down
Loading