[rt-devel] Creating Rights: AssignTicket, howto

Toby C Patterson tcp at cat.pdx.edu
Wed Nov 12 09:35:59 EST 2003


rt-devel:

I just wanted to post a quick blurb about how to create a custom right
in RT, as I've seen some mention of this in the list archives without
explanation.  The following is what I did.  Its pretty simple.
1) Add the right in the Queue_Overlay.pm file;
1) Modify Ticket_Overlay.pm ( or other files ) to reflect the logic 
   of the right;

* see the diff files *

The new right will show up in the database once you assign it to some
groups or users.  So far, I haven't noticed any other libs or templates that
needed to be changed, but if I missed something, please let me know.

I think an AssignTicket right would be a great addition to future releases
of RT.

just me
tcp



mysql> select a.PrincipalType, a.RightName, g.Description from ACL a, Groups g where a.RightName = 'AssignTicket' and a.PrincipalID = g.id;                     +---------------+--------------+--------------------------------------+
| PrincipalType | RightName    | Description                          |
+---------------+--------------+--------------------------------------+
| Group         | AssignTicket | Assigns Tickets to Queues and People |
| Owner         | AssignTicket | SystemRolegroup for internal use     |
+---------------+--------------+--------------------------------------+
2 rows in set (0.00 sec)

mysql>


# Diffs against lib files from RT 3.0.5

# Queue_Overlay.pm
90a91
>     AssignTicket    => 'Assign tickets',


# Ticket_Overlay.pm

1914c1914,1915
<     unless ( $self->CurrentUserHasRight('ModifyTicket') ) {
---
>     unless (    $self->CurrentUserHasRight('ModifyTicket')  
>              || $self->CurrentUserHasRight('AssignTicket') ) {
1948c1949,1950
<     return ( $self->_Set( Field => 'Queue', Value => $NewQueueObj->Id() ) );
---
>     return ( $self->_Set( Field => 'Queue', Value => $NewQueueObj->Id(), CheckACL => 0 ) );
>     # Toby, disabled the CheckACL since we've done it already
3055c3057,3058
<                  || $self->CurrentUserHasRight('StealTicket') ) {
---
>                  || $self->CurrentUserHasRight('StealTicket') 
>                  || $self->CurrentUserHasRight('AssignTicket') ) {
3060c3063,3064
<         unless ( $self->CurrentUserHasRight('ModifyTicket') ) {
---
>         unless (    $self->CurrentUserHasRight('ModifyTicket') 
>                  || $self->CurrentUserHasRight('AssignTicket') ) {
3077,3079c3081,3084
<         ( $self->OwnerObj->Id != $RT::Nobody->Id ) and    #and the owner is set
<         ( $self->CurrentUser->Id ne $self->OwnerObj->Id() )
<       ) {                                                 #and it's not us
---
>         (   $self->OwnerObj->Id != $RT::Nobody->Id ) and            #and the owner is set
>         (   $self->CurrentUser->Id ne $self->OwnerObj->Id() ) and   #and it's not us
>         ( ! $self->CurrentUserHasRight('AssignTicket') )            #and we cannot assign tickets 
>       ) {                                                 



More information about the Rt-devel mailing list