mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-29 06:19:32 +00:00
Allow to cache support status of voters
This should increase the performance a bit
This commit is contained in:
parent
879b702fc1
commit
7b6ba37667
14 changed files with 133 additions and 2 deletions
|
|
@ -60,6 +60,16 @@ final class UserVoter extends Voter
|
|||
return false;
|
||||
}
|
||||
|
||||
public function supportsAttribute(string $attribute): bool
|
||||
{
|
||||
return $this->helper->isValidOperation('users', $attribute) || $this->helper->isValidOperation('self', $attribute);
|
||||
}
|
||||
|
||||
public function supportsType(string $subjectType): bool
|
||||
{
|
||||
return $subjectType === 'string' || is_a($subjectType, User::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to voteOnAttribute, but checking for the anonymous user is already done.
|
||||
* The current user (or the anonymous user) is passed by $user.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue