GroupMembershipCheck

From Request Tracker Wiki
Revision as of 15:11, 6 April 2016 by Admin (talk | contribs) (2 revisions imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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;