mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
event "auth user changed", optimize core_user_changed_groups() to only perform local_group_set() when there are changes needed. found while working on https://github.com/opnsense/core/issues/4411
This commit is contained in:
parent
9731dc8fa7
commit
51489f83de
@ -281,10 +281,10 @@ function core_user_changed_groups($verbose = false, $username)
|
||||
$current_groups = explode(" ", $out[0]);
|
||||
}
|
||||
foreach ($config['system']['group'] as $group) {
|
||||
if (
|
||||
in_array($group['name'], $current_groups) ||
|
||||
(!empty($group['member']) && in_array($user['uid'], $group['member']))
|
||||
) {
|
||||
$in_group = !empty($group['member']) && in_array($user['uid'], $group['member']);
|
||||
$to_remove = in_array($group['name'], $current_groups) && !$in_group;
|
||||
$to_add = !in_array($group['name'], $current_groups) && $in_group;
|
||||
if ($to_remove || $to_add) {
|
||||
local_group_set($group);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user