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) {


<& /Elements/MyElement &>


%}

–Alex

Alex Brelsfoard
Web Applications Developer
Web Development Office
Worcester Polytechnic Institute
508-831-6147
alexb@wpi.eduFrom: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Brelsfoard,
Alex
Sent: Wednesday, March 30, 2005 11:22 AM
To: rt-users@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@wpi.edu

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”)){


<& /Element/MyElements &>


% }

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

Matt.From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of
Brelsfoard, Alex
Sent: Thursday, March 31, 2005 5:02 AM
To: rt-users@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) {


<& /Elements/MyElement &>


%}

–Alex

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

From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of
Brelsfoard, Alex
Sent: Wednesday, March 30, 2005 11:22 AM
To: rt-users@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@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.

Sounds good to me! Thanks.
–Alex

Alex Brelsfoard
Web Applications Developer
Web Development Office
Worcester Polytechnic Institute
508-831-6147
alexb@wpi.eduFrom: Matthew Watson [mailto:matthew.watson@staff.netspace.net.au]
Sent: Wednesday, March 30, 2005 5:12 PM
To: Brelsfoard, Alex; rt-users@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”)){


<& /Element/MyElements &>


% }

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

Matt.

From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Brelsfoard,
Alex
Sent: Thursday, March 31, 2005 5:02 AM
To: rt-users@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) {


<& /Elements/MyElement &>


%}

–Alex

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

From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Brelsfoard,
Alex
Sent: Wednesday, March 30, 2005 11:22 AM
To: rt-users@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@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.

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@wpi.eduFrom: Matthew Watson [mailto:matthew.watson@staff.netspace.net.au]
Sent: Wednesday, March 30, 2005 5:12 PM
To: Brelsfoard, Alex; rt-users@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”)){


<& /Element/MyElements &>


% }

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

Matt.

From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Brelsfoard,
Alex
Sent: Thursday, March 31, 2005 5:02 AM
To: rt-users@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) {


<& /Elements/MyElement &>


%}

–Alex

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

From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Brelsfoard,
Alex
Sent: Wednesday, March 30, 2005 11:22 AM
To: rt-users@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@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.

Really? You aren’t creating an instance of “RT::Queues” are you? Rather
than RT::Queue

Regards,
Matt.From: Brelsfoard, Alex [mailto:alexb@WPI.EDU]
Sent: Thursday, March 31, 2005 6:44 AM
To: Matthew Watson; rt-users@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@wpi.edu

From: Matthew Watson [mailto:matthew.watson@staff.netspace.net.au]
Sent: Wednesday, March 30, 2005 5:12 PM
To: Brelsfoard, Alex; rt-users@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”)){


<& /Element/MyElements &>


% }

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

Matt.

From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of
Brelsfoard, Alex
Sent: Thursday, March 31, 2005 5:02 AM
To: rt-users@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) {


<& /Elements/MyElement &>


%}

–Alex

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

From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of
Brelsfoard, Alex
Sent: Wednesday, March 30, 2005 11:22 AM
To: rt-users@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@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.