Skip to content

Commit

Permalink
[Community] fixes users list access
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Sep 5, 2023
1 parent c6b235d commit 58c2495
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/core/Security/Voter/WorkspaceVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public function checkPermission(TokenInterface $token, $object, array $attribute
if ($this->workspaceManager->hasAccess($object, $token, $toolPerm[0], $toolPerm[1])) {
return VoterInterface::ACCESS_GRANTED;
}
} elseif (self::OPEN === $attributes[0]) {
// check if the user has access to at least one workspace tool to grant him access.
if ($this->workspaceManager->hasAccess($object, $token)) {
return VoterInterface::ACCESS_GRANTED;
}
}

return VoterInterface::ACCESS_DENIED;
Expand Down Expand Up @@ -125,7 +130,7 @@ private function checkView($token, Workspace $workspace): int

private function checkPatch(TokenInterface $token, Workspace $workspace, ObjectCollection $collection = null): int
{
//single property: no check now
// single property: no check now
if (!$collection) {
return VoterInterface::ACCESS_GRANTED;
}
Expand All @@ -134,7 +139,7 @@ private function checkPatch(TokenInterface $token, Workspace $workspace, ObjectC
return VoterInterface::ACCESS_GRANTED;
}

//maybe do something more complicated later
// maybe do something more complicated later
return $this->isGranted(self::EDIT, $collection) ?
VoterInterface::ACCESS_GRANTED : VoterInterface::ACCESS_DENIED;
}
Expand All @@ -151,7 +156,7 @@ private function isWorkspaceCreator(TokenInterface $token): bool

public function getSupportedActions(): ?array
{
//atm, null means "everything is supported... implement this later"
// atm, null means "everything is supported... implement this later"
return null;
}
}

0 comments on commit 58c2495

Please sign in to comment.