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 <INPUT TYPE=HIDDEN NAME="CheckACL" VALUE="<%$ACLDesc%>">
27 <TD valign=top width="180" align="left">
28 <h3><&|/l&>Current rights</&></h3>
29 % if ($ACLObj->Count() > 0) {
30 <i>(<&|/l&>Check box to revoke right</&>)</i> <BR>
32 <i><&|/l&>No rights granted.</&></i> <BR>
34 % while (my $right = $ACLObj->Next()) {
35 % if ($right->RightName) {
36 <input type=checkbox value="<%$right->Id%>" name="RevokeRight-<%$ACLDesc%>-<%$right->RightName%>"> <% loc($right->RightName) %><br>
41 <h3><&|/l&>New rights</&></h3>
42 <SELECT SIZE=5 MULTIPLE NAME="GrantRight-<%$ACLDesc%>">
43 % foreach $right (sort keys %Rights) {
44 <OPTION VALUE="<%$right%>"
45 ><% loc($right) %></OPTION>
47 <OPTION VALUE="" SELECTED><&|/l&>(no value)</&></OPTION>
53 my ($right, $ACLDesc, $AppliesTo, %Rights);
55 # if the principal id points to a user, we really want to point
56 # to their ACL equivalence group. The machinations we're going through
57 # lead me to start to suspect that we really want users and groups
58 # to just be the same table. or _maybe_ that we want an object db.
59 my $princ = RT::Principal->new($RT::SystemUser);
60 $princ->Load($PrincipalId);
61 if ($princ->PrincipalType eq 'User') {
62 my $group = RT::Group->new($RT::SystemUser);
63 $group->LoadACLEquivalenceGroup($princ);
64 $PrincipalId = $group->PrincipalId;
68 my $ACLObj = new RT::ACL($session{'CurrentUser'});
69 my $ACE = new RT::ACE($session{'CurrentUser'});
72 $ACLObj->LimitToObject( $Object);
73 $ACLObj->LimitToPrincipal( Id => $PrincipalId);
74 $ACLObj->OrderBy(FIELD=>'RightName');
76 if (ref($Object) && UNIVERSAL::can($Object, 'AvailableRights')) {
77 %Rights = %{$Object->AvailableRights};
81 %Rights = { loc('System Error') => loc("No rights found")};
84 $ACLDesc = "$PrincipalId-".ref($Object)."-".$Object->Id;
88 $PrincipalType => undef