summaryrefslogtreecommitdiff
path: root/rt/webrt/Admin/Elements/SelectRights
blob: 0ac774985dfe26728715bd1998fa160369f9a138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<INPUT TYPE=HIDDEN NAME="CheckACL"  VALUE="<%$ACLDesc%>">
     <TABLE BORDER=0>
<TR>
<TD valign=top>
<h3>New rights</h3> 
<SELECT SIZE=5  MULTIPLE  NAME="GrantACE-<%$ACLDesc%>">
% foreach $right (sort keys %Rights) {
      <OPTION VALUE="<%$right%>"  
	><%$right%></OPTION>
% }
<OPTION VALUE="" SELECTED>(no value)</OPTION>
</SELECT>
</TD>
<TD valign=top> 
<h3>Current rights</h3>
<i>(Check box to revoke right)</i> <BR>
% while (my $right = $ACLObj->Next()) {
% if ($right->RightName) {
<input type=checkbox value="<%$right->Id%>" name="RevokeACE"> <%$right->RightName%><br>
% }
%  }
</TD>
</TR>
</TABLE>
<%INIT>
    my ($right, $ACLDesc, $AppliesTo, %Rights);
   
       
    my $ACLObj = new RT::ACL($session{'CurrentUser'});
    my $ACE = new RT::ACE($session{'CurrentUser'});

    if ($Scope eq 'Queue') { 
        $AppliesTo = $QueueObj->Id;
        $ACLObj->LimitToQueue($AppliesTo);
        %Rights = $ACE->QueueRights();
    } 
    elsif ($Scope eq 'System') {
        $AppliesTo = 0;
        $ACLObj->LimitToSystem();
        %Rights =  ( $ACE->SystemRights , $ACE->QueueRights());
    }

    if ($PrincipalType eq 'Group') {
        $ACLObj->LimitPrincipalToGroup($PrincipalObj->Id);
    } 
    elsif ($PrincipalType eq 'User') {
        $ACLObj->LimitPrincipalToUser($PrincipalObj->Id);
    } 
    
    $ACLDesc = "$PrincipalType-".$PrincipalObj->Id."-$Scope-$AppliesTo";
</%INIT>
    
<%ARGS>
$PrincipalType => undef
$PrincipalObj => undef
$Scope => undef
$QueueObj => undef
</%ARGS>