mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 08:14:04 +02:00
RestApi: allow to override permission check
This commit is contained in:
parent
e562d00a50
commit
475c84de1e
@ -18,13 +18,17 @@ trait RestApi
|
||||
}
|
||||
}
|
||||
|
||||
protected function assertApiPermission()
|
||||
{
|
||||
if (! $this->hasPermission('director/api')) {
|
||||
throw new AuthenticationException('You are not allowed to access this API');
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkForRestApiRequest()
|
||||
{
|
||||
if ($this->getRequest()->isApiRequest()) {
|
||||
if (! $this->hasPermission('director/api')) {
|
||||
throw new AuthenticationException('You are not allowed to access this API');
|
||||
}
|
||||
|
||||
$this->assertApiPermission();
|
||||
if (! $this->isApified()) {
|
||||
throw new NotFoundError('No such API endpoint found');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user