[Rt-commit] r18351 - rt/3.8/trunk/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Thu Feb 12 16:11:04 EST 2009


Author: ruz
Date: Thu Feb 12 16:11:00 2009
New Revision: 18351

Modified:
   rt/3.8/trunk/lib/RT/CustomField_Overlay.pm

Log:
* add methods to deal with context objects on CFs
* add ACL equivalence for CFs via context

Modified: rt/3.8/trunk/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/CustomField_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/CustomField_Overlay.pm	Thu Feb 12 16:11:00 2009
@@ -653,8 +653,6 @@
 
 # }}}
 
-# {{{ sub CurrentUserHasRight
-
 =head2 CurrentUserHasRight RIGHT
 
 Helper function to call the custom field's queue's CurrentUserHasRight with the passed in args.
@@ -671,8 +669,39 @@
     );
 }
 
-# }}}
+=head2 ACLEquivalenceObjects
+
+Returns list of objects via which users can get rights on this custom field. For custom fields
+these objects can be set using L<ContextObject|/"ContextObject and SetContextObject">.
+
+=cut
+
+sub ACLEquivalenceObjects {
+    my $self = shift;
+
+    my $ctx = $self->ContextObject
+        or return;;
+    return ($ctx, $ctx->ACLEquivalenceObjects);
+}
 
+=head2 ContextObject and SetContextObject
+
+Set or get a context for this object. It can be ticket, queue or another object
+this CF applies to. Used for ACL control, for example SeeCustomField can be granted on
+queue level to allow people to see all fields applied to the queue.
+
+=cut
+
+sub SetContextObject {
+    my $self = shift;
+    return $self->{'context_object'} = shift;
+}
+  
+sub ContextObject {
+    my $self = shift;
+    return $self->{'context_object'};
+}
+  
 # {{{ sub _Set
 
 sub _Set {


More information about the Rt-commit mailing list