[Jifty-commit] r1821 - jifty/trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Aug 15 21:18:56 EDT 2006


Author: nelhage
Date: Tue Aug 15 21:18:56 2006
New Revision: 1821

Modified:
   jifty/trunk/lib/Jifty/Record.pm

Log:
Adding a as_superuser method to Jifty::Record to make it easier for
code to briefly dodge around ACLs when needed.

Modified: jifty/trunk/lib/Jifty/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Record.pm	Tue Aug 15 21:18:56 2006
@@ -246,6 +246,22 @@
     $value;
 }
 
+=head2 as_superuser
+
+Returns a copy of this object with the current_user set to the
+superuser. This is a convenient way to duck around ACLs if you have
+code that needs to for some reason or another.
+
+=cut
+
+sub as_superuser {
+    my $self = shift;
+
+    my $clone = $self->new(current_user => $self->current_user->superuser);
+    $clone->load($self->id);
+    return $clone;
+}
+
 
 =head2 _collection_value METHOD
 


More information about the Jifty-commit mailing list