[rt-users] show a new ticket tab for a special user group only

Dirk Pape pape-rt at inf.fu-berlin.de
Thu May 22 16:21:10 EDT 2008


Hello Ben,

--Am 22. Mai 2008 18:39:12 +0200 schrieb Benjamin Weser <weser at osp-dd.de>:

> $RT::Logger->info("User: ", $session{'CurrentUser'}->Name);
> my $groups = $session{'CurrentUser'}->UserObj->OwnGroups;
> $RT::Logger->info("Count: ", $groups->Count);
> while (my $group = $groups->Next){
>     $RT::Logger->info("test: ", $group->Name);
>     if ( $group->Name =~ /Members RMB/ ){
>         $RT::Logger->info("found: ", $group->Name);
>         $ticket_page_tabs->{_Ca} = { title => loc('RMB'),
>                                     path  => "Ticket/RMB.html?id=" . $id,
>                                   };
>     }
> }

I don't know why your code does not work, but I would do it other way 
round: load the group and look if currentuser is a member.

Without guarantee:

my $group = new RT::Group($session{'CurrentUser'});
$group->LoadUserDefinedGroup('Members RMB');
if ($group->HasMemberRecursively($session{'CurrentUser'})) {
        $ticket_page_tabs->{_Ca} = { title => loc('RMB'),
                                    path  => "Ticket/RMB.html?id=" . $id,
                                   };
}

Dirk.
-- 
Dr. Dirk Pape (eAS - Projektleitung Campus Management)
Freie Universitaet Berlin
Grunewaldstr. 34a, 12165 Berlin
Tel. +49 (30) 838 75143, Fax. +49 (30) 838 54654




More information about the rt-users mailing list