<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=TestGroupMembership</id>
	<title>TestGroupMembership - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=TestGroupMembership"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=TestGroupMembership&amp;action=history"/>
	<updated>2026-08-22T16:59:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=TestGroupMembership&amp;diff=3812&amp;oldid=prev</id>
		<title>Admin: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=TestGroupMembership&amp;diff=3812&amp;oldid=prev"/>
		<updated>2016-04-06T20:39:27Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If you want to test for group membership, you can do it the following way:&lt;br /&gt;
&lt;br /&gt;
 my $GroupObj = RT::Group-&amp;amp;gt;new($user);&lt;br /&gt;
 $GroupObj-&amp;amp;gt;LoadUserDefinedGroup( &amp;#039;IT Staff&amp;#039; );&lt;br /&gt;
 my $PrincipalObj = RT::Principal-&amp;amp;gt;new($user);&lt;br /&gt;
 $PrincipalObj-&amp;amp;gt;Load($user-&amp;amp;gt;id);&lt;br /&gt;
 my $prinid = $user-&amp;amp;gt;PrincipalId;&lt;br /&gt;
 print $user-&amp;amp;gt;Name . &amp;quot;\n&amp;quot;;                  #Note: These are debugs&lt;br /&gt;
 print $GroupObj-&amp;amp;gt;Name . &amp;quot;\n&amp;quot;;              #Remove them from production&lt;br /&gt;
 print $PrincipalObj-&amp;amp;gt;PrincipalType . &amp;quot;\n&amp;quot;; #&lt;br /&gt;
 if ($GroupObj-&amp;amp;gt;HasMemberRecursively($PrincipalObj)) {&lt;br /&gt;
   do_stuff(); #Fill in with work to do&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>