mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 16:54:04 +02:00
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\Extensible;
|
||||||
use Icinga\Data\Updatable;
|
use Icinga\Data\Updatable;
|
||||||
use Icinga\Data\Selectable;
|
|
||||||
|
|
||||||
$extensible = $this->hasPermission('config/authentication/groups/add') && $backend instanceof Extensible;
|
$extensible = $this->hasPermission('config/authentication/groups/add') && $backend instanceof Extensible;
|
||||||
|
|
||||||
@ -85,12 +84,10 @@ foreach ($members as $member): ?>
|
|||||||
<td class="member-name">
|
<td class="member-name">
|
||||||
<?php if (
|
<?php if (
|
||||||
$this->hasPermission('config/authentication/users/show')
|
$this->hasPermission('config/authentication/users/show')
|
||||||
&& method_exists($backend, 'getUserBackend')
|
&& ($userBackend = $backend->getUserBackendName($member->user_name)) !== null
|
||||||
&& ($userBackend = $backend->getUserBackend()) !== null
|
|
||||||
&& $userBackend instanceof Selectable
|
|
||||||
): ?>
|
): ?>
|
||||||
<?= $this->qlink($member->user_name, 'user/show', array(
|
<?= $this->qlink($member->user_name, 'user/show', array(
|
||||||
'backend' => $userBackend->getName(),
|
'backend' => $userBackend,
|
||||||
'user' => $member->user_name
|
'user' => $member->user_name
|
||||||
), array(
|
), array(
|
||||||
'title' => sprintf($this->translate('Show detailed information about %s'), $member->user_name)
|
'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 $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
|
* Join group into group_membership
|
||||||
*
|
*
|
||||||
|
@ -560,6 +560,21 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
|
|||||||
return $groups;
|
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
|
* Apply the given configuration on this backend
|
||||||
*
|
*
|
||||||
|
@ -34,4 +34,13 @@ interface UserGroupBackendInterface
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getMemberships(User $user);
|
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…
x
Reference in New Issue
Block a user