diff options
author | Angelo Naselli <anaselli@linux.it> | 2014-10-12 15:57:47 +0200 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2014-10-12 15:57:47 +0200 |
commit | 87b62edabda2799dcb324b8f6a91e31fd70f7e3e (patch) | |
tree | 520aad307fb9ce7a8cd32966a7ea9bf19fe84ee2 /lib/AdminPanel/Module | |
parent | 9fcb30e55a7f191fbe0c25e16d24547da94a1af3 (diff) | |
download | manatools-87b62edabda2799dcb324b8f6a91e31fd70f7e3e.tar manatools-87b62edabda2799dcb324b8f6a91e31fd70f7e3e.tar.gz manatools-87b62edabda2799dcb324b8f6a91e31fd70f7e3e.tar.bz2 manatools-87b62edabda2799dcb324b8f6a91e31fd70f7e3e.tar.xz manatools-87b62edabda2799dcb324b8f6a91e31fd70f7e3e.zip |
moved modifyGroup to Shared::Users and changed Module::Users accordingly
Diffstat (limited to 'lib/AdminPanel/Module')
-rw-r--r-- | lib/AdminPanel/Module/Users.pm | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm index c7913d19..4d735a29 100644 --- a/lib/AdminPanel/Module/Users.pm +++ b/lib/AdminPanel/Module/Users.pm @@ -1820,43 +1820,23 @@ sub _groupEdit_Ok { $self->sh_gui->msgBox({text => $errorString}) if ($errorString); return $continue; } - my $groupEnt = $self->sh_users->ctx->LookupGroupByName($groupData{start_groupname}); + $DB::single = 1; + + my $groupInfo = { + groupname => $groupData{groupname}, + members => $groupData{members}, + }; + if ($groupData{start_groupname} ne $groupData{groupname}) { - $groupEnt->GroupName($groupData{groupname}); + $groupInfo->{old_groupname} = $groupData{start_groupname}; } - my $members = $groupData{members}; - my $gid = $groupEnt->Gid($self->sh_users->USER_GetValue); - my $users = $self->sh_users->getUsers(); - my @susers = sort(@$users); + my $retval = $self->sh_users->modifyGroup($groupInfo); - foreach my $user (@susers) { - my $uEnt = $self->sh_users->ctx->LookupGroupByName($user); - if ($uEnt) { - my $ugid = $uEnt->Gid($self->sh_users->USER_GetValue); - my $m = $self->sh_users->ctx->EnumerateUsersByGroup($groupData{start_groupname}); - if (MDK::Common::DataStructure::member($user, @$members)) { - if (!AdminPanel::Shared::inArray($user, $m)) { - if ($ugid != $gid) { - eval { $groupEnt->MemberName($user,1) }; - } - } - } - else { - if (AdminPanel::Shared::inArray($user, $m)) { - if ($ugid == $gid) { - $self->sh_gui->msgBox({text => $self->loc->N("You cannot remove user '%s' from their primary group", $user)}); - return 0; - } - else { - eval { $groupEnt->MemberName($user,2) }; - } - } - } - } - } + if (!$retval->{status}) { + $self->sh_gui->msgBox({text => $retval->{error}} ); + } - $self->sh_users->ctx->GroupModify($groupEnt); $self->_refresh(); return 1; |