From 216e582df74a80c3f168eacf100501f1cff6c35c Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Sat, 11 Oct 2014 17:34:36 +0200 Subject: managed minimum gid value --- lib/AdminPanel/Shared/Users.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'lib/AdminPanel/Shared') diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm index bfce0e7..1c5b6a4 100644 --- a/lib/AdminPanel/Shared/Users.pm +++ b/lib/AdminPanel/Shared/Users.pm @@ -149,7 +149,7 @@ sub _USERInitialize { return undef; } -## min UID was 500 now is 1000, let's change in a single point +## min (custom) UID was 500 now is 1000, let's change in a single point has 'min_UID' => ( default => 1000, is => 'ro', @@ -157,6 +157,14 @@ has 'min_UID' => ( init_arg => undef, ); +## min (custom) GID was 500 now should be 1000 as for users +has 'min_GID' => ( + default => 1000, + is => 'ro', + isa => 'Int', + init_arg => undef, +); + #============================================================= =head2 BUILD @@ -729,10 +737,10 @@ sub getGroupsInfo { my $groups = $self->ctx->GroupsEnumerateFull; my @GroupReal; - LOOP: foreach my $g (@$groups) { - next LOOP if $filtergroups && $g->Gid($self->USER_GetValue) <= 499 || $g->Gid($self->USER_GetValue) == 65534; - - if ($filtergroups && $g->Gid($self->USER_GetValue) > 499 && $g->Gid($self->USER_GetValue) < 1000) { + LOOP: foreach my $g (@{$groups}) { + my $gid = $g->Gid($self->USER_GetValue); + next LOOP if $filtergroups && $gid <= 499 || $gid == 65534; + if ($filtergroups && $gid > 499 && $gid < $self->min_GID) { my $groupname = $g->GroupName($self->USER_GetValue); my $l = $self->ctx->LookupUserByName($groupname); if (!defined($l)) { @@ -811,7 +819,7 @@ sub getUsersInfo { $users = $self->ctx->UsersEnumerateFull; my @UserReal; - LOOP: foreach my $l (@$users) { + LOOP: foreach my $l (@{$users}) { next LOOP if $filterusers && $l->Uid($self->USER_GetValue) <= 499 || $l->Uid($self->USER_GetValue) == 65534; next LOOP if $filterusers && $l->Uid($self->USER_GetValue) > 499 && $l->Uid($self->USER_GetValue) < $self->min_UID && ($l->HomeDir($self->USER_GetValue) =~ /^\/($|var\/|run\/)/ || $l->LoginShell($self->USER_GetValue) =~ /(nologin|false)$/); -- cgit v1.2.1