[open-ils-commits] r8781 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 19 15:30:29 EST 2008
Author: erickson
Date: 2008-02-19 15:00:10 -0500 (Tue, 19 Feb 2008)
New Revision: 8781
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm
Log:
gave the objects_allowed method the ability to check a list of perms
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm 2008-02-19 19:59:19 UTC (rev 8780)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm 2008-02-19 20:00:10 UTC (rev 8781)
@@ -442,24 +442,30 @@
sub objects_allowed {
my($self, $perm, $obj_type) = @_;
- my $query = {
- select => {puopm => ['object_id']},
- from => {
- puopm => {
- ppl => {field => 'id',fkey => 'perm'}
+ my $perms = (ref($perm) eq 'ARRAY') ? $perm : [$perm];
+ my @ids;
+
+ for $perm (@$perms) {
+ my $query = {
+ select => {puopm => ['object_id']},
+ from => {
+ puopm => {
+ ppl => {field => 'id',fkey => 'perm'}
+ }
+ },
+ where => {
+ '+puopm' => {usr => $self->requestor->id, object_type => $obj_type},
+ '+ppl' => {code => $perm}
}
- },
- where => {
- '+puopm' => {usr => $self->requestor->id, object_type => $obj_type},
- '+ppl' => {code => $perm}
- }
- };
+ };
+
+ my $list = $self->json_query($query);
+ push(@ids, 0+$_->{object_id}) for @$list;
+ }
- my $list = $self->json_query($query);
- my @ids;
- push(@ids, 0+$_->{object_id}) for @$list;
-
- return \@ids;
+ my %trim
+ $trim{$_} = 1 for @ids;
+ return keys %trim;
}
More information about the open-ils-commits
mailing list