[rt-users] Determining Group Membership
Ruslan U. Zakirov
cubic at acronis.ru
Wed Dec 31 03:25:46 EST 2003
Andy Harrison wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I'd like to make my custom ticket creation for automatically turn on
> SELECTED for the a particular group in the Group listbox.
>
> perldoc Users_Overlay cites:
>
> MemberOfGroup PRINCIPAL_ID
>
> takes one argument, a group's principal id. Limits the
> returned set to members of a given group
>
> So I tried adding this to INIT:
> use RT::Users
> my $UserObj = new RT::Users($session{'CurrentUser'});
>
> and this to the main portion of the form:
>
> % print "<br /><pre>\n:::", $UserObj->MemberOfGroup(336), ":::</pre><br />\n";
>
> It prints out :::CachedGroupMembers_2:::
Hello, Andy.
I didn't understand what do you want to finaly get.
So I just writed test.html which show all user defined groups and their
members:
<html>
<head>
<title></title>
</head>
<body>
% while(my $Group = $Groups->Next) {
<b><% $Group->Name %></b><br>
% my $UserMembers = $Group->UserMembersObj;
<p style="left-margin:20px;">
% while(my $User = $UserMembers->Next) {
"<% $User->RealName || $User->Name || $User->Login %>" <<%
$User->EmailAddress %>><br>
% }
</p>
% }
</body>
</html>
<%INIT>
use RT::Groups;
my $Groups = new RT::Groups($session{'CurrentUser'});
$Groups->LimitToUserDefinedGroups();
</%INIT>
I think that you have to send more info:
What list of or instance do you want to get at the end?
Don't resend your letters(questions) without refactoring. People didn't
answer you because your question was bad formed.
Best regards. Ruslan.
>
> I also tried:
>
> user RT::Group;
> my $GroupObj = new RT::Group($session{'CurrentUser'});
>
> % print "<br /><pre>\n:::", $GroupObj->MembersObj(336), " :::</pre><br />\n";
>
> Which returns:
>
> :::RT::GroupMembers=HASH(0x96d4e28):::
>
>
> I've verified that this *is* the group id I'm looking for:
>
> rt3=# select * from groups where id = '336';
> id | name | description | domain | type | instance
> - -----+--------+--------------------+-------------+------+----------
> 336 | SysOps | Systems Operations | UserDefined | |
> (1 row)
>
> rt3=# select * from principals where id = '336';
> id | principaltype | objectid | disabled
> - -----+---------------+----------+----------
> 336 | Group | 336 | 0
> (1 row)
>
> Could anyone shed any light on how to do this?
>
> Thanx!
>
> - --
> Andy Harrison
> (full headers for details)
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (FreeBSD)
>
> iD8DBQE/4gi2CYaHi6DasBoRAsMHAJ4+LEeGphSdOFzpvTo6LozP2fYN8gCgjf2O
> jiRnMmUj2dbSOxqVufENKrk=
> =2zGV
> -----END PGP SIGNATURE-----
>
>
More information about the rt-users
mailing list