Patch - don't show "New ticket" in self service if user doesn't have right

Hi,

The following patch prevents the “New Ticket” option being show in the
self service interface if the user doesn’t have the CreateTicket right.

This should lead to less confusion, I think.

(apply in html/SelfService/Elements)

==== start ====
— Tabs.backup 2009-09-16 12:00:15.000000000 +0000
+++ Tabs 2009-09-16 12:04:02.000000000 +0000
@@ -83,14 +83,18 @@ my $tabs = { A => { title => loc('Open
},
};

-if ($queue_count > 1) {

  •    $tabs->{C} = { title => loc('New ticket'),
    
  •                   path => 'SelfService/CreateTicketInQueue.html'
    

+if ($session{‘CurrentUser’}->HasRight( Right => ‘CreateTicket’,

  •                                  Object => $RT::System )) {
    
  •   if ($queue_count > 1) {
    
  •                   $tabs->{C} = { title => loc('New ticket'),
    
  •                           path =>
    

‘SelfService/CreateTicketInQueue.html’
};
-} else {

  •   } else {
       $tabs->{C} = { title => loc('New ticket'),
                      path => 'SelfService/Create.html?Queue=' . $queue_id
                      };
    
  •   }
    

}

if ($session{‘CurrentUser’}->HasRight( Right => ‘ModifySelf’,
==== end ====

It would be great to see this applied to RT. As I don’t particularly
understand RT coding style and indentation, hopefully someone can tidy
this up for me.

Thanks.

A quick read of this patch suggests that it will break if you’ve granted
the user ‘create ticket’ rights at the queue level.On Wed, Sep 16, 2009 at 03:40:01PM +0100, Chris Howells wrote:

Hi,

The following patch prevents the “New Ticket” option being show in the
self service interface if the user doesn’t have the CreateTicket right.

This should lead to less confusion, I think.

(apply in html/SelfService/Elements)

==== start ====
— Tabs.backup 2009-09-16 12:00:15.000000000 +0000
+++ Tabs 2009-09-16 12:04:02.000000000 +0000
@@ -83,14 +83,18 @@ my $tabs = { A => { title => loc('Open
},
};

-if ($queue_count > 1) {

  •    $tabs->{C} = { title => loc('New ticket'),
    
  •                   path => 'SelfService/CreateTicketInQueue.html'
    

+if ($session{‘CurrentUser’}->HasRight( Right => ‘CreateTicket’,

  •                                  Object => $RT::System )) {
    
  •   if ($queue_count > 1) {
    
  •                   $tabs->{C} = { title => loc('New ticket'),
    
  •                           path =>
    

‘SelfService/CreateTicketInQueue.html’
};
-} else {

  •   } else {
       $tabs->{C} = { title => loc('New ticket'),
                      path => 'SelfService/Create.html?Queue=' . $queue_id
                      };
    
  •   }
    

}

if ($session{‘CurrentUser’}->HasRight( Right => ‘ModifySelf’,
==== end ====

It would be great to see this applied to RT. As I don’t particularly
understand RT coding style and indentation, hopefully someone can tidy
this up for me.

Thanks.


List info: The rt-devel Archives