<%INIT> if ( $session{CurrentUser}->HasRight( Right => 'SuperUser', Object => $RT::System) or $session{CurrentUser}->HasRight( Right => 'BecomeUser', Object => $RT::System ) ){ # refuse to become super users my $u = RT::CurrentUser->new(RT->SystemUser); $u->Load($id); if ($u->HasRight(Right => 'SuperUser', Object => $RT::System)){ $m->out("

# Error

Cannot become a super user"); } else { $session{RT_Extension_BecomeUser_OriginalUser} = $session{CurrentUser}; $session{CurrentUser} = $u; $session{CurrentUser}->_BuildTableAttributes; $m->out("

# you are now user ".$session{CurrentUser}->Name." (id: $id )

"); } } else{ $m->out("

# Error

you don't have the right to become other users

"); } home <%ARGS> $id => undef