[Jifty-commit] r3562 - in apps/CASPlus/trunk: lib

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Jun 26 09:15:48 EDT 2007


Author: sterling
Date: Tue Jun 26 09:15:47 2007
New Revision: 3562

Modified:
   apps/CASPlus/trunk/   (props changed)
   apps/CASPlus/trunk/lib/CASPlus.pm

Log:
 r7799 at dynpc145:  andrew | 2007-06-26 08:06:21 -0500
 Added an additional action to start() to setup the ModelClass and ModelClassColumn before_access triggers.


Modified: apps/CASPlus/trunk/lib/CASPlus.pm
==============================================================================
--- apps/CASPlus/trunk/lib/CASPlus.pm	(original)
+++ apps/CASPlus/trunk/lib/CASPlus.pm	Tue Jun 26 09:15:47 2007
@@ -99,6 +99,7 @@
     my $self = shift;
 
     $self->setup_ticket_defaults;
+    $self->add_database_backed_model_triggers;
 }
 
 =head2 setup_ticket_defaults
@@ -126,6 +127,38 @@
     }
 }
 
+=head2 add_database_backed_model_triggers
+
+Adds C<before_access> triggers to L<Jifty::Model::ModelClass> and L<Jifty::Model::ModelClassColumn>.
+
+=cut
+
+sub add_database_backed_model_triggers {
+    Jifty::Model::ModelClass->add_trigger(
+        before_access => sub {
+            my ($self, $right) = @_;
+
+            if ($right eq 'read') {
+                return 'allow';
+            }
+
+            return undef;
+        },
+    );
+
+    Jifty::Model::ModelClassColumn->add_trigger(
+        before_access => sub {
+            my ($self, $right) = @_;
+
+            if ($right eq 'read') {
+                return 'allow';
+            }
+
+            return undef;
+        },
+    );
+}
+
 =head2 get_profile_object_by_unique_id
 
   my $profile_obj = CASPlus->get_profile_object_by_unique_id($unique_id);


More information about the Jifty-commit mailing list