Remove a super user from the Owners dropdown list

From Request Tracker Wiki
Jump to navigation Jump to search

You can achieve this via a callback to exclude specified users from the owner dropdown, e.g. create

/opt/rt5/local/html/Callbacks/MyRT/Elements/SelectOwnerDropdown/ModifyOwnerListRaw

with the following content:

    <%INIT>
    if ( $UserHashRef ) {
        for my $user_id ( 14, 25, 26, 38, 57 ) {
            delete $UserHashRef->{$user_id};
        }
    }
    </%INIT>
    
    <%ARGS>
    $UserHashRef => undef
    </%ARGS>

Remember to replace the list of "14, 25, 26, 38, 57" above with the real user ids you want to exclude.

Alternatively, if you want to exclude all "Do anything and everything" users, you can use the following callback instead:

   <%INIT>
   if ( $UserHashRef ) {
       for my $user_id ( keys %$UserHashRef ) {
           delete $UserHashRef->{$user_id}
               if $UserHashRef->{$user_id}->HasRight( Object => $RT::System, Right => 'SuperUser' );
       }
   }
   </%INIT>
   
   <%ARGS>
   $UserHashRef => undef
   </%ARGS>

At last, clear Mason's cache and restart Apache.