[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-204-gf7a09ef
Shawn Moore
sartak at bestpractical.com
Fri Jul 23 20:06:42 EDT 2010
The branch, new-style-templates has been updated
via f7a09efe3c878f094b8bf2255f5d0a5462f24fb8 (commit)
from df4eb51c359a146256de69fe2ea6713640c5e160 (commit)
Summary of changes:
lib/RT/Template_Overlay.pm | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit f7a09efe3c878f094b8bf2255f5d0a5462f24fb8
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Jul 23 19:58:25 2010 -0400
More access control for Full templates
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index b520a62..81c26bf 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -566,4 +566,45 @@ sub CurrentUserHasQueueRight {
return ( $self->QueueObj->CurrentUserHasRight(@_) );
}
+=head2 SetType
+
+If setting Type to Full, require the FullTemplates right on the queue.
+
+=cut
+
+sub SetType {
+ my $self = shift;
+ my $NewType = shift;
+
+ if ($NewType eq 'Full' && !$self->CurrentUser->HasRight(Right => 'FullTemplates', Object => $self->QueueObj) ) {
+ return ( undef, $self->loc('Permission Denied') );
+ }
+
+ return $self->_Set( Field => 'Type', Value => $NewType );
+}
+
+=head2 SetQueue
+
+When changing the queue, make sure the current user has FullTemplates on the
+new queue if the type is Full.
+
+Templates can't change Queue in the UI (yet?).
+
+=cut
+
+sub SetQueue {
+ my $self = shift;
+ my $NewQueue = shift;
+
+ my $NewQueueObj = RT::Queue->new( $self->CurrentUser );
+ $NewQueueObj->Load($NewQueue);
+
+ if ( $self->Type eq 'Full' && !$self->CurrentUser->HasRight(Right => 'FullTemplates', Object => $NewQueueObj) ) {
+ return ( undef, $self->loc('Permission Denied. You do not have FullTemplate on the new queue.') );
+ }
+
+ return $self->_Set( Field => 'Queue', Value => $NewQueueObj->id );
+}
+
+
1;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list