Modify OpenVKPresenter::hasPermission

This commit is contained in:
Alma Armas 2020-07-17 16:25:08 +00:00
parent d8db273f20
commit e4787750fa

View file

@ -72,7 +72,7 @@ abstract class OpenVKPresenter extends SimplePresenter
return ($action === "register" || $action === "login");
}
return (bool) $this->user->raw->can($action)->model($model)->whichBelongsTo($context);
return (bool) $this->user->raw->can($action)->model($model)->whichBelongsTo($context === -1 ? null : $context);
}
protected function assertPermission(string $model, string $action, int $context, bool $throw = false): void