[open-ils-commits] r8347 - trunk/Open-ILS/src/perlmods/OpenILS/Utils
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jan 7 18:40:22 EST 2008
Author: erickson
Date: 2008-01-07 18:16:02 -0500 (Mon, 07 Jan 2008)
New Revision: 8347
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm
Log:
plugged in new permission checking call which uses cstore instead of storage
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm 2008-01-07 22:19:44 UTC (rev 8346)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm 2008-01-07 23:16:02 UTC (rev 8347)
@@ -357,6 +357,7 @@
# If this perm at the given org has already been verified, true is returned
# and the perm is not re-checked
# -----------------------------------------------------------------------------
+=head
sub allowed {
my( $self, $perm, $org ) = @_;
my $uid = $self->requestor->id;
@@ -365,7 +366,41 @@
return 1 if $self->perm_checked($perm, $org);
return $self->checkperm($uid, $org, $perm);
}
+=cut
+my $PERM_QUERY = {
+ select => {
+ au => [ {
+ transform => 'permission.usr_has_perm',
+ alias => 'has_perm',
+ column => 'id',
+ params => []
+ } ]
+ },
+ from => 'au',
+ where => {},
+};
+
+sub allowed {
+ my( $self, $perm, $org ) = @_;
+ my $uid = $self->requestor->id;
+ $org ||= $self->requestor->ws_ou;
+ $self->log(I, "checking perms user=$uid, org=$org, perm=$perm");
+
+ # fill in the search hash
+ $PERM_QUERY->{select}->{au}->[0]->{params} = [$perm, $org];
+ $PERM_QUERY->{where}->{id} = $uid;
+
+ return 1 if $U->is_true($self->json_query($PERM_QUERY)->[0]->{has_perm});
+
+ # set the perm failure event if the permission check returned false
+ my $e = OpenILS::Event->new('PERM_FAILURE', ilsperm => $perm, ilspermloc => $org);
+ $self->event($e);
+ return undef;
+
+}
+
+=head
sub checkperm {
my($self, $userid, $org, $perm) = @_;
my $s = $U->storagereq(
@@ -379,6 +414,7 @@
return 1;
}
+=cut
More information about the open-ils-commits
mailing list