mirror of
https://github.com/flarum/framework.git
synced 2025-02-01 05:52:02 +08:00
Remove unnecessary indirection
This commit is contained in:
parent
279c7df9b9
commit
0836d99e83
|
@ -35,18 +35,18 @@ trait AssertPermissionTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* Ensure the current user is authenticated.
|
||||
* Ensure the given actor is authenticated.
|
||||
*
|
||||
* This will throw an exception for guest users, signaling that
|
||||
* *authorization* failed. Thus, they could retry the operation after
|
||||
* logging in (or using other means of authentication).
|
||||
*
|
||||
* @param bool $condition
|
||||
* @param User $actor
|
||||
* @throws NotAuthenticatedException
|
||||
*/
|
||||
protected function assertAuthentication($condition)
|
||||
protected function assertRegistered(User $actor)
|
||||
{
|
||||
if (! $condition) {
|
||||
if ($actor->isGuest()) {
|
||||
throw new NotAuthenticatedException;
|
||||
}
|
||||
}
|
||||
|
@ -62,15 +62,6 @@ trait AssertPermissionTrait
|
|||
$this->assertPermission($actor->can($ability, $arguments));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $actor
|
||||
* @throws NotAuthenticatedException
|
||||
*/
|
||||
protected function assertRegistered(User $actor)
|
||||
{
|
||||
$this->assertAuthentication(! $actor->isGuest());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $actor
|
||||
* @throws PermissionDeniedException
|
||||
|
|
Loading…
Reference in New Issue
Block a user