[core] differentiate permission denied due to missing permission vs error, see #1103
This commit is contained in:
parent
b8ff02f6ba
commit
517f8c0019
1 changed files with 2 additions and 2 deletions
|
@ -217,10 +217,10 @@ class PageRequestEvent extends Event
|
||||||
// if we matched the method and the path, but the page requires
|
// if we matched the method and the path, but the page requires
|
||||||
// authentication and the user is not authenticated, then complain
|
// authentication and the user is not authenticated, then complain
|
||||||
if($authed && $this->is_authed === false) {
|
if($authed && $this->is_authed === false) {
|
||||||
throw new PermissionDenied("Permission Denied");
|
throw new PermissionDenied("Permission Denied: Missing CSRF Token");
|
||||||
}
|
}
|
||||||
if($permission !== null && !$user->can($permission)) {
|
if($permission !== null && !$user->can($permission)) {
|
||||||
throw new PermissionDenied("Permission Denied");
|
throw new PermissionDenied("Permission Denied: {$user->name} lacks permission {$permission}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Reference in a new issue