[rt-devel] Re: Queue-rights

Jonas Lincoln lincoln at unit.liu.se
Thu May 15 07:49:10 EDT 2003


I invented a right "WorkMember" for people who actually works on a 
Queue. To use this later in for example QuickSearch, I copied the 
Queues->Next function to a Queues->NextLimit function and altered 
NextLimit to consider WorkMembers. See code below.

# diff -u lib/RT/Queue_Overlay.pm lib/RT/Queue_Local.pm
--- lib/RT/Queue_Overlay.pm     Wed May  7 15:18:41 2003
+++ lib/RT/Queue_Local.pm       Wed May 14 12:51:37 2003
@@ -85,7 +85,8 @@
      CommentOnTicket => 'Comment on tickets', 
# loc_pair
      OwnTicket       => 'Own tickets', 
# loc_pair
      ModifyTicket    => 'Modify tickets', 
# loc_pair
-    DeleteTicket    => 'Delete tickets'                               # 
loc_pair
+    DeleteTicket    => 'Delete tickets', 
# loc_pair
+    WorkMember      => 'Member of a Queue' 
   # loc_pair

  };

# diff -u lib/RT/Queues_Overlay.pm lib/RT/Queues_Local.pm
--- lib/RT/Queues_Overlay.pm    Wed May  7 15:18:41 2003
+++ lib/RT/Queues_Local.pm      Wed May 14 13:04:20 2003
@@ -126,5 +126,37 @@
  }
  # }}}

+# {{{ sub NextLimit
+
+=head2 NextLimit
+
+Returns the next queue that this user can see and is a member of
+
+=cut
+
+sub NextLimit {
+    my $self = shift;
+
+
+    my $Queue = $self->SUPER::Next();
+    if ((defined($Queue)) and (ref($Queue))) {
+
+       if ($Queue->CurrentUserHasRight('SeeQueue') and 
$Queue->CurrentUserHasRight('WorkMember')) {
+           return($Queue);
+       }
+
+       #If the user doesn't have the right to show this queue
+       else {
+           return($self->Next());
+       }
+    }
+    #if there never was any queue
+    else {
+       return(undef);
+    }
+
+}
+# }}}
+
  1;

and for the QuickSearch, simply replace
while (my $queue = $Queues->Next) {
with
while (my $queue = $Queues->NextLimit) {

Hope this helps, it helps me at least :)

/Jonas


kim.taylor at pncbank.com wrote:
> Jonas Lincoln wrote:
> 
>>I have the following scenario:
>>Management has a lot of projects, 50+. These will each get an own queue.
>>All staff-workers will get rights to work in all queues.
> 
> 
>>However, I want something to use to show what projects an employee
>>actually works with. This is so that the quick-search and first page
>>won't clog up entirely with uninteresting queues that an employee
>>doesn't work with, but still must be able to handle when necessary.
> 
> 
>>How do I solve this? Suggestions?
> 
> 
> Firstly, I don't have any ideas on how to do this, sorry.
> 
> Your scenario/environment sounds very much like that I deal with.
> 
> I'm watching the RT mailing list, but if you would get any
> hints/suggestions/brainstorms, please do pass them along directly if you
> could.
> 
> Thanks and good luck in your quest,
> 
> KET
> <Kim.Taylor at pnc.com>
> 
> 




More information about the Rt-devel mailing list