mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 22:34:24 +02:00
IniUserGroupBackend: Automatically set section names on column `name'
refs #8826
This commit is contained in:
parent
b1cbc1422b
commit
9c799dca22
@ -47,6 +47,14 @@ class IniUserGroupBackend extends Repository implements UserGroupBackendInterfac
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize this ini user group backend
|
||||||
|
*/
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
$this->ds->getConfigObject()->setKeyColumn('name');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the groups the given user is a member of
|
* Return the groups the given user is a member of
|
||||||
*
|
*
|
||||||
@ -60,17 +68,15 @@ class IniUserGroupBackend extends Repository implements UserGroupBackendInterfac
|
|||||||
|
|
||||||
$groups = array();
|
$groups = array();
|
||||||
foreach ($result as $group) {
|
foreach ($result as $group) {
|
||||||
if ($group->group_name) { // TODO: Can we set this somehow automatically to the section's name??
|
$groups[$group->group_name] = $group->parent_name;
|
||||||
$groups[$group->group_name] = $group->parent_name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$username = strtolower($user->getUsername());
|
$username = strtolower($user->getUsername());
|
||||||
$memberships = array();
|
$memberships = array();
|
||||||
foreach ($result as $group) {
|
foreach ($result as $group) {
|
||||||
if ($group->group_name && $group->users) {
|
if ($group->users && !in_array($group->group_name, $memberships)) {
|
||||||
$users = array_map('strtolower', String::trimSplit($group->users));
|
$users = array_map('strtolower', String::trimSplit($group->users));
|
||||||
if (! in_array($group->group_name, $memberships) && in_array($username, $users)) {
|
if (in_array($username, $users)) {
|
||||||
$memberships[] = $group->group_name;
|
$memberships[] = $group->group_name;
|
||||||
$parent = $groups[$group->group_name];
|
$parent = $groups[$group->group_name];
|
||||||
while ($parent !== null) {
|
while ($parent !== null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user