Upgrade to 4.0.0
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Exception\PermissionException;
|
||||
use Kirby\Exception\AuthException;
|
||||
|
||||
return function () {
|
||||
$auth = $this->kirby()->auth();
|
||||
@@ -11,17 +11,17 @@ return function () {
|
||||
$auth->type($allowImpersonation) === 'session' &&
|
||||
$auth->csrf() === false
|
||||
) {
|
||||
throw new PermissionException('Unauthenticated');
|
||||
throw new AuthException('Unauthenticated');
|
||||
}
|
||||
|
||||
// get user from session or basic auth
|
||||
if ($user = $auth->user(null, $allowImpersonation)) {
|
||||
if ($user->role()->permissions()->for('access', 'panel') === false) {
|
||||
throw new PermissionException(['key' => 'access.panel']);
|
||||
throw new AuthException(['key' => 'access.panel']);
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
throw new PermissionException('Unauthenticated');
|
||||
throw new AuthException('Unauthenticated');
|
||||
};
|
||||
|
Reference in New Issue
Block a user