[rt-users] Checking GroupMembership in code

Oluwatomisin Ilori tomisilori at yahoo.co.uk
Sat Feb 19 12:16:54 EST 2005


Hi everyone,
Thanks for all the help everyone has provided.
I'm currently looking at the GroupMemberschipCheck on RT Wiki's site but the problem i have is that i need to check the group membership a user belongs too
This is the code i'm intending to use. The logic is that a user is checked against the group he belongs to and if he belongs to a particular group, he is added to the adminCc. pls, kindly help me look through this. Any suggestions would be appreciated. I'm trying to use this code as a custom condition code. 
 
 
my $admincclist = $self->TicketObj->AdminCc;
my $user = RT::User->new($RT::SystemUser);
$user->LoadByEmail('tomi at google.com');
my $GroupObj = RT::Group->new( $session{ 'CurrentUser' } );
my $PrincipalObj = RT::Principal->new( $session{ 'CurrentUser' } );
$PrincipalObj->Load( $user->Id;);
$GroupObj->LoadUserDefinedGroup( 'RegionEast' );
if( $HasMember = $GroupObj->HasMemberRecursively( $PrincipalObj ));
{
$admincclist->AddMember($user->Id);
return (1);
}
$GroupObj->LoadUserDefinedGroup( 'RegionWest);
elsif ($HasMember = $GroupObj->HasMemberRecursively( $PrincipalObj )
{
$admincclist->AddMember($user->Id);
return (1);
}
else
{
return (undef
}


 


 

		
---------------------------------
 ALL-NEW Yahoo! Messenger - all new features - even more fun!  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20050219/36f9a3bd/attachment.htm>


More information about the rt-users mailing list