[rt-users] error using session{'CurrentUser'} on custom header

Chad Sylvain chad at itascacg.com
Tue Apr 28 11:16:12 EDT 2009


Hello,

I have a custom "Header" in my /local/html/Elements folder.  I am trying 
to add a link to the nav links at the top right of the page.  The 
pertinent code (with my additions marked) is below.  This will create 
the link I'm after, but it breaks the Logout and Preferences links. 
Using them generates an error page with the message "Can't call method 
"HasRight" on an undefined value at 
/opt/rt3/bin/../lib/RT/User_Overlay.pm line 1250."

I'm trying to provide my own help link to users, but will want different 
pages available to different users, based on their rights (eventually I 
would have a more elaborate if->elseif->...else construction than what 
appears below; otherwise, I would just tack what I'm doing into the 
earlier $session{'CurrentUser'} block).  I had thought to test the 
user's rights to do this, but it would seem my handling of 
$session{'CurrentUser'} is erroneous.

Any help is appreciated.

Thanks,
Chad


% if ($ShowBar) {
<& /Elements/Logo, %ARGS &>

<div id="quickbar">
   <div id="quick-personal">
     <span class="hide"><a href="#skipnav"><&|/l&>Skip Menu</&></a> | 
</span>
% if ($session{'CurrentUser'}->Name) {
     <&|/l, "<span>".$session{'CurrentUser'}->Name."</span>" &>Logged in 
as [_1]</&>
%     if ( $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', 
Object => $RT::System ) ) {
     | <a 
href="<%RT->Config->Get('WebPath')%><%$Prefs%>"><&|/l&>Preferences</&></a>
%     }
% } else {
     <&|/l&>Not logged in.</&>
% }

% $m->callback( %ARGS );
<& Logout, %ARGS &>

%# I ADDED THIS
% if ( $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object 
=> $RT::System ) ) {
	| <a href="http://www.mydomain.com/mypage">HELP</a>
%	}
%# END OF ADDITION
   </div>
% }


__________________________________________
Chad Sylvain/Itasca Consulting Group, Inc.
Communications, Marketing/612 371-4711



More information about the rt-users mailing list