mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 23:34:08 +02:00
parent
05288e9bea
commit
9ac8253290
@ -5,12 +5,14 @@ namespace Icinga\Controllers;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
|
use Icinga\Authentication\User\DomainAwareInterface;
|
||||||
use Icinga\Data\DataArray\ArrayDatasource;
|
use Icinga\Data\DataArray\ArrayDatasource;
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Data\Reducible;
|
use Icinga\Data\Reducible;
|
||||||
use Icinga\Exception\NotFoundError;
|
use Icinga\Exception\NotFoundError;
|
||||||
use Icinga\Forms\Config\UserGroup\AddMemberForm;
|
use Icinga\Forms\Config\UserGroup\AddMemberForm;
|
||||||
use Icinga\Forms\Config\UserGroup\UserGroupForm;
|
use Icinga\Forms\Config\UserGroup\UserGroupForm;
|
||||||
|
use Icinga\User;
|
||||||
use Icinga\Web\Controller\AuthBackendController;
|
use Icinga\Web\Controller\AuthBackendController;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use Icinga\Web\Notification;
|
use Icinga\Web\Notification;
|
||||||
@ -297,8 +299,27 @@ class GroupController extends AuthBackendController
|
|||||||
$users = array();
|
$users = array();
|
||||||
foreach ($this->loadUserBackends('Icinga\Data\Selectable') as $backend) {
|
foreach ($this->loadUserBackends('Icinga\Data\Selectable') as $backend) {
|
||||||
try {
|
try {
|
||||||
foreach ($backend->select(array('user_name')) as $row) {
|
if ($backend instanceof DomainAwareInterface) {
|
||||||
$users[] = $row;
|
$domain = $backend->getDomain();
|
||||||
|
} else {
|
||||||
|
$domain = null;
|
||||||
|
}
|
||||||
|
foreach ($backend->select(array('user_name')) as $user) {
|
||||||
|
$userObj = new User($user->user_name);
|
||||||
|
if ($domain !== null) {
|
||||||
|
if ($userObj->hasDomain() && $userObj->getDomain() !== $domain) {
|
||||||
|
// Users listed in a user backend which is configured to be responsible for a domain should
|
||||||
|
// not have a domain in their username. Ultimately, if the username has a domain, it must
|
||||||
|
// not differ from the backend's domain. We could log here - but hey, who cares :)
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
$userObj->setDomain($domain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->user_name = $userObj->getUsername();
|
||||||
|
|
||||||
|
$users[] = $user;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Logger::error($e);
|
Logger::error($e);
|
||||||
|
@ -5,6 +5,7 @@ namespace Icinga\Controllers;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
|
use Icinga\Authentication\User\DomainAwareInterface;
|
||||||
use Icinga\Data\DataArray\ArrayDatasource;
|
use Icinga\Data\DataArray\ArrayDatasource;
|
||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
use Icinga\Exception\NotFoundError;
|
use Icinga\Exception\NotFoundError;
|
||||||
@ -96,7 +97,12 @@ class UserController extends AuthBackendController
|
|||||||
$this->httpNotFound(sprintf($this->translate('User "%s" not found'), $userName));
|
$this->httpNotFound(sprintf($this->translate('User "%s" not found'), $userName));
|
||||||
}
|
}
|
||||||
|
|
||||||
$memberships = $this->loadMemberships(new User($userName))->select();
|
$userObj = new User($userName);
|
||||||
|
if ($backend instanceof DomainAwareInterface) {
|
||||||
|
$userObj->setDomain($backend->getDomain());
|
||||||
|
}
|
||||||
|
|
||||||
|
$memberships = $this->loadMemberships($userObj)->select();
|
||||||
|
|
||||||
$this->setupFilterControl(
|
$this->setupFilterControl(
|
||||||
$memberships,
|
$memberships,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user