mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-20 18:09:30 +00:00
Added tests on some security related classes.
This commit is contained in:
parent
6ddc937ec5
commit
bf8455fa42
6 changed files with 169 additions and 38 deletions
|
|
@ -56,7 +56,8 @@ abstract class ExtendedVoter extends Voter
|
|||
|
||||
// if the user is anonymous, we use the anonymous user.
|
||||
if (!$user instanceof User) {
|
||||
$user = $this->entityManager->find(User::class, User::ID_ANONYMOUS);
|
||||
$repo = $this->entityManager->getRepository(User::class);
|
||||
$user = $repo->getAnonymousUser();
|
||||
if (null === $user) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -71,6 +72,7 @@ abstract class ExtendedVoter extends Voter
|
|||
*
|
||||
* @param $attribute
|
||||
* @param $subject
|
||||
* @return bool
|
||||
*/
|
||||
abstract protected function voteOnUser($attribute, $subject, User $user): bool;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue