<& /Admin/Elements/Header, Title => 'Modify group rights for queue '. $QueueObj->Name &>
<& /Admin/Elements/QueueTabs, id => $id &>  
<& /Elements/ListActions, actions => \@results &>

  <FORM METHOD=POST ACTION="GroupRights.html">
    <INPUT TYPE=HIDDEN NAME=id VALUE="<% $QueueObj->id %>">
      


<& /Elements/TitleBoxStart, title => 'Modify group rights for queue '.$QueueObj->Name &>

<TABLE>
<TR><TD>Pseudogroups</TD></TR>
% while (my $GroupObj = $PseudoGroups->Next()) {
	      
	      <TR ALIGN=RIGHT> 
		<TD VALIGN=TOP>
		  <% $GroupObj->Name %>
		</TD>
		<TD>
	    <& /Admin/Elements/SelectRights, PrincipalObj => $GroupObj, 
                                   PrincipalType => 'Group',
	                           QueueObj => $QueueObj,
                                   Scope => 'Queue' &>

		</TD>
	      </TR>
	
% }

<TR><TD>Groups</TD></TR>

% while (my $GroupObj = $Groups->Next()) {
	      
	      <TR ALIGN=RIGHT> 
		<TD VALIGN=TOP>
		  <% $GroupObj->Name %>
		</TD>
		<TD>
	    <& /Admin/Elements/SelectRights, PrincipalObj => $GroupObj, 
                                   PrincipalType => 'Group',
	                           QueueObj => $QueueObj,
                                   Scope => 'Queue' &>

		</TD>
	      </TR>
	
% }
	
      </TABLE>

      <& /Elements/TitleBoxEnd &>
      <& /Elements/Submit, Caption => "Be sure to save your changes", Reset => 1 &>
  </FORM>
  
<%INIT>
 
#Update the acls.
my @results =  ProcessACLChanges(\@CheckACL, \%ARGS);

# {{{ Deal with setting up the display of current rights.

# {{{ do basic initialization.

#Define vars used in html above
my ($GroupObj);

my ($right);


if (!defined $id) {
    Abort("No Queue defined");
}

my $QueueObj = new RT::Queue($session{'CurrentUser'});
$QueueObj->Load($id) ||
  Abort("Couldn't load queue $id");
  
  # Find out which groups we want to display ACL selects for.
  my $Groups = new RT::Groups($session{'CurrentUser'});
  #TODO: limit this to non-pseudogroups
  $Groups->LimitToReal();


  my $PseudoGroups = new RT::Groups($session{'CurrentUser'});
  #TODO: limit this to non-pseudogroups
  $PseudoGroups->LimitToPseudo;


# }}}
    
  
  # }}}

</%INIT>

<%ARGS>
$id = undef
$UserString => undef
$UserOp => undef
$UserField => undef
@CheckACL => undef
</%ARGS>
