X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fadmin_groups.pl;h=d84e2e5413e814127a123090f13d3e0fd5b27a93;hb=7f8cada2276e50879226ea553006ca7c714fac6a;hp=35ecc8c08349441360f98ef276761bd8027b7cdf;hpb=8c7e44938a661e035f62840e1e177353240ace5d;p=kivitendo-erp.git diff --git a/bin/mozilla/admin_groups.pl b/bin/mozilla/admin_groups.pl index 35ecc8c08..d84e2e541 100644 --- a/bin/mozilla/admin_groups.pl +++ b/bin/mozilla/admin_groups.pl @@ -1,3 +1,39 @@ +#===================================================================== +# LX-Office ERP +# Copyright (C) 2004 +# Based on SQL-Ledger Version 2.1.9 +# Web http://www.lx-office.org +# +#===================================================================== +# SQL-Ledger Accounting +# Copyright (c) 2002 +# +# Author: Moritz Bunkus +# Email: mbunkus@linet-services.de +# Web: www.linet-services.de +# +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#====================================================================== +# +# group administration module +# add/edit/delete user groups +# +#====================================================================== + +use List::MoreUtils qw(uniq); + sub edit_groups { $lxdebug->enter_sub(); @@ -80,9 +116,9 @@ sub edit_group { my %all_users = $auth->read_all_users(); my %users_by_id = map { $_->{id} => $_ } values %all_users; - my @members = sort { lc $a->{login} cmp lc $b->{login} } @users_by_id{ @{ $group->{members} } }; + my @members = uniq sort { lc $a->{login} cmp lc $b->{login} } @users_by_id{ @{ $group->{members} } }; - my %grouped = map { $_ => 1 } @{ $group->{members} }; + my %grouped = map { $_ => 1 } uniq @{ $group->{members} }; my @non_members = sort { lc $a->{login} cmp lc $b->{login} } grep { !$grouped{$_->{id}} } values %all_users; my @rights = map { @@ -139,7 +175,7 @@ sub add_to_group { } $group = $groups->{$form->{group_id}}; - push @{ $group->{members} }, $form->{user_id_not_in_group}; + $group->{members} = [ uniq @{ $group->{members} }, $form->{user_id_not_in_group} ]; $auth->save_group($group); @@ -161,7 +197,7 @@ sub remove_from_group { } $group = $groups->{$form->{group_id}}; - $group->{members} = [ grep { $_ ne $form->{user_id_in_group} } @{ $group->{members} } ]; + $group->{members} = [ uniq grep { $_ ne $form->{user_id_in_group} } @{ $group->{members} } ]; $auth->save_group($group);