Difference between revisions of "Remove a super user from the Owners dropdown list"

From Request Tracker Wiki
Jump to navigation Jump to search
(Created page with "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: <pre> <%INIT> if ( $UserHashRef ) { for my $user_id ( 14, 25, 26, 38, 57 ) { delete $UserHashRef->{$user_id}; } } </%INIT> <%ARGS> $UserHashRef => undef </%ARGS> </pre> Remember to replace the list...")
 
(No difference)

Latest revision as of 09:51, 20 June 2023

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' );
       }
   }
   
   
   <%ARGS>
   $UserHashRef => undef
   

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