GroupMembershipCheck

From Request Tracker Wiki
Jump to navigation Jump to search

There's probably a more stylish way, but this is a quick and dirty method that works fairly well.

% my $GroupObj = RT::Group->new( $session{ 'CurrentUser' } );

% my $PrincipalObj = RT::Principal->new( $session{ 'CurrentUser' } );
% $PrincipalObj->Load( $session{ 'CurrentUser' }->id );
% $GroupObj->LoadUserDefinedGroup( 'YourGroupName' );
% my $HasMember = $GroupObj->HasMemberRecursively( $PrincipalObj );
% print "Worked\n" if $HasMember;