-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 14/09/2006, at 5:15 AM, Nigel Kersten wrote:

I actually just thought of that, and was about to start poking around the API to work out how to check whether a user is a member of a certain group, or what privileges they have.

I realise this question is really more to do with my lack of knowledge wrt Perl/Mason, but I've been poking around google for a while and the examples on the wiki and can't see how to do it.

Take something like this in Ticket/Create.html

<td class="label">
<&|/l&>Status</&>:
</td>

How do I place a condition around that? I've worked out how to tell whether the current user is a member of a certain group based upon some wiki sample code:

% my $GroupObj = RT::Group->new( $session{ 'CurrentUser' } );
% my $PrincipalObj = RT::Principal->new( $session{ 'CurrentUser' } );
% $PrincipalObj->Load( $session{ 'CurrentUser' }->id );
% $GroupObj->LoadUserDefinedGroup( 'RT Admins' );
% my $isRTAdmin = $GroupObj->HasMemberRecursively( $PrincipalObj );

and can put in Perl if/else loops, but I guess it all comes down to me not quite understanding the <& syntax and what that represents.

I do know a fair few other languages and APIs though, so if anyone is in the mood to offer me a simple example that would be something like (although this obviously doesn't work), that would be greatly appreciated and should easily get me started:


<td class="label">

% if ( $isRTAdmin) {
        <&|/l&>Status</&>:
% } else {
        // do nothing
% }

</td>




- --
Nigel Kersten [Senior Technical Officer]
College of Fine Arts, University of NSW, Australia.
CRICOS Provider Code: 00098G



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFChYkAXUak+OwF4gRAgOsAKD7MyuCMUfvtuDM9NHiJvACJRZ/+ACeKjk3
hh5l+Sj3I5jIdhgL4jGyxSY=
=yujp
-----END PGP SIGNATURE-----
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com

Reply via email to