[Rt-commit] [svn] r1145 - rt/trunk/lib/RT
alexmv at pallas.eruditorum.org
alexmv at pallas.eruditorum.org
Fri Jun 25 16:09:57 EDT 2004
Author: alexmv
Date: Fri Jun 25 16:09:56 2004
New Revision: 1145
Modified:
rt/trunk/lib/RT/Templates_Overlay.pm
Log:
RT-Ticket: 5201
RT-Status: resolved
RT-Update: correspond
* Provide a Next sub to Templates that checks that the user can see
the template before returning it
Modified: rt/trunk/lib/RT/Templates_Overlay.pm
==============================================================================
--- rt/trunk/lib/RT/Templates_Overlay.pm (original)
+++ rt/trunk/lib/RT/Templates_Overlay.pm Fri Jun 25 16:09:56 2004
@@ -137,5 +137,40 @@
}
# }}}
+# {{{ sub Next
+
+=head2 Next
+
+Returns the next template that this user can see.
+
+=cut
+
+sub Next {
+ my $self = shift;
+
+
+ my $templ = $self->SUPER::Next();
+ if ((defined($templ)) and (ref($templ))) {
+
+ # If it's part of a queue, and the user can read templates in
+ # that queue, or the user can globally read templates, show it
+ if ($templ->Queue && $templ->CurrentUserHasQueueRight('ShowTemplate') or
+ $templ->CurrentUser->HasRight(Object => $RT::System, Right => 'ShowTemplate')) {
+ return($templ);
+ }
+
+ #If the user doesn't have the right to show this template
+ else {
+ return($self->Next());
+ }
+ }
+ #if there never was any template
+ else {
+ return(undef);
+ }
+
+}
+# }}}
+
1;
More information about the Rt-commit
mailing list