Add method getUserBackendName() to UserGroupBackendInterface
refs #10367 refs #10373
This commit is contained in:
parent
635bb3eec6
commit
34bf0c3cb0
|
@ -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): ?>
|
|||
<td class="member-name">
|
||||
<?php if (
|
||||
$this->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)
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue