aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2014-10-12 00:22:53 +0200
committerAngelo Naselli <anaselli@linux.it>2014-10-12 00:22:53 +0200
commita905043d0897d3b47729d3a6eccf794d542a45aa (patch)
treec2898b8eddfffaf420000d78e8c141e7315d2d11
parent6e6caf186efc7e0be848fd542211313871b73e5e (diff)
downloadmanatools-a905043d0897d3b47729d3a6eccf794d542a45aa.tar
manatools-a905043d0897d3b47729d3a6eccf794d542a45aa.tar.gz
manatools-a905043d0897d3b47729d3a6eccf794d542a45aa.tar.bz2
manatools-a905043d0897d3b47729d3a6eccf794d542a45aa.tar.xz
manatools-a905043d0897d3b47729d3a6eccf794d542a45aa.zip
Added group name by ID into Shared
-rw-r--r--lib/AdminPanel/Module/Users.pm8
-rw-r--r--lib/AdminPanel/Shared/Users.pm31
2 files changed, 35 insertions, 4 deletions
diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm
index 217d46ee..5335f0ae 100644
--- a/lib/AdminPanel/Module/Users.pm
+++ b/lib/AdminPanel/Module/Users.pm
@@ -1756,8 +1756,8 @@ sub _userGroupsTabWidget {
$replace_pnt->deleteChildren();
my %userGroupsWidget;
- 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 $layout = _labeledFrameBox($replace_pnt, $self->loc->N("Select groups that the user will be member of:"));
@@ -1783,8 +1783,8 @@ sub _userGroupsTabWidget {
$userGroupsWidget{members}->setNotify(1);
my $primgroup = '';
if ($userData->{primary_group} != -1) {
- my $Gent = $self->sh_users->ctx->LookupGroupById($userData->{primary_group});
- $primgroup = $Gent->GroupName($self->sh_users->USER_GetValue);
+ $DB::single = 1;
+ $primgroup = $self->sh_users->groupName($userData->{primary_group});
}
my $align = $factory->createLeft($layout);
diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm
index 237fee98..9839f8bd 100644
--- a/lib/AdminPanel/Shared/Users.pm
+++ b/lib/AdminPanel/Shared/Users.pm
@@ -573,6 +573,37 @@ sub groupID {
return undef;
}
+
+#=============================================================
+
+=head2 groupName
+
+=head3 INPUT
+
+$gid grou identifier
+
+=head3 OUTPUT
+
+group name or undef
+
+=head3 DESCRIPTION
+
+This method returns the group name for the given group
+identifier
+
+=cut
+
+#=============================================================
+sub groupName {
+ my ($self, $gid) = @_;
+
+ my $gr = $self->ctx->LookupGroupById($gid);
+ return $gr->GroupName($self->USER_GetValue) if ($gr);
+
+ return undef;
+}
+
+
#=============================================================
=head2 addGroup