Checking GroupMembership in code

Hi all,
Please can anyone help me out with the code snippet to check and retrieve the Group a particular user belongs to so that i can do certain things bases on the GroupID or name returned.
Thanks.

ALL-NEW Yahoo! Messenger - all new features - even more fun!

What code do you have now? A user can be in many groups so the
question is not as simple as you would ask.On Thu, Feb 17, 2005 at 06:48:13PM +0000, Oluwatomisin Ilori wrote:

Hi all,
Please can anyone help me out with the code snippet to check and retrieve the Group a particular user belongs to so that i can do certain things bases on the GroupID or name returned.
Thanks.

I’ve completed my upgrade from 3.2 to 3.4 and all works well.

One oddity though.

When I create a new ticket, below the text box & button, there’s a
very long (~1page) gap of white space. Then it shows the Basics, Dates, and
Links info. Then another long whitespace till it shows the little
RT/BestPractical Footer. I’m guess it’s from these blocks in the HTML…



























































Soo… is there a reason these are there? (besides the fact they are in the
Create.html file)

At Friday 2/18/2005 09:35 AM, Mathew Walker wrote:

I’ve completed my upgrade from 3.2 to 3.4 and all works well.

One oddity though.

When I create a new ticket, below the text box & button, there’s
a very long (~1page) gap of white space. Then it shows the Basics, Dates,
and Links info. Then another long whitespace till it shows the little
RT/BestPractical Footer. I’m guess it’s from these blocks in the HTML…



























































Soo… is there a reason these are there? (besides the fact they are in
the Create.html file)

The very bottom section of
s is there so that you can click “show
details” and get the detail section at the top of the browser. The middle
section of
s is probably there so that you can’t see the lower
section initially - I guess if you could see it, then it wouldn’t make
quite as much sense to click a link to get there.

One minor odd thing I noticed - when you choose the “show details” link,
the section you go to is title “The Basics”. Clicking “show basics” gets
you away from The Basics section, back to the top.

Steve

I’ve completed my upgrade from 3.2 to 3.4 and all works well.

One oddity though.

When I create a new ticket, below the text box & button, there’s a
very long (~1page) gap of white space. Then it shows the Basics, Dates,
and Links info. Then another long whitespace till it shows the little
RT/BestPractical Footer. I’m guess it’s from these blocks in the HTML…

This has been like that since RT 2.0.0. It was a way to simulate a pair
of “tabs” on a single page. That create page is really due for a
complete overhaul.

Hi all,
Please can anyone help me out with the code snippet to check and retrieve
the Group a particular user belongs to so that i can do certain things bases
on the GroupID or name returned.
Thanks.

A user can belong to any number of groups and there is no designation
for any sort of “primary” group.

You need to come at it from the other direction, take a group and
determine if a user is a member of that group. You can do that with
my little snippet here:
http://wiki.bestpractical.com/admin/index.cgi?GroupMembershipCheck

Andy Harrison

Oops… Drop the /admin/ from that url…

Andy Harrison

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@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!