GroupMembershipCheck: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
 
(No difference)

Latest revision as of 15:11, 6 April 2016

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;