[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. 5e4f91d653e2e017df789585d375450b022304d6

Shawn Moore sartak at bestpractical.com
Fri Feb 11 17:52:26 EST 2011


The branch, master has been updated
       via  5e4f91d653e2e017df789585d375450b022304d6 (commit)
      from  1450e0967f8c7f167b7771d0e45d894e542572d5 (commit)

Summary of changes:
 lib/Jifty/Plugin/RecordHistory/Model/Change.pm |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 5e4f91d653e2e017df789585d375450b022304d6
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Feb 11 17:52:15 2011 -0500

    Need to walk around ACLs for checking rights on ->record

diff --git a/lib/Jifty/Plugin/RecordHistory/Model/Change.pm b/lib/Jifty/Plugin/RecordHistory/Model/Change.pm
index 6d38ca3..01b026b 100644
--- a/lib/Jifty/Plugin/RecordHistory/Model/Change.pm
+++ b/lib/Jifty/Plugin/RecordHistory/Model/Change.pm
@@ -50,6 +50,14 @@ sub deferred_create {
     return $self->{deferred_create} = { @_ };
 }
 
+# a "record" method that walks around ACLs
+sub __record {
+    my $self = shift;
+    my $record = $self->__value('record_class')->new;
+    $record->load($self->__value('record_id'));
+    return $record;
+}
+
 sub record {
     my $self = shift;
     my $record = $self->record_class->new;
@@ -64,7 +72,7 @@ sub delegate_current_user_can {
 
     $right = 'update' if $right ne 'read';
 
-    return $self->record->current_user_can($right);
+    return $self->__record->current_user_can($right);
 }
 
 sub add_change_field {

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list