[open-ils-commits] r16304 - trunk/Open-ILS/src/perlmods/OpenILS/Application (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Apr 26 11:16:16 EDT 2010
Author: erickson
Date: 2010-04-26 11:16:13 -0400 (Mon, 26 Apr 2010)
New Revision: 16304
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
Added an API call which returns the set of opt-in user settings for all event-defs in a given org unit range. open-ils.actor.event_def.opt_in.settings
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2010-04-26 14:37:59 UTC (rev 16303)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2010-04-26 15:16:13 UTC (rev 16304)
@@ -3934,4 +3934,61 @@
return 1;
}
+
+
+__PACKAGE__->register_method(
+ method => "event_def_opt_in_settings",
+ api_name => "open-ils.actor.event_def.opt_in.settings",
+ stream => 1,
+ signature => {
+ desc => 'Streams the set of "cust" objects that are used as opt-in settings for event definitions',
+ params => [
+ { desc => 'Authentication token', type => 'string'},
+ {
+ desc => 'Org Unit ID. (optional). If no org ID is present, the home_ou of the requesting user is used',
+ type => 'number'
+ },
+ ],
+ return => {
+ desc => q/set of "cust" objects that are used as opt-in settings for event definitions at the specified org unit/,
+ type => 'object',
+ class => 'cust'
+ }
+ }
+);
+
+sub event_def_opt_in_settings {
+ my($self, $conn, $auth, $org_id) = @_;
+ my $e = new_editor(authtoken => $auth);
+ return $e->event unless $e->checkauth;
+
+ if(defined $org_id and $org_id != $e->requestor->home_ou) {
+ return $e->event unless
+ $e->allowed(['VIEW_USER_SETTING_TYPE', 'ADMIN_USER_SETTING_TYPE'], $org_id);
+ } else {
+ $org_id = $e->requestor->home_ou;
+ }
+
+ # find all config.user_setting_type's related to event_defs for the requested org unit
+ my $types = $e->json_query({
+ select => {cust => ['name']},
+ from => {atevdef => 'cust'},
+ where => {
+ '+atevdef' => {
+ owner => $U->get_org_ancestors($org_id), # context org plus parents
+ active => 't'
+ }
+ }
+ });
+
+ if(@$types) {
+ $conn->respond($_) for
+ @{$e->search_config_usr_setting_type({name => [map {$_->{name}} @$types]})};
+ }
+
+ return undef;
+}
+
+
+
1;
More information about the open-ils-commits
mailing list