ApiUser: add all tabs, tables, links
This commit is contained in:
parent
12ecc2a9b8
commit
91250cf0b9
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Controllers;
|
||||
|
||||
use Icinga\Module\Director\Web\Controller\ObjectController;
|
||||
|
||||
class ApiuserController extends ObjectController
|
||||
{
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Controllers;
|
||||
|
||||
use Icinga\Module\Director\Web\Controller\ObjectsController;
|
||||
|
||||
class ApiusersController extends ObjectsController
|
||||
{
|
||||
}
|
|
@ -4,7 +4,7 @@ namespace Icinga\Module\Director\Forms;
|
|||
|
||||
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
||||
|
||||
class IcingaEndpointForm extends DirectorObjectForm
|
||||
class IcingaApiUserForm extends DirectorObjectForm
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
|
@ -23,7 +23,6 @@ class IcingaEndpointForm extends DirectorObjectForm
|
|||
'required' => true,
|
||||
));
|
||||
|
||||
$this->addImportsElement();
|
||||
$this->setButtons();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Tables;
|
||||
|
||||
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
|
||||
|
||||
class IcingaApiUserTable extends IcingaObjectTable
|
||||
{
|
||||
protected $searchColumns = array(
|
||||
'object_name',
|
||||
);
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'id' => 'o.id',
|
||||
'object_name' => 'o.object_name',
|
||||
'object_type' => 'o.object_type',
|
||||
);
|
||||
}
|
||||
|
||||
protected function getActionUrl($row)
|
||||
{
|
||||
return $this->url('director/apiuser', array('name' => $row->object_name));
|
||||
}
|
||||
|
||||
public function getTitles()
|
||||
{
|
||||
$view = $this->view();
|
||||
return array(
|
||||
'object_name' => $view->translate('User'),
|
||||
);
|
||||
}
|
||||
|
||||
public function getBaseQuery()
|
||||
{
|
||||
$db = $this->connection()->getConnection();
|
||||
$query = $db->select()->from(
|
||||
array('o' => 'icinga_apiuser'),
|
||||
array()
|
||||
);
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
|
@ -2,11 +2,14 @@
|
|||
|
||||
namespace Icinga\Module\Director\Objects;
|
||||
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||
|
||||
class IcingaApiUser extends IcingaObject
|
||||
{
|
||||
protected $table = 'icinga_apiuser';
|
||||
|
||||
protected $supportsImports = true;
|
||||
// TODO: Enable (and add table) if required
|
||||
protected $supportsImports = false;
|
||||
|
||||
protected $defaultProperties = array(
|
||||
'id' => null,
|
||||
|
@ -16,4 +19,9 @@ class IcingaApiUser extends IcingaObject
|
|||
'client_dn' => null,
|
||||
'permissions' => null,
|
||||
);
|
||||
|
||||
protected function renderPassword()
|
||||
{
|
||||
return c::renderKeyValue('password', c::renderString('***'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -967,6 +967,8 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
$type = 'userGroup';
|
||||
} elseif ($type === 'servicegroup') {
|
||||
$type = 'serviceGroup';
|
||||
} elseif ($type === 'apiuser') {
|
||||
$type = 'apiUser';
|
||||
}
|
||||
|
||||
return 'Icinga\\Module\\Director\\Objects\\' . $prefix . ucfirst($type);
|
||||
|
|
|
@ -220,8 +220,8 @@ abstract class ObjectController extends ActionController
|
|||
{
|
||||
// Strip final 's' and upcase an eventual 'group'
|
||||
return preg_replace(
|
||||
array('/group$/', '/period$/', '/argument$/'),
|
||||
array('Group', 'Period', 'Argument'),
|
||||
array('/group$/', '/period$/', '/argument$/', '/apiuser$/'),
|
||||
array('Group', 'Period', 'Argument', 'ApiUser'),
|
||||
$this->getRequest()->getControllerName()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -7,9 +7,10 @@ abstract class ObjectsController extends ActionController
|
|||
protected $dummy;
|
||||
|
||||
protected $globalTypes = array(
|
||||
'TimePeriod',
|
||||
'ApiUser',
|
||||
'Zone',
|
||||
'Endpoint'
|
||||
'Endpoint',
|
||||
'TimePeriod',
|
||||
);
|
||||
|
||||
public function init()
|
||||
|
@ -22,7 +23,7 @@ abstract class ObjectsController extends ActionController
|
|||
if (in_array(ucfirst($type), $this->globalTypes)) {
|
||||
$ltype = strtolower($type);
|
||||
$tabs->add('overview', array(
|
||||
'url' => $this->getRequest()->getUrl(),
|
||||
'url' => 'director/welcome',
|
||||
'label' => $this->translate('Overview')
|
||||
));
|
||||
|
||||
|
@ -129,8 +130,8 @@ abstract class ObjectsController extends ActionController
|
|||
{
|
||||
// Strip final 's' and upcase an eventual 'group'
|
||||
return preg_replace(
|
||||
array('/group$/', '/period$/', '/argument$/'),
|
||||
array('Group', 'Period', 'Argument'),
|
||||
array('/group$/', '/period$/', '/argument$/', '/apiuser$/'),
|
||||
array('Group', 'Period', 'Argument', 'ApiUser'),
|
||||
str_replace(
|
||||
'template',
|
||||
'',
|
||||
|
|
Loading…
Reference in New Issue