[rt-users] Changing the default login screen for a particular user

Bruce Campbell bruce_campbell at ripe.net
Mon May 13 05:48:25 EDT 2002


On Thu, 9 May 2002, Dane Rapaport wrote:

> The idea of this user is just to be generic so that they can see the
> status of requests and the number of requests in this queue.
>
> Any ideas about how I can make the Search-Queue screen the default for
> that particular login?

*Caution* - the following is a quick hack against my working RT
2.0.it-was-9-and-it-needs-a-fresh-install-by-now copy ;)

There are two ways that you can do this.  Both require changing the
WebRT/html/index.html file.  Of course, if they're following a direct link
into the RT system, this hack won't fire (which is the expected
behaviour).

Firstly, you can hard-code for a particular username (eg, 'guest').  Or,
you can hard-code for a particular type of user, in this case a user who
does not have the 'ModifyTicket' right.  We'll use the second method,
mainly because we also get the Queue identifier ;)

In the above-mentioned file, add the following lines in place of the
existing include of Elements/Header .

	% # Check to see whether this user only has SeeQueue enabled.
	% # Actually, check whether this user can ModifyTickets, and do something
	% # if they can't.
	% # Get a listing of Queues that this user can 'see'.
	% my $queues = new RT::Queues($session{'CurrentUser'});
	% $queues->UnLimit();
	% my $only_seeq = 1;
	% my $first_name = undef;
        % # Iterate through the list (probably only one)
	% while( my $this_queue = $queues->Next() ){
	%       # Set the flag if we can modify this queue
	%       $only_seeq = 0 if( $this_queue->CurrentUserHasRight('ModifyTicket') );
	%       # Grab the id of the first Queue we see.
	%       $first_name = $this_queue->Id unless( $this_queue->CurrentUserHasRight('ModifyTicket') || defined( $first_name ) );
	% }
	% if( $only_seeq > 0 && defined( $first_name ) ){
	%   # We cannot modify any tickets in the Queues we can see.
	%   # Refresh to the Search screen.
	%   # Note that Elements/Header will not accept a '0' second refresh.
	%   my $long_str = "1; Search/Listing.html?ValueOfStatus=open&ValueOfStatus=new&StatusOp=%3D&QueueOp=%3D&ValueOfQueue=" . $first_name . "&RowsPerPage=50&NewSearch=1";
	    <& /Elements/Header, Title=>"Refresh", Refresh => "$long_str" &>
	% }else{
            % # This is the original line.
	    <& /Elements/Header, Title=>"Start page", Refresh => $session{'home_refresh_interval'} &>
	% }

The effect of this is a 1 second refresh to the Listing page, when the
'Home' link is selected, or on entry to the RT system.  If this isn't
liked, a 0 second refresh can be obtained by editing Elements/Header.

Regards,

-- 
                             Bruce Campbell                            RIPE
                   Systems/Network Engineer                             NCC
                 www.ripe.net - PGP562C8B1B                      Operations





More information about the rt-users mailing list