Discussion:
[software/adminpanel] 06/14: moved getUserInfo to Shared
root-odJJhXpcy38dnm+
2014-10-11 22:09:09 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 26413fb9b2dd04171253d1480b8402cf5d74f0ad
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 19:06:25 2014 +0200

moved getUserInfo to Shared
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=26413fb9b2dd04171253d1480b8402cf5d74f0ad

lib/AdminPanel/Module/Users.pm | 48 +++++++++++++++----------------
lib/AdminPanel/Shared/Users.pm | 61 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 83 insertions(+), 26 deletions(-)

diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index a238b7a..ec995b0 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -1281,15 +1281,14 @@ sub _getUserInfo {
}

my %userData;
- $userData{username} = $item->label();
- my $userEnt = $self->sh_users->ctx->LookupUserByName($userData{username});
+ $userData{username} = $item->label();
+
+ my $userInfo = $self->sh_users->getUserInfo($userData{username});

- my $s = $userEnt->Gecos($self->sh_users->USER_GetValue);
- utf8::decode($s);
- $userData{full_name} = $s;
- $userData{shell} = $userEnt->LoginShell($self->sh_users->USER_GetValue);
- $userData{homedir} = $userEnt->HomeDir($self->sh_users->USER_GetValue);
- $userData{UID} = $userEnt->Uid($self->sh_users->USER_GetValue);
+ $userData{full_name} = $userInfo->{fullname};
+ $userData{shell} = $userInfo->{shell};
+ $userData{homedir} = $userInfo->{home};
+ $userData{UID} = $userInfo->{uid};

# default expiration time
my ($day, $mo, $ye) = (localtime())[3, 4, 5];
@@ -1297,9 +1296,10 @@ sub _getUserInfo {
$userData{acc_expm} = $mo+1;
$userData{acc_expd} = $day;
$userData{acc_check_exp} = 0;
- my $expire = $userEnt->ShadowExpire($self->sh_users->USER_GetValue);
+
+ my $expire = $userInfo->{expire};
if ($expire && $expire != -1) {
- my $times = _TimeOfArray($expire, 1);
+ my $times = _TimeOfArray($expire, 1);
$userData{acc_expy} = $times->{year};
$userData{acc_expm} = $times->{month};
$userData{acc_expd} = $times->{dayint};
@@ -1310,29 +1310,27 @@ sub _getUserInfo {
# to change it has to insert a new one
$userData{password} = undef;
$userData{password1} = undef;
- # Check if user account is locked
-
- $userData{lockuser} = $self->sh_users->ctx->IsLocked($userEnt);

+ $userData{lockuser} = $userInfo->{locked};
+ $DB::single = 1;
$userData{icon_face} = $self->sh_users->GetFaceIcon($userData{username});
+
$userData{pwd_check_exp} = 0;
- $userData{pwd_exp_min} = $userEnt->ShadowMin($self->sh_users->USER_GetValue);
- $userData{pwd_exp_max} = $userEnt->ShadowMax($self->sh_users->USER_GetValue);
- $userData{pwd_exp_warn} = $userEnt->ShadowWarn($self->sh_users->USER_GetValue);
- $userData{pwd_exp_inact} = $userEnt->ShadowInact($self->sh_users->USER_GetValue);
-
- if ($userData{pwd_exp_min} && $userData{pwd_exp_min} != -1 ||
- $userData{pwd_exp_max} && $userData{pwd_exp_max} != 99999 ||
- $userData{pwd_exp_warn} && $userData{pwd_exp_warn} != 7 && $userData{pwd_exp_warn} != -1 ||
+ $userData{pwd_exp_min} = $userInfo->{exp_min};
+ $userData{pwd_exp_max} = $userInfo->{exp_max};
+ $userData{pwd_exp_warn} = $userInfo->{exp_warn};
+ $userData{pwd_exp_inact} = $userInfo->{exp_inact};
+ if ($userData{pwd_exp_min} && $userData{pwd_exp_min} != -1 ||
+ $userData{pwd_exp_max} && $userData{pwd_exp_max} != 99999 ||
+ $userData{pwd_exp_warn} && $userData{pwd_exp_warn} != 7 && $userData{pwd_exp_warn} != -1 ||
$userData{pwd_exp_inact} && $userData{pwd_exp_inact} != -1) {
$userData{pwd_check_exp} = 1;
}

- $userData{members} = $self->sh_users->ctx->EnumerateGroupsByUser($userData{username});
- $userData{primary_group} = $userEnt->Gid($self->sh_users->USER_GetValue);
-
- return %userData;
+ $userData{members} = $userInfo->{members};
+ $userData{primary_group} = $userInfo->{gid};

+ return %userData;
}

#=============================================================
diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm
index 52e939b..58b1a41 100644
--- a/lib/AdminPanel/Shared/Users.pm
+++ b/lib/AdminPanel/Shared/Users.pm
@@ -775,6 +775,65 @@ sub getGroupsInfo {

#=============================================================

+=head2 getUserInfo
+
+=head3 INPUT
+
+ $username: user name
+
+=head3 OUTPUT
+
+$userInfo: HASH reference containing
+ uid => user identifier
+ gid => group identifier
+ fullname => user full name
+ home => home directory
+ shell => user shell
+ expire => shadow expire time
+ locked => is locked?
+ exp_min => shadow Min
+ exp_max => shadow Max
+ exp_warn => shadow Warn
+ exp_inact=> shadow Inact
+ members => groups the user belongs to
+
+=head3 DESCRIPTION
+
+This method get all the information for the given user
+
+=cut
+
+#=============================================================
+sub getUserInfo {
+ my ($self, $username) = @_;
+
+ my $userInfo = {};
+ return $userInfo if !defined $self->ctx;
+
+ my $userEnt = $self->ctx->LookupUserByName($username);
+ return $userInfo if !defined($userEnt);
+
+ my $fullname = $userEnt->Gecos($self->USER_GetValue);
+ utf8::decode($fullname);
+ $userInfo->{fullname} = $fullname;
+ $userInfo->{shell} = $userEnt->LoginShell($self->USER_GetValue);
+ $userInfo->{home} = $userEnt->HomeDir($self->USER_GetValue);
+ $userInfo->{uid} = $userEnt->Uid($self->USER_GetValue);
+ $userInfo->{gid} = $userEnt->Gid($self->USER_GetValue);
+ $userInfo->{expire} = $userEnt->ShadowExpire($self->USER_GetValue);
+ $userInfo->{locked} = $self->ctx->IsLocked($userEnt);
+
+ $userInfo->{exp_min} = $userEnt->ShadowMin($self->USER_GetValue);
+ $userInfo->{exp_max} = $userEnt->ShadowMax($self->USER_GetValue);
+ $userInfo->{exp_warn} = $userEnt->ShadowWarn($self->USER_GetValue);
+ $userInfo->{exp_inact} = $userEnt->ShadowInact($self->USER_GetValue);
+ $userInfo->{members} = $self->ctx->EnumerateGroupsByUser($username);
+
+ return $userInfo;
+}
+
+#=============================================================
+
=head2 getUsersInfo

=head3 INPUT
@@ -943,7 +1002,7 @@ sub computeLockExpire {
my $tm = ceil(time()/(24*60*60));
$ep = -1 if int($tm) <= $ep;
my $status = $self->ctx->IsLocked($l) ? $self->loc->N("Locked") : ($ep != -1 ? $self->loc->N("Expired") : '');
- $status;
+ return $status;
}

#=============================================================
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:07 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 5f0446c139df8457637d053438c9e01ba0415228
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 17:36:22 2014 +0200

diagnostic here seem to loop for any warnings.
Removing atm, but needs a better investigation
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=5f0446c139df8457637d053438c9e01ba0415228

lib/AdminPanel/Module.pm | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/lib/AdminPanel/Module.pm b/lib/AdminPanel/Module.pm
index cdb54a0..cd8c64e 100644
--- a/lib/AdminPanel/Module.pm
+++ b/lib/AdminPanel/Module.pm
@@ -30,7 +30,6 @@ Version 0.01

our $VERSION = '1.0.0';

-use diagnostics;
use yui;

=head1 SUBROUTINES/METHODS
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:06 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 216e582df74a80c3f168eacf100501f1cff6c35c
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 17:34:36 2014 +0200

managed minimum gid value
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=216e582df74a80c3f168eacf100501f1cff6c35c

lib/AdminPanel/Module/Users.pm | 25 +++++++++++++------------
lib/AdminPanel/Shared/Users.pm | 20 ++++++++++++++------
2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index cf70942..a238b7a 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -571,7 +571,7 @@ sub _addGroupDialog {
$hbox = $factory->createHBox($align);
my $gidManually = $factory->createCheckBox($hbox, $self->loc->N("Specify group ID manually"), 0);
$factory->createHSpacing($hbox, 2);
- my $GID = $factory->createIntField($hbox, $self->loc->N("GID"), 1, 65000, 500);
+ my $GID = $factory->createIntField($hbox, $self->loc->N("GID"), 1, 65000, $self->sh_users->min_GID);
$GID->setEnabled($gidManually->value());
$gidManually->setNotify(1);

@@ -608,12 +608,15 @@ sub _addGroupDialog {
$continue = 0;
}

- my $gid = 0;
+ my $gid = -1;
if ($continue && $gidManually->value()) {
- if (($gid = $GID->value()) < 500) {
+ if (($gid = $GID->value()) < $self->sh_users->min_GID) {
$errorString = "";
- my $gidchoice = $self->sh_gui->ask_YesOrNo({ title => $self->loc->N(" Group Gid is < 500"),
- text => $self->loc->N("Creating a group with a GID less than 500 is not recommended.\n Are you sure you want to do this?\n\n")});
+ my $gidchoice = $self->sh_gui->ask_YesOrNo({ title => $self->loc->N(" Group Gid is < %n", $self->sh_users->min_GID),
+ text => $self->loc->N("Creating a group with a GID less than %d is not recommended.\n Are you sure you want to do this?\n\n",
+ $self->sh_users->min_GID
+ )
+ });
$continue = $gidchoice;
} else {
if ($self->sh_users->groupIDExists($gid)) {
@@ -632,11 +635,12 @@ sub _addGroupDialog {
}
else {
Sys::Syslog::syslog('info|local1', $self->loc->N("Adding group: %s ", $groupname));
- $self->sh_users->addGroup({
+ my $groupParams = {
groupname => $groupname,
- gid => $gid,
is_system => $is_system,
- });
+ };
+ $groupParams->{gid} = $gid if $gid != -1;
+ $self->sh_users->addGroup($groupParams);
$self->_refresh();
last;
}
@@ -1185,9 +1189,6 @@ sub _refreshGroups {
my $strfilt = $self->get_widget('filter')->value();
my $filtergroups = $self->get_widget('filter_system')->isChecked();

- my $groups;
- defined $self->sh_users->ctx and $groups = $self->sh_users->ctx->GroupsEnumerateFull;
-
$self->dialog->startMultipleChanges();
#for some reasons QT send an event using table->selectItem()
# WA remove notification immediate
@@ -1196,7 +1197,7 @@ sub _refreshGroups {

my $groupInfo = $self->sh_users->getGroupsInfo({
groupname_filter => $strfilt,
- filter_system => $filtergroups,
+ filter_system => $filtergroups,
});

my $itemColl = new yui::YItemCollection;
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)$/);
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:12 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit f3a2a6151cc1161fe39ae5bd23c63728100c087b
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 22:20:56 2014 +0200

added shadow last changes to Shared getUserInfo and update GUI
accordingly
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=f3a2a6151cc1161fe39ae5bd23c63728100c087b

lib/AdminPanel/Module/Users.pm | 5 ++-
lib/AdminPanel/Shared/Users.pm | 54 ++++++++++++++++++++-------------------
2 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index 78c242d..b493e09 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -1639,8 +1639,9 @@ sub _userPasswordInfoTabWidget {
my $layout = $factory->createVBox($replace_pnt);

my %userPasswordWidget;
- my $userEnt = $self->sh_users->ctx->LookupUserByName($userData->{username});
- my $lastchg = $userEnt->ShadowLastChange($self->sh_users->USER_GetValue);
+
+ my $userInfo = $self->sh_users->getUserInfo($userData->{username});
+ my $lastchg = $userInfo->{last_change};

my $align = $factory->createLeft($layout);
my $hbox = $factory->createHBox($align);
diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm
index 58b1a41..ea2d0fd 100644
--- a/lib/AdminPanel/Shared/Users.pm
+++ b/lib/AdminPanel/Shared/Users.pm
@@ -784,18 +784,19 @@ sub getGroupsInfo {
=head3 OUTPUT

$userInfo: HASH reference containing
- uid => user identifier
- gid => group identifier
- fullname => user full name
- home => home directory
- shell => user shell
- expire => shadow expire time
- locked => is locked?
- exp_min => shadow Min
- exp_max => shadow Max
- exp_warn => shadow Warn
- exp_inact=> shadow Inact
- members => groups the user belongs to
+ uid => user identifier
+ gid => group identifier
+ fullname => user full name
+ home => home directory
+ shell => user shell
+ expire => shadow expire time
+ locked => is locked?
+ exp_min => shadow Min
+ exp_max => shadow Max
+ exp_warn => shadow Warn
+ exp_inact => shadow Inact
+ last_change => Shadow last change
+ members => groups the user belongs to

=head3 DESCRIPTION

@@ -813,21 +814,22 @@ sub getUserInfo {
my $userEnt = $self->ctx->LookupUserByName($username);
return $userInfo if !defined($userEnt);

- my $fullname = $userEnt->Gecos($self->USER_GetValue);
+ my $fullname = $userEnt->Gecos($self->USER_GetValue);
utf8::decode($fullname);
- $userInfo->{fullname} = $fullname;
- $userInfo->{shell} = $userEnt->LoginShell($self->USER_GetValue);
- $userInfo->{home} = $userEnt->HomeDir($self->USER_GetValue);
- $userInfo->{uid} = $userEnt->Uid($self->USER_GetValue);
- $userInfo->{gid} = $userEnt->Gid($self->USER_GetValue);
- $userInfo->{expire} = $userEnt->ShadowExpire($self->USER_GetValue);
- $userInfo->{locked} = $self->ctx->IsLocked($userEnt);
-
- $userInfo->{exp_min} = $userEnt->ShadowMin($self->USER_GetValue);
- $userInfo->{exp_max} = $userEnt->ShadowMax($self->USER_GetValue);
- $userInfo->{exp_warn} = $userEnt->ShadowWarn($self->USER_GetValue);
- $userInfo->{exp_inact} = $userEnt->ShadowInact($self->USER_GetValue);
- $userInfo->{members} = $self->ctx->EnumerateGroupsByUser($username);
+ $userInfo->{fullname} = $fullname;
+ $userInfo->{shell} = $userEnt->LoginShell($self->USER_GetValue);
+ $userInfo->{home} = $userEnt->HomeDir($self->USER_GetValue);
+ $userInfo->{uid} = $userEnt->Uid($self->USER_GetValue);
+ $userInfo->{gid} = $userEnt->Gid($self->USER_GetValue);
+ $userInfo->{expire} = $userEnt->ShadowExpire($self->USER_GetValue);
+ $userInfo->{locked} = $self->ctx->IsLocked($userEnt);
+
+ $userInfo->{exp_min} = $userEnt->ShadowMin($self->USER_GetValue);
+ $userInfo->{exp_max} = $userEnt->ShadowMax($self->USER_GetValue);
+ $userInfo->{exp_warn} = $userEnt->ShadowWarn($self->USER_GetValue);
+ $userInfo->{exp_inact} = $userEnt->ShadowInact($self->USER_GetValue);
+ $userInfo->{last_change} = $userEnt->ShadowLastChange($self->USER_GetValue);
+ $userInfo->{members} = $self->ctx->EnumerateGroupsByUser($username);

return $userInfo;
}
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:11 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 05cddf373d098c9550bd6ac430689ffd2f15748c
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 22:11:16 2014 +0200

got groupMembers from Shared
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=05cddf373d098c9550bd6ac430689ffd2f15748c

lib/AdminPanel/Module/Users.pm | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index f10b6eb..78c242d 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -1343,8 +1343,8 @@ sub _getUserInfo {
=head3 OUTPUT

%groupData: selected group info as:
- $groupname: group name
- $members: users that are members of this group
+ $groupname: group name
+ $members: users that are members of this group

=head3 DESCRIPTION

@@ -1371,8 +1371,7 @@ sub _getGroupInfo {
$groupData{start_groupname} = $item->label();
$groupData{groupname} = $item->label();

- my $groupEnt = $self->sh_users->ctx->LookupGroupByName($groupData{groupname});
- $groupData{members} = $self->sh_users->ctx->EnumerateUsersByGroup($groupData{groupname});
+ $groupData{members} = $self->sh_users->groupMembers($groupData{groupname});

return %groupData;
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:08 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 68df8b379529df413788a324044127f0a89476a0
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 17:43:52 2014 +0200

just get uid once
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=68df8b379529df413788a324044127f0a89476a0

lib/AdminPanel/Shared/Users.pm | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm
index 1c5b6a4..52e939b 100644
--- a/lib/AdminPanel/Shared/Users.pm
+++ b/lib/AdminPanel/Shared/Users.pm
@@ -820,8 +820,9 @@ sub getUsersInfo {

my @UserReal;
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 &&
+ my $uid = $l->Uid($self->USER_GetValue);
+ next LOOP if $filterusers && $uid <= 499 || $uid == 65534;
+ next LOOP if $filterusers && $uid > 499 && $uid < $self->min_UID &&
($l->HomeDir($self->USER_GetValue) =~ /^\/($|var\/|run\/)/ || $l->LoginShell($self->USER_GetValue) =~ /(nologin|false)$/);
push @UserReal, $l if $l->UserName($self->USER_GetValue) =~ /^\Q$strfilt/;
}
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:04 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 2552e8a2749d59d57db11d801d5cfdcf384f8c1b
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 15:20:19 2014 +0200

removed useless code
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=2552e8a2749d59d57db11d801d5cfdcf384f8c1b

lib/AdminPanel/Shared/Users.pm | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm
index 0c23cc2..c77fbea 100644
--- a/lib/AdminPanel/Shared/Users.pm
+++ b/lib/AdminPanel/Shared/Users.pm
@@ -612,7 +612,6 @@ sub groupMembers {

return $groupname if !defined($groupname);

- my $groupEnt = $self->ctx->LookupGroupByName($groupname);
my $members = $self->ctx->EnumerateUsersByGroup($groupname);

return $members;
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:05 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit d79e5d4de09d38882d111341ed17bdb1b181050b
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 16:11:31 2014 +0200

moved getGroupsInfo to Shared and updated RefreshGroup accordingly
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=d79e5d4de09d38882d111341ed17bdb1b181050b

lib/AdminPanel/Module/Users.pm | 41 +++++--------------
lib/AdminPanel/Shared/Users.pm | 85 ++++++++++++++++++++++++++++++++++++++--
2 files changed, 91 insertions(+), 35 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();
diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm
index c77fbea..bfce0e7 100644
--- a/lib/AdminPanel/Shared/Users.pm
+++ b/lib/AdminPanel/Shared/Users.pm
@@ -688,6 +688,83 @@ sub deleteGroup {
return 1;
}

+
+#=============================================================
+
+=head2 getGroupsInfo
+
+$options: HASH reference containing
+ groupname_filter => groupname search string
+ filter_system => hides system groups
+
+=head3 OUTPUT
+
+ $groupsInfo: HASH reference containing
+ groupname-1 => {
+ gid => group identifier
+ members => ARRAY of username
+ }
+ groupname-2 => {
+ ...
+ }
+
+=head3 DESCRIPTION
+
+ This method get group information (all groups or the
+ filtered ones)
+
+
+=cut
+
+#=============================================================
+sub getGroupsInfo {
+ my ($self, $options) = @_;
+
+ my $groupsInfo = {};
+ return $groupsInfo if !defined $self->ctx;
+
+ my $strfilt = $options->{groupname_filter} if exists($options->{groupname_filter});
+ my $filtergroups = $options->{filter_system} if exists($options->{filter_system});
+
+ 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) {
+ my $groupname = $g->GroupName($self->USER_GetValue);
+ my $l = $self->ctx->LookupUserByName($groupname);
+ if (!defined($l)) {
+ my $members = $self->ctx->EnumerateUsersByGroup($groupname);
+ next LOOP if !scalar(@{$members});
+ foreach my $username (@$members) {
+ my $userEnt = $self->ctx->LookupUserByName($username);
+ next LOOP if $userEnt->HomeDir($self->USER_GetValue) =~ /^\/($|var\/|run\/)/ || $userEnt->LoginShell($self->USER_GetValue) =~ /(nologin|false)$/;
+ }
+ }
+ else {
+ next LOOP if $l->HomeDir($self->USER_GetValue) =~ /^\/($|var\/|run\/)/ || $l->LoginShell($self->USER_GetValue) =~ /(nologin|false)$/;
+ }
+ }
+ push @GroupReal, $g if $g->GroupName($self->USER_GetValue) =~ /^\Q$strfilt/;
+ }
+
+ foreach my $g (@GroupReal) {
+ my $groupname = $g->GroupName($self->USER_GetValue);
+ my $u_b_g = $self->ctx->EnumerateUsersByGroup($groupname);
+ my $group_id = $g->Gid($self->USER_GetValue);
+
+ $groupsInfo->{"$groupname"} = {
+ gid => $group_id,
+ members => $u_b_g,
+ };
+ }
+
+ return $groupsInfo;
+}
+
+
#=============================================================

=head2 getUsersInfo
@@ -700,7 +777,7 @@ $options: HASH reference containing

=head3 OUTPUT

-%users: HASH reference containing
+$usersInfo: HASH reference containing
username-1 => {
uid => user identifier
group => primary group name
@@ -716,7 +793,7 @@ $options: HASH reference containing

=head3 DESCRIPTION

-This method get users information (all or by using a filter)
+This method get user information (all users or filtered ones)

=cut

@@ -746,8 +823,8 @@ sub getUsersInfo {
$i++;
my $uid = $l->Uid($self->USER_GetValue);
if (!defined $uid) {
- warn "bogus user at line $i\n";
- next;
+ warn "bogus user at line $i\n";
+ next;
}
my $gid = $l->Gid($self->USER_GetValue);
$group = $self->ctx->LookupGroupById($gid);
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:17 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 6e6caf186efc7e0be848fd542211313871b73e5e
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sun Oct 12 00:08:51 2014 +0200

unused code
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=6e6caf186efc7e0be848fd542211313871b73e5e

lib/AdminPanel/Module/Users.pm | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index b27d80f..217d46e 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -1722,7 +1722,6 @@ sub _groupUsersTabWidget {

$groupUsersWidget{members} = $mgaFactory->createCBTable($layout, $yTableHeader, $yui::YCBTableCheckBoxOnFirstColumn);

- my $groupEnt = $self->sh_users->ctx->LookupGroupByName($groupData{groupname});
my $users = $self->sh_users->getUsers();
my @susers = sort(@$users);
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:16 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit f237dadcc128c26758dee330a6a2df30b6f0811b
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sun Oct 12 00:06:03 2014 +0200

fixed some of group management
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=f237dadcc128c26758dee330a6a2df30b6f0811b

lib/AdminPanel/Module/Users.pm | 12 ++++--------
lib/AdminPanel/Shared/Users.pm | 40 ++++++++++++++++++++--------------------
2 files changed, 24 insertions(+), 28 deletions(-)

diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index cfe0948..b27d80f 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -1437,17 +1437,16 @@ sub _storeDataFromUserEditPreviousTab {
elsif ($previus_tab eq $userEditLabel{groups}) {
my $tbl = $self->get_edit_tab_widget('members');
$userData->{members} = undef;
- my @members;
+ my @members;
my $i;
for($i=0;$i<$tbl->itemsCount();$i++) {
push (@members, $tbl->item($i)->label()) if $tbl->toCBYTableItem($tbl->item($i))->checked();
}
- $userData->{members} = [ @members ];
+ $userData->{members} = \@members;

if ($self->get_edit_tab_widget('primary_group')->selectedItem()) {
- my $Gent = $self->sh_users->ctx->LookupGroupByName($self->get_edit_tab_widget('primary_group')->selectedItem()->label());
- my $primgroup = $Gent->Gid($self->sh_users->USER_GetValue);
-
+ my $groupname = $self->get_edit_tab_widget('primary_group')->selectedItem()->label();
+ my $primgroup = $self->sh_users->groupID($groupname);
$userData->{primary_group} = $primgroup;
}
else {
@@ -1725,8 +1724,6 @@ sub _groupUsersTabWidget {

my $groupEnt = $self->sh_users->ctx->LookupGroupByName($groupData{groupname});
my $users = $self->sh_users->getUsers();
- $DB::single = 1;
-
my @susers = sort(@$users);

my $itemCollection = new yui::YItemCollection;
@@ -1901,7 +1898,6 @@ sub _userEdit_Ok {

my $members = $userData->{members};
foreach my $group (@sgroups) {
-
my $gEnt = $self->sh_users->ctx->LookupGroupByName($group);
my $ugid = $gEnt->Gid($self->sh_users->USER_GetValue);
my $m = $gEnt->MemberName(1,0);
diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm
index 8565063..237fee9 100644
--- a/lib/AdminPanel/Shared/Users.pm
+++ b/lib/AdminPanel/Shared/Users.pm
@@ -490,26 +490,6 @@ sub getGoups {
return $self->ctx->GroupsEnumerate;
}

-#=============================================================
-
-=head2 getUsers
-
-=head3 OUTPUT
-
- $users: ARRAY reference containing all the users
-
-=head3 DESCRIPTION
-
- This method return the configured users
-
-=cut
-
-#=============================================================
-sub getUsers {
- my $self = shift;
-
- return $self->ctx->UsersEnumerate;
-}

#=============================================================

@@ -814,6 +794,26 @@ sub getGroupsInfo {
return $groupsInfo;
}

+#=============================================================
+
+=head2 getUsers
+
+=head3 OUTPUT
+
+ $users: ARRAY reference containing all the users
+
+=head3 DESCRIPTION
+
+ This method return the configured users
+
+=cut
+
+#=============================================================
+sub getUsers {
+ my $self = shift;
+
+ return $self->ctx->UsersEnumerate;
+}

#=============================================================
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:15 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 634c11085639aa80caf6e546bd916b5c4f6e89ee
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sun Oct 12 00:05:19 2014 +0200

Shared is not a class atm
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=634c11085639aa80caf6e546bd916b5c4f6e89ee

lib/AdminPanel/Shared.pm | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/lib/AdminPanel/Shared.pm b/lib/AdminPanel/Shared.pm
index 5103997..9fb4999 100644
--- a/lib/AdminPanel/Shared.pm
+++ b/lib/AdminPanel/Shared.pm
@@ -223,7 +223,6 @@ sub trim {

=head3 INPUT

- $self: this object
$item: item to search
$arr: array container

@@ -239,7 +238,7 @@ This method returns if an item is into the array container

#=============================================================
sub inArray {
- my ($self, $item, $arr) = @_;
+ my ($item, $arr) = @_;

return grep( /^$item$/, @{$arr} );
}
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:13 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 21cc701e6c2540d37fcff33cc850e0a814b28554
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 22:46:04 2014 +0200

added getGroups and getUsers to Shared
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=21cc701e6c2540d37fcff33cc850e0a814b28554

lib/AdminPanel/Shared/Users.pm | 42 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm
index ea2d0fd..74ad553 100644
--- a/lib/AdminPanel/Shared/Users.pm
+++ b/lib/AdminPanel/Shared/Users.pm
@@ -471,6 +471,48 @@ sub updateOrDelUserInGroup {

#=============================================================

+=head2 getGoups
+
+=head3 OUTPUT
+
+ $groups: ARRAY reference containing all the groups
+
+=head3 DESCRIPTION
+
+ This method return the configured groups
+
+=cut
+
+#=============================================================
+sub getGoups {
+ my $self = shelf;
+
+ return $self->GroupsEnumerate;
+}
+
+#=============================================================
+
+=head2 getUsers
+
+=head3 OUTPUT
+
+ $users: ARRAY reference containing all the users
+
+=head3 DESCRIPTION
+
+ This method return the configured users
+
+=cut
+
+#=============================================================
+sub getUsers {
+ my $self = shelf;
+
+ return $self->ctx->UsersEnumerate;
+}
+
+#=============================================================
+
=head2 groupNameExists

=head3 INPUT
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:14 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit 40d7b7f5f382c62613edc38498baad930dec8f63
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 22:52:29 2014 +0200

Fixed getGroups and getUsers management and usage
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=40d7b7f5f382c62613edc38498baad930dec8f63

lib/AdminPanel/Module/Users.pm | 10 ++++++----
lib/AdminPanel/Shared/Users.pm | 6 +++---
2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index b493e09..cfe0948 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -1724,7 +1724,9 @@ sub _groupUsersTabWidget {
$groupUsersWidget{members} = $mgaFactory->createCBTable($layout, $yTableHeader, $yui::YCBTableCheckBoxOnFirstColumn);

my $groupEnt = $self->sh_users->ctx->LookupGroupByName($groupData{groupname});
- my $users = $self->sh_users->ctx->UsersEnumerate;
+ my $users = $self->sh_users->getUsers();
+ $DB::single = 1;
+
my @susers = sort(@$users);

my $itemCollection = new yui::YItemCollection;
@@ -1769,7 +1771,7 @@ sub _userGroupsTabWidget {

$userGroupsWidget{members} = $mgaFactory->createCBTable($layout, $yTableHeader, $yui::YCBTableCheckBoxOnFirstColumn);

- my $grps = $self->sh_users->ctx->GroupsEnumerate;
+ my $grps = $self->sh_users->getGoups();
my @sgroups = sort @$grps;

my $itemCollection = new yui::YItemCollection;
@@ -1829,7 +1831,7 @@ sub _groupEdit_Ok {

my $members = $groupData{members};
my $gid = $groupEnt->Gid($self->sh_users->USER_GetValue);
- my $users = $self->sh_users->ctx->UsersEnumerate;
+ my $users = $self->sh_users->getUsers();
my @susers = sort(@$users);

foreach my $user (@susers) {
@@ -1894,7 +1896,7 @@ sub _userEdit_Ok {
$userEnt->HomeDir($userData->{homedir});
$userEnt->LoginShell($userData->{shell});
my $username = $userEnt->UserName($self->sh_users->USER_GetValue);
- my $grps = $self->sh_users->ctx->GroupsEnumerate;
+ my $grps = $self->sh_users->getGoups();
my @sgroups = sort @$grps;

my $members = $userData->{members};
diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm
index 74ad553..8565063 100644
--- a/lib/AdminPanel/Shared/Users.pm
+++ b/lib/AdminPanel/Shared/Users.pm
@@ -485,9 +485,9 @@ sub updateOrDelUserInGroup {

#=============================================================
sub getGoups {
- my $self = shelf;
+ my $self = shift;

- return $self->GroupsEnumerate;
+ return $self->ctx->GroupsEnumerate;
}

#=============================================================
@@ -506,7 +506,7 @@ sub getGoups {

#=============================================================
sub getUsers {
- my $self = shelf;
+ my $self = shift;

return $self->ctx->UsersEnumerate;
}
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-11 22:09:10 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

anaselli pushed a commit to branch master
in repository software/adminpanel.

commit caa7bd0c77f555739b361ceafc93c18c02f8557e
Author: Angelo Naselli <anaselli-***@public.gmane.org>
Date: Sat Oct 11 20:07:00 2014 +0200

use a hash reference for user data info instead a hash
---
Commit Link:
http://gitweb.mageia.org/software/adminpanel/commit/?id=caa7bd0c77f555739b361ceafc93c18c02f8557e

lib/AdminPanel/Module/Users.pm | 240 ++++++++++++++++++++--------------------
1 files changed, 118 insertions(+), 122 deletions(-)

diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index ec995b0..f10b6eb 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -665,7 +665,7 @@ sub _addGroupDialog {

=head3 OUTPUT

- %userData: hash containing reference to graphical object
+ $userData: hash reference containing reference to graphical object
such as:
full_name, login_name, password, password1,
login_shell
@@ -763,7 +763,7 @@ sub _buildUserData {
login_shell => $loginShell,
);

- return ( %userData );
+ return ( \%userData );
}

#=============================================================
@@ -815,7 +815,7 @@ sub addUserDialog {
my $dlg = $factory->createPopupDialog();
my $layout = $factory->createVBox($dlg);

- my %userData = $self->_buildUserData($layout);
+ my $userData = $self->_buildUserData($layout);

##### add a separator
## Create Home directory
@@ -885,27 +885,27 @@ sub addUserDialog {
# UID inserction enabled?
$UID->setEnabled($uidManually->value());
}
- elsif ($widget == $userData{ login_name }) {
- my $username = $userData{ login_name }->value();
+ elsif ($widget == $userData->{ login_name }) {
+ my $username = $userData->{ login_name }->value();
$homeDir->setValue("/home/$username");
}
- elsif ($widget == $userData{password}) {
- my $pass = $userData{ password }->value();
- $self->_checkWeaknessPassword($pass, $userData{ weakness });
+ elsif ($widget == $userData->{password}) {
+ my $pass = $userData->{ password }->value();
+ $self->_checkWeaknessPassword($pass, $userData->{ weakness });
}
elsif ($widget == $okButton) {
## check data
- my $username = $userData{ login_name }->value();
+ my $username = $userData->{ login_name }->value();
my ($continue, $errorString) = $self->sh_users->valid_username($username);
my $nm = $continue && $self->sh_users->userNameExists($username);
if ($nm) {
- $userData{ login_name }->setValue("");
+ $userData->{ login_name }->setValue("");
$homeDir->setValue("");
$errorString = $self->loc->N("User already exists, please choose another User Name");
$continue = 0;
}
- my $passwd = $continue && $userData{ password }->value();
- if ($continue && $passwd ne $userData{ password1 }->value()) {
+ my $passwd = $continue && $userData->{ password }->value();
+ if ($continue && $passwd ne $userData->{ password1 }->value()) {
$errorString = $self->loc->N("Password Mismatch");
$continue = 0;
}
@@ -975,8 +975,8 @@ sub addUserDialog {
## OK let's create the user
print $self->loc->N("Adding user: ") . $username . " \n";
Sys::Syslog::syslog('info|local1', $self->loc->N("Adding user: %s", $username));
- my $loginshell = $userData{ login_shell }->value();
- my $fullname = $userData{ full_name }->value();
+ my $loginshell = $userData->{ login_shell }->value();
+ my $fullname = $userData->{ full_name }->value();
utf8::decode($fullname);

my $userParams = {
@@ -1232,7 +1232,7 @@ sub _refreshGroups {

=head3 OUTPUT

- %userData: selected user info as:
+ $userData: HASH reference containing:
username: username
full_name: full name of user
shell: shell used
@@ -1312,7 +1312,6 @@ sub _getUserInfo {
$userData{password1} = undef;

$userData{lockuser} = $userInfo->{locked};
- $DB::single = 1;
$userData{icon_face} = $self->sh_users->GetFaceIcon($userData{username});

$userData{pwd_check_exp} = 0;
@@ -1330,7 +1329,7 @@ sub _getUserInfo {
$userData{members} = $userInfo->{members};
$userData{primary_group} = $userInfo->{gid};

- return %userData;
+ return \%userData;
}

#=============================================================
@@ -1405,59 +1404,59 @@ sub _storeDataFromGroupEditPreviousTab {


sub _storeDataFromUserEditPreviousTab {
- my ($self, %userData) = @_;
+ my ($self, $userData) = @_;

my $previus_tab = $self->get_edit_tab_widget('edit_tab_label');
if (!$previus_tab) {
- return %userData;
+ return $userData;
}
elsif ($previus_tab eq $userEditLabel{user_data}) {
- $userData{full_name} = $self->get_edit_tab_widget('full_name')->value();
- $userData{username} = $self->get_edit_tab_widget('login_name')->value() ;
- $userData{shell} = $self->get_edit_tab_widget('login_shell')->value();
- $userData{homedir} = $self->get_edit_tab_widget('homedir')->value();
+ $userData->{full_name} = $self->get_edit_tab_widget('full_name')->value();
+ $userData->{username} = $self->get_edit_tab_widget('login_name')->value() ;
+ $userData->{shell} = $self->get_edit_tab_widget('login_shell')->value();
+ $userData->{homedir} = $self->get_edit_tab_widget('homedir')->value();
my $passwd = $self->get_edit_tab_widget('password')->value();
- $userData{password} = $passwd;
+ $userData->{password} = $passwd;
$passwd = $self->get_edit_tab_widget('password1')->value();
- $userData{password1} = $passwd;
+ $userData->{password1} = $passwd;
}
elsif ($previus_tab eq $userEditLabel{account_info}) {
- $userData{acc_check_exp} = $self->get_edit_tab_widget('acc_check_exp')->value();
- $userData{acc_expy} = $self->get_edit_tab_widget('acc_expy')->value();
- $userData{acc_expm} = $self->get_edit_tab_widget('acc_expm')->value();
- $userData{acc_expd} = $self->get_edit_tab_widget('acc_expd')->value();
- $userData{lockuser} = $self->get_edit_tab_widget('lockuser')->value();
- $userData{icon_face} = $self->get_edit_tab_widget('icon_face')->label();
+ $userData->{acc_check_exp} = $self->get_edit_tab_widget('acc_check_exp')->value();
+ $userData->{acc_expy} = $self->get_edit_tab_widget('acc_expy')->value();
+ $userData->{acc_expm} = $self->get_edit_tab_widget('acc_expm')->value();
+ $userData->{acc_expd} = $self->get_edit_tab_widget('acc_expd')->value();
+ $userData->{lockuser} = $self->get_edit_tab_widget('lockuser')->value();
+ $userData->{icon_face} = $self->get_edit_tab_widget('icon_face')->label();
}
elsif ($previus_tab eq $userEditLabel{password_info}) {
- $userData{pwd_check_exp} = $self->get_edit_tab_widget('pwd_check_exp')->value();
- $userData{pwd_exp_min} = $self->get_edit_tab_widget('pwd_exp_min')->value();
- $userData{pwd_exp_max} = $self->get_edit_tab_widget('pwd_exp_max')->value();
- $userData{pwd_exp_warn} = $self->get_edit_tab_widget('pwd_exp_warn')->value();
- $userData{pwd_exp_inact} = $self->get_edit_tab_widget('pwd_exp_inact')->value();
+ $userData->{pwd_check_exp} = $self->get_edit_tab_widget('pwd_check_exp')->value();
+ $userData->{pwd_exp_min} = $self->get_edit_tab_widget('pwd_exp_min')->value();
+ $userData->{pwd_exp_max} = $self->get_edit_tab_widget('pwd_exp_max')->value();
+ $userData->{pwd_exp_warn} = $self->get_edit_tab_widget('pwd_exp_warn')->value();
+ $userData->{pwd_exp_inact} = $self->get_edit_tab_widget('pwd_exp_inact')->value();
}
elsif ($previus_tab eq $userEditLabel{groups}) {
my $tbl = $self->get_edit_tab_widget('members');
- $userData{members} = undef;
+ $userData->{members} = undef;
my @members;
my $i;
for($i=0;$i<$tbl->itemsCount();$i++) {
push (@members, $tbl->item($i)->label()) if $tbl->toCBYTableItem($tbl->item($i))->checked();
}
- $userData{members} = [ @members ];
+ $userData->{members} = [ @members ];

if ($self->get_edit_tab_widget('primary_group')->selectedItem()) {
my $Gent = $self->sh_users->ctx->LookupGroupByName($self->get_edit_tab_widget('primary_group')->selectedItem()->label());
my $primgroup = $Gent->Gid($self->sh_users->USER_GetValue);

- $userData{primary_group} = $primgroup;
+ $userData->{primary_group} = $primgroup;
}
else {
- $userData{primary_group} = -1;
+ $userData->{primary_group} = -1;
}
}

- return %userData;
+ return $userData;
}

#=============================================================
@@ -1470,16 +1469,13 @@ sub _storeDataFromUserEditPreviousTab {
$dialog: YUI dialog that owns the YUI replace point
$replace_pnt: YUI replace point, needed to add a new tab
widget
- %userData: hash containing user data info, tabs are
+ $userData: hash reference containing user data info, tabs are
removed and added again on selection, so
data must be saved outside of widgets.
- $previus_tab: previous tab widget label, needed to store
- user data from the old tab before removing
- it, if user changed something.

=head3 OUTPUT

- %userDataWidget: hash containing new YUI widget objects
+ $userDataWidget: hash containing new YUI widget objects
such as:
returned onject from _buildUserData and
homedir.
@@ -1494,7 +1490,7 @@ sub _storeDataFromUserEditPreviousTab {

#=============================================================
sub _userDataTabWidget {
- my ($self, $dialog, $replace_pnt, %userData) = @_;
+ my ($self, $dialog, $replace_pnt, $userData) = @_;

my $factory = yui::YUI::widgetFactory;

@@ -1502,34 +1498,34 @@ sub _userDataTabWidget {

$replace_pnt->deleteChildren();
my $layout = $factory->createVBox($replace_pnt);
- my %userDataWidget = $self->_buildUserData($layout, $userData{shell});
+ my $userDataWidget = $self->_buildUserData($layout, $userData->{shell});

## user 'login name'
my $align = $factory->createRight($layout);
my $hbox = $factory->createHBox($align);
my $label = $factory->createLabel($hbox, $self->loc->N("Home:") );
$factory->createHSpacing($hbox, 2.0);
- $userDataWidget{homedir} = $factory->createInputField($hbox, "", 0);
+ $userDataWidget->{homedir} = $factory->createInputField($hbox, "", 0);
$label->setWeight($yui::YD_HORIZ, 1);
- $userDataWidget{homedir}->setWeight($yui::YD_HORIZ, 2);
+ $userDataWidget->{homedir}->setWeight($yui::YD_HORIZ, 2);

# fill data into widgets
##
# full_name, login_name, password, password1,
# login_shell
- $userDataWidget{full_name}->setValue($userData{full_name});
- $userDataWidget{login_name}->setValue($userData{username});
+ $userDataWidget->{full_name}->setValue($userData->{full_name});
+ $userDataWidget->{login_name}->setValue($userData->{username});
yui::YUI::ui()->blockEvents();
- $userDataWidget{password}->setValue($userData{password}) if $userData{password};
+ $userDataWidget->{password}->setValue($userData->{password}) if $userData->{password};
yui::YUI::ui()->unblockEvents();
- $userDataWidget{password1}->setValue($userData{password1}) if $userData{password1};
- $userDataWidget{homedir}->setValue($userData{homedir});
+ $userDataWidget->{password1}->setValue($userData->{password1}) if $userData->{password1};
+ $userDataWidget->{homedir}->setValue($userData->{homedir});

$replace_pnt->showChild();
$dialog->recalcLayout();
$dialog->doneMultipleChanges();

- return %userDataWidget;
+ return $userDataWidget;
}


@@ -1596,7 +1592,7 @@ sub _groupDataTabWidget {


sub _userAccountInfoTabWidget {
- my ($self, $dialog, $replace_pnt, %userData) = @_;
+ my ($self, $dialog, $replace_pnt, $userData) = @_;

my $factory = yui::YUI::widgetFactory;

@@ -1610,31 +1606,31 @@ sub _userAccountInfoTabWidget {
my $align = $factory->createRight($userAccountWidget{acc_check_exp});
my $hbox = $factory->createHBox($align);
my $label = $factory->createLabel($hbox, $self->loc->N("Account expires (YYYY-MM-DD):"));
- $userAccountWidget{acc_expy} = $factory->createIntField($hbox, "", 1970, 9999, $userData{acc_expy});
- $userAccountWidget{acc_expm} = $factory->createIntField($hbox, "", 1, 12, $userData{acc_expm});
- $userAccountWidget{acc_expd} = $factory->createIntField($hbox, "", 1, 31, $userData{acc_expd});
- $userAccountWidget{acc_check_exp}->setValue($userData{acc_check_exp});
+ $userAccountWidget{acc_expy} = $factory->createIntField($hbox, "", 1970, 9999, $userData->{acc_expy});
+ $userAccountWidget{acc_expm} = $factory->createIntField($hbox, "", 1, 12, $userData->{acc_expm});
+ $userAccountWidget{acc_expd} = $factory->createIntField($hbox, "", 1, 31, $userData->{acc_expd});
+ $userAccountWidget{acc_check_exp}->setValue($userData->{acc_check_exp});
$label->setWeight($yui::YD_HORIZ, 2);
$align = $factory->createLeft($layout);
- $userAccountWidget{lockuser} = $factory->createCheckBox($align, $self->loc->N("Lock User Account"), $userData{lockuser});
+ $userAccountWidget{lockuser} = $factory->createCheckBox($align, $self->loc->N("Lock User Account"), $userData->{lockuser});

$align = $factory->createLeft($layout);
$hbox = $factory->createHBox($align);
$label = $factory->createLabel($hbox, $self->loc->N("Click on the icon to change it"));
$userAccountWidget{icon_face} = $factory->createPushButton($hbox, "");
- $userAccountWidget{icon_face}->setIcon($self->sh_users->face2png($userData{icon_face}));
- $userAccountWidget{icon_face}->setLabel($userData{icon_face});
+ $userAccountWidget{icon_face}->setIcon($self->sh_users->face2png($userData->{icon_face}));
+ $userAccountWidget{icon_face}->setLabel($userData->{icon_face});

$replace_pnt->showChild();
$dialog->recalcLayout();
$dialog->doneMultipleChanges();

- return %userAccountWidget;
+ return \%userAccountWidget;
}


sub _userPasswordInfoTabWidget {
- my ($self, $dialog, $replace_pnt, %userData) = @_;
+ my ($self, $dialog, $replace_pnt, $userData) = @_;

my $factory = yui::YUI::widgetFactory;

@@ -1644,7 +1640,7 @@ sub _userPasswordInfoTabWidget {
my $layout = $factory->createVBox($replace_pnt);

my %userPasswordWidget;
- my $userEnt = $self->sh_users->ctx->LookupUserByName($userData{username});
+ my $userEnt = $self->sh_users->ctx->LookupUserByName($userData->{username});
my $lastchg = $userEnt->ShadowLastChange($self->sh_users->USER_GetValue);

my $align = $factory->createLeft($layout);
@@ -1668,7 +1664,7 @@ sub _userPasswordInfoTabWidget {
$hbox = $factory->createHBox($align);
$label = $factory->createLabel($hbox, $self->loc->N("Days before change allowed:"));
$userPasswordWidget{pwd_exp_min} = $factory->createInputField($hbox, "", 0);
- $userPasswordWidget{pwd_exp_min}->setValue("$userData{pwd_exp_min}");
+ $userPasswordWidget{pwd_exp_min}->setValue("$userData->{pwd_exp_min}");
$label->setWeight($yui::YD_HORIZ, 1);
$userPasswordWidget{pwd_exp_min}->setWeight($yui::YD_HORIZ, 2);

@@ -1676,7 +1672,7 @@ sub _userPasswordInfoTabWidget {
$hbox = $factory->createHBox($align);
$label = $factory->createLabel($hbox, $self->loc->N("Days before change required:"));
$userPasswordWidget{pwd_exp_max} = $factory->createInputField($hbox, "", 0);
- $userPasswordWidget{pwd_exp_max}->setValue("$userData{pwd_exp_max}");
+ $userPasswordWidget{pwd_exp_max}->setValue("$userData->{pwd_exp_max}");
$label->setWeight($yui::YD_HORIZ, 1);
$userPasswordWidget{pwd_exp_max}->setWeight($yui::YD_HORIZ, 2);

@@ -1684,7 +1680,7 @@ sub _userPasswordInfoTabWidget {
$hbox = $factory->createHBox($align);
$label = $factory->createLabel($hbox, $self->loc->N("Days warning before change:"));
$userPasswordWidget{pwd_exp_warn} = $factory->createInputField($hbox, "", 0);
- $userPasswordWidget{pwd_exp_warn}->setValue("$userData{pwd_exp_warn}");
+ $userPasswordWidget{pwd_exp_warn}->setValue("$userData->{pwd_exp_warn}");
$label->setWeight($yui::YD_HORIZ, 1);
$userPasswordWidget{pwd_exp_warn}->setWeight($yui::YD_HORIZ, 2);

@@ -1692,17 +1688,17 @@ sub _userPasswordInfoTabWidget {
$hbox = $factory->createHBox($align);
$label = $factory->createLabel($hbox, $self->loc->N("Days before account inactive:"));
$userPasswordWidget{pwd_exp_inact} = $factory->createInputField($hbox, "", 0);
- $userPasswordWidget{pwd_exp_inact}->setValue("$userData{pwd_exp_inact}");
+ $userPasswordWidget{pwd_exp_inact}->setValue("$userData->{pwd_exp_inact}");
$label->setWeight($yui::YD_HORIZ, 1);
$userPasswordWidget{pwd_exp_inact}->setWeight($yui::YD_HORIZ, 2);

- $userPasswordWidget{pwd_check_exp}->setValue($userData{pwd_check_exp});
+ $userPasswordWidget{pwd_check_exp}->setValue($userData->{pwd_check_exp});

$replace_pnt->showChild();
$dialog->recalcLayout();
$dialog->doneMultipleChanges();

- return %userPasswordWidget;
+ return \%userPasswordWidget;
}

sub _groupUsersTabWidget {
@@ -1750,7 +1746,7 @@ sub _groupUsersTabWidget {
}

sub _userGroupsTabWidget {
- my ($self, $dialog, $replace_pnt, %userData) = @_;
+ my ($self, $dialog, $replace_pnt, $userData) = @_;

my $factory = yui::YUI::widgetFactory;
my $mageiaPlugin = "mga";
@@ -1762,7 +1758,7 @@ sub _userGroupsTabWidget {
$replace_pnt->deleteChildren();

my %userGroupsWidget;
- my $userEnt = $self->sh_users->ctx->LookupUserByName($userData{username});
+ my $userEnt = $self->sh_users->ctx->LookupUserByName($userData->{username});
my $lastchg = $userEnt->ShadowLastChange($self->sh_users->USER_GetValue);

my $layout = _labeledFrameBox($replace_pnt, $self->loc->N("Select groups that the user will be member of:"));
@@ -1777,7 +1773,7 @@ sub _userGroupsTabWidget {
my @sgroups = sort @$grps;

my $itemCollection = new yui::YItemCollection;
- my $members = $userData{members};
+ my $members = $userData->{members};
foreach my $group (@sgroups) {
my $item = new yui::YCBTableItem($group);
$item->check(MDK::Common::DataStructure::member($group, @$members));
@@ -1788,8 +1784,8 @@ sub _userGroupsTabWidget {
$userGroupsWidget{members}->addItems($itemCollection);
$userGroupsWidget{members}->setNotify(1);
my $primgroup = '';
- if ($userData{primary_group} != -1) {
- my $Gent = $self->sh_users->ctx->LookupGroupById($userData{primary_group});
+ if ($userData->{primary_group} != -1) {
+ my $Gent = $self->sh_users->ctx->LookupGroupById($userData->{primary_group});
$primgroup = $Gent->GroupName($self->sh_users->USER_GetValue);
}

@@ -1812,7 +1808,7 @@ sub _userGroupsTabWidget {
$dialog->recalcLayout();
$dialog->doneMultipleChanges();

- return %userGroupsWidget;
+ return \%userGroupsWidget;
}

sub _groupEdit_Ok {
@@ -1869,46 +1865,46 @@ sub _groupEdit_Ok {
}

sub _userEdit_Ok {
- my ($self, %userData) = @_;
+ my ($self, $userData) = @_;

# update last changes if any
- %userData = $self->_storeDataFromUserEditPreviousTab(%userData);
+ $self->_storeDataFromUserEditPreviousTab($userData);

- my ($continue, $errorString) = $self->sh_users->valid_username($userData{username});
+ my ($continue, $errorString) = $self->sh_users->valid_username($userData->{username});
if (!$continue) {
$self->sh_gui->msgBox({text => $errorString}) if ($errorString);
return $continue;
}

- if ( $userData{password} ne $userData{password1}) {
+ if ( $userData->{password} ne $userData->{password1}) {
$self->sh_gui->msgBox({text => $self->loc->N("Password Mismatch")});
return 0;
}
- my $userEnt = $self->sh_users->ctx->LookupUserByName($userData{username});
- if ($userData{password} ne '') {
- if ($self->sh_users->weakPasswordForSecurityLevel($userData{password})) {
+ my $userEnt = $self->sh_users->ctx->LookupUserByName($userData->{username});
+ if ($userData->{password} ne '') {
+ if ($self->sh_users->weakPasswordForSecurityLevel($userData->{password})) {
$self->sh_gui->msgBox({text => $self->loc->N("This password is too simple. \n Good passwords should be > 6 characters")});
return 0;
}
- $self->sh_users->ctx->UserSetPass($userEnt, $userData{password});
+ $self->sh_users->ctx->UserSetPass($userEnt, $userData->{password});
}

- $userEnt->UserName($userData{username});
- $userEnt->Gecos($userData{full_name});
- $userEnt->HomeDir($userData{homedir});
- $userEnt->LoginShell($userData{shell});
+ $userEnt->UserName($userData->{username});
+ $userEnt->Gecos($userData->{full_name});
+ $userEnt->HomeDir($userData->{homedir});
+ $userEnt->LoginShell($userData->{shell});
my $username = $userEnt->UserName($self->sh_users->USER_GetValue);
my $grps = $self->sh_users->ctx->GroupsEnumerate;
my @sgroups = sort @$grps;

- my $members = $userData{members};
+ my $members = $userData->{members};
foreach my $group (@sgroups) {

my $gEnt = $self->sh_users->ctx->LookupGroupByName($group);
my $ugid = $gEnt->Gid($self->sh_users->USER_GetValue);
my $m = $gEnt->MemberName(1,0);
if (MDK::Common::DataStructure::member($group, @$members)) {
- if (!AdminPanel::Shared::inArray($username, $m) && $userData{primary_group} != $ugid) {
+ if (!AdminPanel::Shared::inArray($username, $m) && $userData->{primary_group} != $ugid) {
eval { $gEnt->MemberName($username, 1) };
$self->sh_users->ctx->GroupModify($gEnt);
}
@@ -1920,16 +1916,16 @@ sub _userEdit_Ok {
}
}
}
- if ($userData{primary_group} == -1) {
+ if ($userData->{primary_group} == -1) {
$self->sh_gui->msgBox({ text => $self->loc->N("Please select at least one group for the user")});
return 0;
}
- $userEnt->Gid($userData{primary_group});
+ $userEnt->Gid($userData->{primary_group});

- if ($userData{acc_check_exp}) {
- my $yr = $userData{acc_expy};
- my $mo = $userData{acc_expm};
- my $dy = $userData{acc_expd};
+ if ($userData->{acc_check_exp}) {
+ my $yr = $userData->{acc_expy};
+ my $mo = $userData->{acc_expm};
+ my $dy = $userData->{acc_expd};
if (!_ValidInt($yr, $dy, $mo)) {
$self->sh_gui->msgBox({text => $self->loc->N("Please specify Year, Month and Day \n for Account Expiration ")});
return 0;
@@ -1941,11 +1937,11 @@ sub _userEdit_Ok {
$userEnt->ShadowExpire(ceil(-1))
}

- if ($userData{pwd_check_exp}) {
- my $allowed = int($userData{pwd_exp_min});
- my $required = int($userData{pwd_exp_max});
- my $warning = int($userData{pwd_exp_warn});
- my $inactive = int($userData{pwd_exp_inact});
+ if ($userData->{pwd_check_exp}) {
+ my $allowed = int($userData->{pwd_exp_min});
+ my $required = int($userData->{pwd_exp_max});
+ my $warning = int($userData->{pwd_exp_warn});
+ my $inactive = int($userData->{pwd_exp_inact});
if ($allowed && $required && $warning && $inactive) {
$userEnt->ShadowMin($allowed);
$userEnt->ShadowMax($required);
@@ -1966,14 +1962,14 @@ sub _userEdit_Ok {

$self->sh_users->ctx->UserModify($userEnt);

- if ($userData{lockuser}) {
+ if ($userData->{lockuser}) {
!$self->sh_users->ctx->IsLocked($userEnt) and $self->sh_users->ctx->Lock($userEnt);
}
else {
$self->sh_users->ctx->IsLocked($userEnt) and $self->sh_users->ctx->UnLock($userEnt);
}

- defined $userData{icon_face} and $self->sh_users->addKdmIcon($userData{username}, $userData{icon_face});
+ defined $userData->{icon_face} and $self->sh_users->addKdmIcon($userData->{username}, $userData->{icon_face});
$self->_refresh();

return 1;
@@ -2048,11 +2044,11 @@ sub _editUserDialog {
my $cancelButton = $factory->createPushButton($align, $self->loc->N("Cancel"));
my $okButton = $factory->createPushButton($hbox, $self->loc->N("Ok"));

- my %userData = $self->_getUserInfo();
+ my $userData = $self->_getUserInfo();
# userData here should be tested because it could be undef

# Useful entry point for the current edit user/group tab widget
- $self->set_edit_tab_widget( $self->_userDataTabWidget($dlg, $tabs{replace_pnt}, %userData) );
+ $self->set_edit_tab_widget( %{$self->_userDataTabWidget($dlg, $tabs{replace_pnt}, $userData)} );
$self->set_edit_tab_widget( edit_tab_label => $userEditLabel{user_data});

while(1) {
@@ -2067,31 +2063,31 @@ sub _editUserDialog {
### MENU ###
my $item = $event->item();
if ($item->label() eq $tabs{user_data}->label()) {
- %userData = $self->_storeDataFromUserEditPreviousTab(%userData);
- my %edit_tab = $self->_userDataTabWidget($dlg, $tabs{replace_pnt}, %userData );
+ $self->_storeDataFromUserEditPreviousTab($userData);
+ my $edit_tab = $self->_userDataTabWidget($dlg, $tabs{replace_pnt}, $userData );
$self->edit_tab_widgets( {} );
- $self->set_edit_tab_widget(%edit_tab);
+ $self->set_edit_tab_widget(%{$edit_tab});
$self->set_edit_tab_widget( edit_tab_label => $userEditLabel{user_data});
}
elsif ($item->label() eq $tabs{account_info}->label()) {
- %userData = $self->_storeDataFromUserEditPreviousTab(%userData);
- my %edit_tab = $self->_userAccountInfoTabWidget($dlg, $tabs{replace_pnt}, %userData );
+ $self->_storeDataFromUserEditPreviousTab($userData);
+ my $edit_tab = $self->_userAccountInfoTabWidget($dlg, $tabs{replace_pnt}, $userData );
$self->edit_tab_widgets( {} );
- $self->set_edit_tab_widget(%edit_tab);
+ $self->set_edit_tab_widget(%{$edit_tab});
$self->set_edit_tab_widget( edit_tab_label => $userEditLabel{account_info});
}
elsif ($item->label() eq $tabs{password_info}->label()) {
- %userData = $self->_storeDataFromUserEditPreviousTab(%userData);
- my %edit_tab = $self->_userPasswordInfoTabWidget($dlg, $tabs{replace_pnt}, %userData );
+ $self->_storeDataFromUserEditPreviousTab($userData);
+ my $edit_tab = $self->_userPasswordInfoTabWidget($dlg, $tabs{replace_pnt}, $userData );
$self->edit_tab_widgets( {} );
- $self->set_edit_tab_widget(%edit_tab);
+ $self->set_edit_tab_widget(%{$edit_tab});
$self->set_edit_tab_widget( edit_tab_label => $userEditLabel{password_info});
}
elsif ($item->label() eq $tabs{groups}->label()) {
- %userData = $self->_storeDataFromUserEditPreviousTab(%userData);
- my %edit_tab = $self->_userGroupsTabWidget($dlg, $tabs{replace_pnt}, %userData );
+ $self->_storeDataFromUserEditPreviousTab($userData);
+ my $edit_tab = $self->_userGroupsTabWidget($dlg, $tabs{replace_pnt}, $userData );
$self->edit_tab_widgets( {} );
- $self->set_edit_tab_widget(%edit_tab);
+ $self->set_edit_tab_widget(%{$edit_tab});
$self->set_edit_tab_widget( edit_tab_label => $userEditLabel{groups});
}
}
@@ -2107,7 +2103,7 @@ sub _editUserDialog {
}
elsif ($widget == $okButton) {
## save changes
- if ($self->_userEdit_Ok(%userData)) {
+ if ($self->_userEdit_Ok($userData)) {
last;
}
}
@@ -2139,7 +2135,7 @@ sub _editUserDialog {
for(my $i=0;$i < $tbl->itemsCount();$i++) {
if ($tbl->toCBYTableItem($tbl->item($i))->checked()) {
my $pgItem = new yui::YItem ($tbl->item($i)->label(), 0);
- my $Gent = $self->sh_users->ctx->LookupGroupById($userData{primary_group});
+ my $Gent = $self->sh_users->ctx->LookupGroupById($userData->{primary_group});
my $primgroup = $Gent->GroupName($self->sh_users->USER_GetValue);
$pgItem->setSelected(1) if ($pgItem->label() eq $primgroup);
--
Mageia Git Monkeys.
Loading...