7-retrieve-patron-fails-to-load-patron-record
authorJason Etheridge <jason@EquinoxInitiative.org>
Wed, 18 Jul 2018 05:41:59 +0000 (01:41 -0400)
committerJason Etheridge <jason@EquinoxInitiative.org>
Wed, 18 Jul 2018 05:41:59 +0000 (01:41 -0400)
give the user_request.view permission some parity with VIEW_USER

And some defensive programming if trying to create a request in
the user already known context without adequate permission

Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Open-ILS/examples/fm_IDL.xml
Open-ILS/web/js/ui/default/staff/acq/services/requests.js

index d8e77e2..de5ddab 100644 (file)
@@ -3506,7 +3506,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
                        <actions>
-                               <retrieve permission="VIEW_USER" context_field="home_ou" />
+                               <retrieve permission="VIEW_USER user_request.view" context_field="home_ou" />
                        </actions>
                </permacrud>
        </class>
@@ -6669,7 +6669,7 @@ SELECT  usr,
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
                        <actions>
-                               <retrieve permission="VIEW_USER">
+                               <retrieve permission="VIEW_USER user_request.view">
                                        <context link="usr" field="home_ou" />
                                </retrieve>
                        </actions>
index a9fbbdc..f44e9d9 100644 (file)
@@ -342,30 +342,32 @@ function($uibModal , $q , egCore , egOrg , ngToast) {
                                 },
                                 { atomic : true }
                             ).then(function(users) {
-                                var usr = egCore.idl.toHash(users[0]);
-                                aur_obj.usr = usr.id;
-                                aur_obj.pickup_lib = egCore.idl.toHash(
-                                    egOrg.get(usr.home_ou.id)
-                                );
-                                aur_obj.phone_notify = usr.day_phone;
-                                angular.forEach(usr.settings, function(s) {
-                                    if (s.name == 'opac.hold_notify') {
-                                        if (s.value.match('phone')) {
-                                            extra.phone_notify = true;
+                                if (users.length > 0) {
+                                    var usr = egCore.idl.toHash(users[0]);
+                                    aur_obj.usr = usr.id;
+                                    aur_obj.pickup_lib = egCore.idl.toHash(
+                                        egOrg.get(usr.home_ou.id)
+                                    );
+                                    aur_obj.phone_notify = usr.day_phone;
+                                    angular.forEach(usr.settings, function(s) {
+                                        if (s.name == 'opac.hold_notify') {
+                                            if (s.value.match('phone')) {
+                                                extra.phone_notify = true;
+                                            }
+                                            if (s.value.match('email')) {
+                                                aur_obj.email_notify = true;
+                                            }
                                         }
-                                        if (s.value.match('email')) {
-                                            aur_obj.email_notify = true;
+                                        if (s.name == 'opac.default_phone') {
+                                            aur_obj.phone_notify = s.value.replace(/^"/,'').replace(/"$/,'');
                                         }
-                                    }
-                                    if (s.name == 'opac.default_phone') {
-                                        aur_obj.phone_notify = s.value.replace(/^"/,'').replace(/"$/,'');
-                                    }
-                                    if (s.name == 'opac.default_pickup_location') {
-                                        aur_obj.pickup_lib = egCore.idl.toHash(
-                                            egOrg.get(s.value)
-                                        );
-                                    }
-                                });
+                                        if (s.name == 'opac.default_pickup_location') {
+                                            aur_obj.pickup_lib = egCore.idl.toHash(
+                                                egOrg.get(s.value)
+                                            );
+                                        }
+                                    });
+                                }
                                 return { 'request' : aur_obj, 'extra' : extra };
                             });
                         } else {