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

Chris Howells chris+rt at chrishowells.co.uk
Wed Sep 16 10:40:01 EDT 2009


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.




More information about the Rt-devel mailing list