diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index 30f46db50..09e40f408 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -332,7 +332,7 @@ class ConfigController extends Controller public function resourceAction() { $this->assertPermission('config/application/resources'); - $this->view->resources = Config::app('resources', true)->keys(); + $this->view->resources = Config::app('resources', true); $this->createApplicationTabs()->activate('resource'); } diff --git a/application/controllers/UsergroupbackendController.php b/application/controllers/UsergroupbackendController.php index 4c641586c..f0de705a4 100644 --- a/application/controllers/UsergroupbackendController.php +++ b/application/controllers/UsergroupbackendController.php @@ -35,7 +35,7 @@ class UsergroupbackendController extends Controller */ public function listAction() { - $this->view->backendNames = Config::app('groups')->keys(); + $this->view->backendNames = Config::app('groups'); $this->createListTabs()->activate('usergroupbackend'); } diff --git a/application/forms/Config/UserBackendReorderForm.php b/application/forms/Config/UserBackendReorderForm.php index 359f515b1..590a49c96 100644 --- a/application/forms/Config/UserBackendReorderForm.php +++ b/application/forms/Config/UserBackendReorderForm.php @@ -3,6 +3,7 @@ namespace Icinga\Forms\Config; +use Icinga\Application\Config; use Icinga\Forms\ConfigForm; use Icinga\Exception\NotFoundError; use Icinga\Web\Notification; @@ -28,6 +29,16 @@ class UserBackendReorderForm extends ConfigForm return $this->config->keys(); } + /** + * Return the ordered backend configuration + * + * @return Config + */ + public function getConfig() + { + return $this->config; + } + /** * Create and add elements to this form * diff --git a/application/views/scripts/config/resource.phtml b/application/views/scripts/config/resource.phtml index 3e34c308d..740e548d9 100644 --- a/application/views/scripts/config/resource.phtml +++ b/application/views/scripts/config/resource.phtml @@ -11,15 +11,38 @@ <th style="width: 5em"><?= $this->translate('Remove'); ?></th> </thead> <tbody> - <?php foreach ($this->resources as $name): ?> + <?php foreach ($this->resources as $name => $value): ?> <tr> <td> + <?php + switch ($value->type) { + case 'db': + $icon = 'database'; + break; + case 'ldap': + $icon = 'sitemap'; + break; + case 'livestatus': + $icon = 'flash'; + break; + case 'ssh': + $icon = 'user'; + break; + case 'file': + case 'ini': + $icon = 'doc-text'; + break; + default: + $icon = 'edit'; + break; + } + ?> <?= $this->qlink( $name, 'config/editresource', array('resource' => $name), array( - 'icon' => 'edit', + 'icon' => $icon, 'title' => sprintf($this->translate('Edit resource %s'), $name) ) ); ?> diff --git a/application/views/scripts/form/reorder-authbackend.phtml b/application/views/scripts/form/reorder-authbackend.phtml index 3ced989e2..ec1cf7810 100644 --- a/application/views/scripts/form/reorder-authbackend.phtml +++ b/application/views/scripts/form/reorder-authbackend.phtml @@ -6,8 +6,12 @@ <th style="width: 5em"><?= $this->translate('Order'); ?></th> </thead> <tbody> -<?php $backendNames = $form->getBackendOrder(); ?> -<?php for ($i = 0; $i < count($backendNames); $i++): ?> +<?php + $backendNames = $form->getBackendOrder(); + $backendConfigs = $form->getConfig(); + for ($i = 0; $i < count($backendNames); $i++): + $type = $backendConfigs->getSection($backendNames[$i])->get('backend'); +?> <tr> <td class="action"> <?= $this->qlink( @@ -15,7 +19,8 @@ 'config/edituserbackend', array('backend' => $backendNames[$i]), array( - 'icon' => 'edit', + 'icon' => $type === 'external' ? + 'magic' : ($type === 'ldap' || $type === 'msldap' ? 'sitemap' : 'database'), 'class' => 'rowaction', 'title' => sprintf($this->translate('rEdit user backend %s'), $backendNames[$i]) ) diff --git a/application/views/scripts/usergroupbackend/list.phtml b/application/views/scripts/usergroupbackend/list.phtml index 49b6d5372..aa0951026 100644 --- a/application/views/scripts/usergroupbackend/list.phtml +++ b/application/views/scripts/usergroupbackend/list.phtml @@ -19,14 +19,19 @@ <tr> </thead> <tbody> -<?php foreach ($backendNames as $backendName): ?> +<?php foreach ($backendNames as $backendName => $config): + $type = $config->get('backend'); + ?> <tr> <td class="backend-name"> <?= $this->qlink( $backendName, 'usergroupbackend/edit', array('backend' => $backendName), - array('title' => sprintf($this->translate('Edit user group backend %s'), $backendName)) + array( + 'icon' => $type === 'external' ? 'magic' : ($type === 'ldap' || $type === 'msldap' ? 'sitemap' : 'database'), + 'title' => sprintf($this->translate('Edit user group backend %s'), $backendName) + ) ); ?> </td> <td class="backend-remove"><?= $this->qlink(