mirror of
https://github.com/flarum/framework.git
synced 2025-02-27 18:11:54 +08:00
Document permission check methods
This commit is contained in:
parent
f7222d7e20
commit
4cab48c0fd
@ -15,6 +15,13 @@ use Flarum\User\Exception\PermissionDeniedException;
|
|||||||
trait AssertPermissionTrait
|
trait AssertPermissionTrait
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Ensure the current user is allowed to do something.
|
||||||
|
*
|
||||||
|
* If the condition is not met, an exception will be thrown that signals the
|
||||||
|
* lack of permissions. This is about *authorization*, i.e. retrying such a
|
||||||
|
* request / operation without a change in permissions (or using another
|
||||||
|
* user account) is pointless.
|
||||||
|
*
|
||||||
* @param bool $condition
|
* @param bool $condition
|
||||||
* @throws PermissionDeniedException
|
* @throws PermissionDeniedException
|
||||||
*/
|
*/
|
||||||
@ -26,6 +33,12 @@ trait AssertPermissionTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Ensure the current user 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 bool $condition
|
||||||
* @throws NotAuthenticatedException
|
* @throws NotAuthenticatedException
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user