Skip to content

Commit 9a04c4c

Browse files
committed
rename userIsGranted() to isGrantedForUser()
1 parent 312a726 commit 9a04c4c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Authorization/UserAuthorizationChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(
2424
) {
2525
}
2626

27-
public function userIsGranted(UserInterface $user, mixed $attribute, mixed $subject = null): bool
27+
public function isGrantedForUser(UserInterface $user, mixed $attribute, mixed $subject = null): bool
2828
{
2929
return $this->accessDecisionManager->decide(new UserAuthorizationCheckerToken($user), [$attribute], $subject);
3030
}

Authorization/UserAuthorizationCheckerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ interface UserAuthorizationCheckerInterface
2525
*
2626
* @param mixed $attribute A single attribute to vote on (can be of any type, string and instance of Expression are supported by the core)
2727
*/
28-
public function userIsGranted(UserInterface $user, mixed $attribute, mixed $subject = null): bool;
28+
public function isGrantedForUser(UserInterface $user, mixed $attribute, mixed $subject = null): bool;
2929
}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
7.3
55
---
66

7-
* Add `UserAuthorizationChecker::userIsGranted()` to test user authorization without relying on the session.
7+
* Add `UserAuthorizationChecker::isGrantedForUser()` to test user authorization without relying on the session.
88
For example, users not currently logged in, or while processing a message from a message queue.
99
* Add `OfflineTokenInterface` to mark tokens that do not represent the currently logged-in user
1010

Tests/Authorization/UserAuthorizationCheckerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testIsGranted(bool $decide, array $roles)
4343
->with($this->callback(fn (UserAuthorizationCheckerToken $token): bool => $user === $token->getUser()), $this->identicalTo(['ROLE_FOO']))
4444
->willReturn($decide);
4545

46-
$this->assertSame($decide, $this->authorizationChecker->userIsGranted($user, 'ROLE_FOO'));
46+
$this->assertSame($decide, $this->authorizationChecker->isGrantedForUser($user, 'ROLE_FOO'));
4747
}
4848

4949
public static function isGrantedProvider(): array
@@ -65,6 +65,6 @@ public function testIsGrantedWithObjectAttribute()
6565
->method('decide')
6666
->with($this->isInstanceOf($token::class), $this->identicalTo([$attribute]))
6767
->willReturn(true);
68-
$this->assertTrue($this->authorizationChecker->userIsGranted($token->getUser(), $attribute));
68+
$this->assertTrue($this->authorizationChecker->isGrantedForUser($token->getUser(), $attribute));
6969
}
7070
}

0 commit comments

Comments
 (0)