AuthBackendController: Add final indexAction
Required to automatically redirect to the first permitted list action. refs #8826
This commit is contained in:
parent
00c31ffd28
commit
7213379cac
|
@ -84,7 +84,7 @@ class ConfigController extends Controller
|
|||
public function indexAction()
|
||||
{
|
||||
if ($this->firstAllowedAction === null) {
|
||||
throw new SecurityException($this->translate('No permission for configuration'));
|
||||
throw new SecurityException($this->translate('No permission for application configuration'));
|
||||
}
|
||||
$action = $this->getTabs()->get($this->firstAllowedAction);
|
||||
if (substr($action->getUrl()->getPath(), 0, 7) === 'config/') {
|
||||
|
|
|
@ -17,14 +17,6 @@ use Icinga\Web\Widget;
|
|||
|
||||
class GroupController extends AuthBackendController
|
||||
{
|
||||
/**
|
||||
* Redirect to this controller's list action
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->redirectNow('group/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* List all user groups of a single backend
|
||||
*/
|
||||
|
|
|
@ -17,14 +17,6 @@ use Icinga\Web\Widget;
|
|||
|
||||
class UserController extends AuthBackendController
|
||||
{
|
||||
/**
|
||||
* Redirect to this controller's list action
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->redirectNow('user/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* List all users of a single backend
|
||||
*/
|
||||
|
|
|
@ -9,6 +9,7 @@ use Icinga\Authentication\User\UserBackend;
|
|||
use Icinga\Authentication\User\UserBackendInterface;
|
||||
use Icinga\Authentication\UserGroup\UserGroupBackend;
|
||||
use Icinga\Authentication\UserGroup\UserGroupBackendInterface;
|
||||
use Icinga\Security\SecurityException;
|
||||
use Icinga\Web\Controller;
|
||||
|
||||
/**
|
||||
|
@ -16,6 +17,22 @@ use Icinga\Web\Controller;
|
|||
*/
|
||||
class AuthBackendController extends Controller
|
||||
{
|
||||
/**
|
||||
* Redirect to the first permitted list action
|
||||
*/
|
||||
final public function indexAction()
|
||||
{
|
||||
if ($this->hasPermission('config/authentication/users/show')) {
|
||||
$this->redirectNow('user/list');
|
||||
} elseif ($this->hasPermission('config/authentication/groups/show')) {
|
||||
$this->redirectNow('group/list');
|
||||
} elseif ($this->hasPermission('config/authentication/roles/show')) {
|
||||
$this->redirectNow('role/list');
|
||||
} else {
|
||||
throw new SecurityException($this->translate('No permission for authentication configuration'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all user backends implementing the given interface
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue