import of rt 3.0.4
[freeside.git] / rt / html / User / Elements / DelegateRights
1 %# BEGIN LICENSE BLOCK
2 %# 
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
4 %# 
5 %# (Except where explictly superceded by other copyright notices)
6 %# 
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
10 %# from www.gnu.org.
11 %# 
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.
16 %# 
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.
21 %# 
22 %# 
23 %# END LICENSE BLOCK
24 <h2><%$sectionheading%></h2>
25 <%perl>
26
27 foreach my $object (keys %{$objects->{$ObjectType}}) {
28 unless ($ObjectType eq 'RT::System') {
29 my $object_obj = @{$objects->{$ObjectType}{$object}}[0]->Object;
30
31 </%perl>
32 <h3><% $object_obj->Name %></h3>
33 % }
34 <table width="100%" border="0" cellspacing="0" cellpadding="3">
35 <tr>
36         <th width=15%><&|/l&>Personal groups:</&></th>
37 % while (my $pg = $personalgroups->Next) {
38 <th><%$pg->Name%></th>
39 % }
40 </tr>
41 <%perl>
42 my $i;
43 foreach my $right (@{$objects->{$ObjectType}{$object}}) {
44 my $delegations = RT::ACL->new($session{'CurrentUser'});
45 $delegations->DelegatedBy( Id => $session{'CurrentUser'}->PrincipalId);
46 $delegations->DelegatedFrom ( Id => $right->Id);
47
48 my $del_hash = {};
49 while ( my $delegation = $delegations->Next) {
50         $del_hash->{$delegation->PrincipalId} = $delegation;
51 }
52 </%perl>
53 % $i++;
54 %
55 <tr class="<%($i%2) && 'oddline'%>">
56 <td>
57 <% loc($right->RightName) %><br>
58 <div align=right><font size="-2" color="#999999"><&|/l, $right->PrincipalObj->Object->SelfDescription &>as granted to [_1]</&></font></div>
59        </td>
60 % while (my $pg = $personalgroups->Next) {
61 <td align=center>
62         <input name="Delegate-ACE-<% $right->Id %>-to-<% $pg->PrincipalId%>" type=checkbox <%$ del_hash->{$pg->PrincipalId} && 'CHECKED' %>>
63 % if ( $del_hash->{$pg->PrincipalId}) {
64 <input type=hidden name="Delegate-Existing-ACE-<% $right->Id %>-to-<% $pg->PrincipalId%>-as-<%$del_hash->{$pg->PrincipalId}->Id%>">
65 % }
66 </td>
67 % }
68 <td>&nbsp;</td>
69 </tr>
70 %}
71 </table> 
72 % }
73 <%init>
74
75 my $sectionheading = loc("[_1] rights", loc($ObjectType =~ /^RT::(.*)$/));
76 # 'System' # loc
77 # 'Group'  # loc
78 # 'Queue'  # loc
79
80 </%init>
81 <%args>
82 $ObjectType => undef
83 $objects => undef
84 $personalgroups => undef
85 </%args>