Release 2.13 (#4659)
This commit is contained in:
@@ -29,21 +29,23 @@ final class TeamVoter extends Voter
|
||||
'delete',
|
||||
];
|
||||
|
||||
public function __construct(private RolePermissionManager $permissionManager)
|
||||
public function __construct(private readonly RolePermissionManager $permissionManager)
|
||||
{
|
||||
}
|
||||
|
||||
public function supportsAttribute(string $attribute): bool
|
||||
{
|
||||
return \in_array($attribute, self::ALLOWED_ATTRIBUTES, true);
|
||||
}
|
||||
|
||||
public function supportsType(string $subjectType): bool
|
||||
{
|
||||
return str_contains($subjectType, Team::class);
|
||||
}
|
||||
|
||||
protected function supports(string $attribute, mixed $subject): bool
|
||||
{
|
||||
if (!($subject instanceof Team)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!\in_array($attribute, self::ALLOWED_ATTRIBUTES)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return $subject instanceof Team && $this->supportsAttribute($attribute);
|
||||
}
|
||||
|
||||
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
|
||||
|
||||
Reference in New Issue
Block a user