aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AdminPanel/Module
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2014-10-11 16:11:31 +0200
committerAngelo Naselli <anaselli@linux.it>2014-10-11 16:11:31 +0200
commitd79e5d4de09d38882d111341ed17bdb1b181050b (patch)
tree267abcb03261835b52127491441546f6156cd086 /lib/AdminPanel/Module
parent2552e8a2749d59d57db11d801d5cfdcf384f8c1b (diff)
downloadcolin-keep-d79e5d4de09d38882d111341ed17bdb1b181050b.tar
colin-keep-d79e5d4de09d38882d111341ed17bdb1b181050b.tar.gz
colin-keep-d79e5d4de09d38882d111341ed17bdb1b181050b.tar.bz2
colin-keep-d79e5d4de09d38882d111341ed17bdb1b181050b.tar.xz
colin-keep-d79e5d4de09d38882d111341ed17bdb1b181050b.zip
moved getGroupsInfo to Shared and updated RefreshGroup accordingly
Diffstat (limited to 'lib/AdminPanel/Module')
-rw-r--r--lib/AdminPanel/Module/Users.pm41
1 files changed, 10 insertions, 31 deletions
diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index b32b948..cf70942 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -1193,40 +1193,19 @@ sub _refreshGroups {
# WA remove notification immediate
$self->get_widget('table')->setImmediateMode(0);
$self->get_widget('table')->deleteAllItems();
- my @GroupReal;
- LOOP: foreach my $g (@$groups) {
- next LOOP if $filtergroups && $g->Gid($self->sh_users->USER_GetValue) <= 499 || $g->Gid($self->sh_users->USER_GetValue) == 65534;
-
- if ($filtergroups && $g->Gid($self->sh_users->USER_GetValue) > 499 && $g->Gid($self->sh_users->USER_GetValue) < 1000) {
- my $groupname = $g->GroupName($self->sh_users->USER_GetValue);
- my $l = $self->sh_users->ctx->LookupUserByName($groupname);
- if (!defined($l)) {
- my $members = $self->sh_users->ctx->EnumerateUsersByGroup($groupname);
- next LOOP if !scalar(@{$members});
- foreach my $username (@$members) {
- my $userEnt = $self->sh_users->ctx->LookupUserByName($username);
- next LOOP if $userEnt->HomeDir($self->sh_users->USER_GetValue) =~ /^\/($|var\/|run\/)/ || $userEnt->LoginShell($self->sh_users->USER_GetValue) =~ /(nologin|false)$/;
- }
- }
- else {
- next LOOP if $l->HomeDir($self->sh_users->USER_GetValue) =~ /^\/($|var\/|run\/)/ || $l->LoginShell($self->sh_users->USER_GetValue) =~ /(nologin|false)$/;
- }
- }
- push @GroupReal, $g if $g->GroupName($self->sh_users->USER_GetValue) =~ /^\Q$strfilt/;
- }
+ my $groupInfo = $self->sh_users->getGroupsInfo({
+ groupname_filter => $strfilt,
+ filter_system => $filtergroups,
+ });
my $itemColl = new yui::YItemCollection;
- foreach my $g (@GroupReal) {
- my $a = $g->GroupName($self->sh_users->USER_GetValue);
- #my $group = $ctx->LookupGroupById($a);
- my $u_b_g = $a && $self->sh_users->ctx->EnumerateUsersByGroup($a);
- my $listUbyG = join(',', @$u_b_g);
- my $group_id = $g->Gid($self->sh_users->USER_GetValue);
- my $groupname = $g->GroupName($self->sh_users->USER_GetValue);
- my $item = new yui::YTableItem ("$groupname",
- "$group_id",
- "$listUbyG");
+ foreach my $groupname (keys %{$groupInfo}) {
+ my $info = $groupInfo->{$groupname};
+ my $listUbyG = join(',', @{$info->{members}});
+ my $item = new yui::YTableItem ("$groupname",
+ "$info->{gid}",
+ "$listUbyG");
$item->setLabel( $groupname );
$itemColl->push($item);
$item->DISOWN();