[rt-users] Displaying a section based on access to a queue--Answer

Matthew Watson matthew.watson at staff.netspace.net.au
Wed Mar 30 17:50:14 EST 2005


Really? You aren't creating an instance of "RT::Queues" are you? Rather
than RT::Queue

 

Regards,
Matt.

 

 

________________________________

From: Brelsfoard, Alex [mailto:alexb at WPI.EDU] 
Sent: Thursday, March 31, 2005 6:44 AM
To: Matthew Watson; rt-users at lists.bestpractical.com
Subject: RE: [rt-users] Displaying a section based on access to a
queue--Answer

 

This seems like a great idea.  but when I try to implement it I get an
error saying that it does not recognize the Load method.

Any ideas?

--Alex

 

Alex Brelsfoard 
Web Applications Developer 
Web Development Office 
Worcester Polytechnic Institute 
508-831-6147 
alexb at wpi.edu 

 

 

________________________________

From: Matthew Watson [mailto:matthew.watson at staff.netspace.net.au] 
Sent: Wednesday, March 30, 2005 5:12 PM
To: Brelsfoard, Alex; rt-users at lists.bestpractical.com
Subject: RE: [rt-users] Displaying a section based on access to a
queue--Answer

That's a pretty messy way of doing it, you are looping over all the
queues but only doing any action if the queue is "8" , it would be
better to just load queue 8 and test on that. Something like this,

 

% my $q = new RT::Queue($session{'CurrentUser'});

% $q->Load('8');

% if ($q->Id && $q->CurrentUserHasRight("SeeQueue")){

<br>

 <& /Element/MyElements &>

<br>

% }

 

 

This should scale a lot better as you get more queues.

 

Matt.

 

________________________________

From: rt-users-bounces at lists.bestpractical.com
[mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of
Brelsfoard, Alex
Sent: Thursday, March 31, 2005 5:02 AM
To: rt-users at lists.bestpractical.com
Subject: RE: [rt-users] Displaying a section based on access to a
queue--Answer

 

I played around long enough and found a solution to this. I figured I'd
share with everyone:

 

%my $q=new RT::Queues($session{'CurrentUser'});
%$q->UnLimit;
%my $cansee = 0;
%while (my $queue=$q->Next) {
% if ($queue->id == 8) {
%  if ($queue->CurrentUserHasRight('SeeQueue')) {
%   $cansee = 1;
%  }
% }
%}
%
%if ($cansee) {
<br>
<& /Elements/MyElement &>
<br>
%}

 

 

--Alex

Alex Brelsfoard 
Web Applications Developer 
Web Development Office 
Worcester Polytechnic Institute 
508-831-6147 
alexb at wpi.edu 

 

 

________________________________

From: rt-users-bounces at lists.bestpractical.com
[mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of
Brelsfoard, Alex
Sent: Wednesday, March 30, 2005 11:22 AM
To: rt-users at lists.bestpractical.com
Subject: [rt-users] Displaying a section based on access to a queue

I would like to have something displayed only if the person logged in
has access to a particular queue or is a member of a specific group.

Basically:

 

% if ($UserIsMemberOfGroup("MyGroup") {

<& /Elements/MyElement &>

% }

 

Well, that's the general gist of what I want.  Any idea of what the
proper syntax is?

Thanks.

--Alex

 

Alex Brelsfoard 
Web Applications Developer 
Web Development Office 
Worcester Polytechnic Institute 
508-831-6147 
alexb at wpi.edu 

 

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they are
addressed. Please notify the sender immediately by email if you have
received this email by mistake and delete this email from your system.
Please note that any views or opinions presented in this email are
solely those of the author and do not necessarily represent those of the
organisation. Finally, the recipient should check this email and any
attachments for the presence of viruses. The organisation accepts no
liability for any damage caused by any virus transmitted by this email.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20050331/6f0ffd3c/attachment.htm>


More information about the rt-users mailing list