3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 %# (Except where explictly superceded by other copyright notices)
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 %# General Public License for more details.
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
24 <& /Elements/Header, Title => loc("Delegate rights") &>
25 <& /User/Elements/Tabs,
26 current_tab => 'User/Delegation.html',
27 Title => loc("Delegate rights") &>
29 <& /Elements/ListActions, actions => \@results &>
32 <& Elements/DelegateRights, personalgroups => $personalgroups, objects => $objects, ObjectType => 'RT::System' &>
33 <& Elements/DelegateRights, personalgroups => $personalgroups, objects => $objects, ObjectType => 'RT::Queue' &>
34 <& Elements/DelegateRights, personalgroups => $personalgroups, objects => $objects, ObjectType => 'RT::Group' &>
36 <& /Elements/Submit, Label => loc('Modify Rights') &>
41 foreach $arg (keys %ARGS) {
42 next unless ($arg =~ /^Delegate-Existing-ACE-(\d+)-to-(\d+)-as-(\d+)$/);
46 unless ($ARGS{"Delegate-ACE-$1-to-$2"}) {
47 my $ace_to_del = RT::ACE->new($session{'CurrentUser'});
48 $ace_to_del->Load($delegation);
49 my ($delval, $delmsg) = $ace_to_del->Delete();
50 push (@results, $delmsg);
54 foreach $arg (keys %ARGS) {
55 next unless ($arg =~ /^Delegate-ACE-(\d+)-to-(\d+)$/);
58 # if we already delegate it, we just don't care
59 next if (grep /^Delegate-Existing-ACE-$parent-to-$principal-/, keys %ARGS);
60 my $ace = RT::ACE->new($session{'CurrentUser'});
63 push (@results, loc('Right not found'));
66 my ($delid, $delmsg) = $ace->Delegate(PrincipalId => $principal);
67 push (@results, $delmsg);
70 my $personalgroups = RT::Groups->new($session{'CurrentUser'});
71 $personalgroups->LimitToPersonalGroupsFor($session{'CurrentUser'}->PrincipalId);
74 my $acl = RT::ACL->new ($session{'CurrentUser'});
75 $acl->ExcludeDelegatedRights();
76 $acl->LimitToPrincipal(Id => $session{'CurrentUser'}->PrincipalId,
77 IncludeGroupMembership => 1
80 while(my $right = $acl->Next) {
81 push @{$objects->{$right->ObjectType}{$right->ObjectId}},$right;