Mailing List Archive

rt branch, 4.0/hide-create-ticket-widget-if-no-right, created. rt-4.0.5-117-ga510085
The branch, 4.0/hide-create-ticket-widget-if-no-right has been created
at a5100851a6c26fc12e1c41802cdec019a5fd705e (commit)

- Log -----------------------------------------------------------------
commit a5100851a6c26fc12e1c41802cdec019a5fd705e
Author: sunnavy <sunnavy@bestpractical.com>
Date: Thu Apr 19 01:38:36 2012 +0800

show CreateTicket widget only if user can create ticket

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index f65f909..be2674b 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -811,7 +811,20 @@ my $build_main_nav = sub {
}

PageWidgets()->child( simple_search => raw_html => $m->scomp('SimpleSearch') );
- PageWidgets()->child( create_ticket => raw_html => $m->scomp('CreateTicket') );
+
+ my $can_create_ticket;
+ my $queues = RT::Queues->new( $session{'CurrentUser'} );
+ $queues->UnLimit;
+
+ while ( my $queue = $queues->Next ) {
+ next unless $queue->CurrentUserHasRight('CreateTicket');
+ $can_create_ticket = 1;
+ last;
+ }
+
+ if ( $can_create_ticket ) {
+ PageWidgets()->child( create_ticket => raw_html => $m->scomp('CreateTicket') );
+ }

$m->callback( CallbackName => 'Privileged' );
};

-----------------------------------------------------------------------
_______________________________________________
Rt-commit mailing list
Rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit