diff --git a/application/views/scripts/group/show.phtml b/application/views/scripts/group/show.phtml
index f76ecdf3f..8d81683ee 100644
--- a/application/views/scripts/group/show.phtml
+++ b/application/views/scripts/group/show.phtml
@@ -2,7 +2,6 @@
use Icinga\Data\Extensible;
use Icinga\Data\Updatable;
-use Icinga\Data\Selectable;
$extensible = $this->hasPermission('config/authentication/groups/add') && $backend instanceof Extensible;
@@ -85,12 +84,10 @@ foreach ($members as $member): ?>
hasPermission('config/authentication/users/show')
- && method_exists($backend, 'getUserBackend')
- && ($userBackend = $backend->getUserBackend()) !== null
- && $userBackend instanceof Selectable
+ && ($userBackend = $backend->getUserBackendName($member->user_name)) !== null
): ?>
= $this->qlink($member->user_name, 'user/show', array(
- 'backend' => $userBackend->getName(),
+ 'backend' => $userBackend,
'user' => $member->user_name
), array(
'title' => sprintf($this->translate('Show detailed information about %s'), $member->user_name)
diff --git a/library/Icinga/Authentication/UserGroup/DbUserGroupBackend.php b/library/Icinga/Authentication/UserGroup/DbUserGroupBackend.php
index a114cc8d1..5596f18b6 100644
--- a/library/Icinga/Authentication/UserGroup/DbUserGroupBackend.php
+++ b/library/Icinga/Authentication/UserGroup/DbUserGroupBackend.php
@@ -217,6 +217,18 @@ class DbUserGroupBackend extends DbRepository implements UserGroupBackendInterfa
return $memberships;
}
+ /**
+ * Return the name of the backend that is providing the given user
+ *
+ * @param string $username Currently unused
+ *
+ * @return null|string The name of the backend or null in case this information is not available
+ */
+ public function getUserBackendName($username)
+ {
+ return null; // TODO(10373): Store this to the database when inserting and fetch it here
+ }
+
/**
* Join group into group_membership
*
diff --git a/library/Icinga/Authentication/UserGroup/LdapUserGroupBackend.php b/library/Icinga/Authentication/UserGroup/LdapUserGroupBackend.php
index 54ec1763b..1b1bb31d0 100644
--- a/library/Icinga/Authentication/UserGroup/LdapUserGroupBackend.php
+++ b/library/Icinga/Authentication/UserGroup/LdapUserGroupBackend.php
@@ -560,6 +560,21 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
return $groups;
}
+ /**
+ * Return the name of the backend that is providing the given user
+ *
+ * @param string $username Unused
+ *
+ * @return null|string The name of the backend or null in case this information is not available
+ */
+ public function getUserBackendName($username)
+ {
+ $userBackend = $this->getUserBackend();
+ if ($userBackend !== null) {
+ return $userBackend->getName();
+ }
+ }
+
/**
* Apply the given configuration on this backend
*
diff --git a/library/Icinga/Authentication/UserGroup/UserGroupBackendInterface.php b/library/Icinga/Authentication/UserGroup/UserGroupBackendInterface.php
index a567d1f0a..31dd2c50d 100644
--- a/library/Icinga/Authentication/UserGroup/UserGroupBackendInterface.php
+++ b/library/Icinga/Authentication/UserGroup/UserGroupBackendInterface.php
@@ -34,4 +34,13 @@ interface UserGroupBackendInterface
* @return array
*/
public function getMemberships(User $user);
+
+ /**
+ * Return the name of the backend that is providing the given user
+ *
+ * @param string $username
+ *
+ * @return null|string The name of the backend or null in case this information is not available
+ */
+ public function getUserBackendName($username);
}
|