This commit was generated by cvs2svn to compensate for changes in r2526,
[freeside.git] / rt / webrt / Admin / Elements / SelectRights
1 <INPUT TYPE=HIDDEN NAME="CheckACL"  VALUE="<%$ACLDesc%>">
2      <TABLE BORDER=0>
3 <TR>
4 <TD valign=top>
5 <h3>New rights</h3> 
6 <SELECT SIZE=5  MULTIPLE  NAME="GrantACE-<%$ACLDesc%>">
7 % foreach $right (sort keys %Rights) {
8       <OPTION VALUE="<%$right%>"  
9         ><%$right%></OPTION>
10 % }
11 <OPTION VALUE="" SELECTED>(no value)</OPTION>
12 </SELECT>
13 </TD>
14 <TD valign=top> 
15 <h3>Current rights</h3>
16 <i>(Check box to revoke right)</i> <BR>
17 % while (my $right = $ACLObj->Next()) {
18 % if ($right->RightName) {
19 <input type=checkbox value="<%$right->Id%>" name="RevokeACE"> <%$right->RightName%><br>
20 % }
21 %  }
22 </TD>
23 </TR>
24 </TABLE>
25 <%INIT>
26     my ($right, $ACLDesc, $AppliesTo, %Rights);
27    
28        
29     my $ACLObj = new RT::ACL($session{'CurrentUser'});
30     my $ACE = new RT::ACE($session{'CurrentUser'});
31
32     if ($Scope eq 'Queue') { 
33         $AppliesTo = $QueueObj->Id;
34         $ACLObj->LimitToQueue($AppliesTo);
35         %Rights = $ACE->QueueRights();
36     } 
37     elsif ($Scope eq 'System') {
38         $AppliesTo = 0;
39         $ACLObj->LimitToSystem();
40         %Rights =  ( $ACE->SystemRights , $ACE->QueueRights());
41     }
42
43     if ($PrincipalType eq 'Group') {
44         $ACLObj->LimitPrincipalToGroup($PrincipalObj->Id);
45     } 
46     elsif ($PrincipalType eq 'User') {
47         $ACLObj->LimitPrincipalToUser($PrincipalObj->Id);
48     } 
49     
50     $ACLDesc = "$PrincipalType-".$PrincipalObj->Id."-$Scope-$AppliesTo";
51 </%INIT>
52     
53 <%ARGS>
54 $PrincipalType => undef
55 $PrincipalObj => undef
56 $Scope => undef
57 $QueueObj => undef
58 </%ARGS>