adding patch to make Evergreen respect BAR_PATRON/UNBAR_PATRON perms.
authorChris Sharp <csharp@georgialibraries.org>
Mon, 2 Apr 2012 10:59:55 +0000 (06:59 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 2 Apr 2012 10:59:55 +0000 (06:59 -0400)
Open-ILS/web/js/ui/default/actor/user/register.js

index f74b110..ee1476e 100644 (file)
@@ -226,6 +226,8 @@ function load() {
     loadSurveys();
     checkClaimsReturnCountPerm();
     checkClaimsNoCheckoutCountPerm();
+    checkBarPatronPerm();
+    checkUnBarPatronPerm();
 
     dojo.connect(replaceBarcode, 'onClick', replaceCardHandler);
     dojo.connect(allCards, 'onClick', drawAllCards);
@@ -889,6 +891,41 @@ function checkClaimsReturnCountPerm() {
     );
 }
 
+/**
+ * if the user does not have the BAR_PATRON/UNBAR_PATRON perm
+ * This function checks the perm and disable/enables the widget.
+ */
+
+function checkBarPatronPerm() {
+    new openils.User().getPermOrgList(
+        'BAR_PATRON',
+        function(orgList) {
+            var cr = findWidget('au', 'barred');
+            if(orgList.indexOf(patron.home_ou()) == -1)
+                cr.widget.attr('disabled', true);
+            else
+                cr.widget.attr('disabled', false);
+        },
+        true,
+        true
+    );
+}
+function checkUnBarPatronPerm(){
+    new openils.User().getPermOrgList(
+        'UNBAR_PATRON',
+        function(orgList) {
+            var cr = findWidget('au', 'barred');
+            if(orgList.indexOf(patron.home_ou()) == -1)
+                cr.widget.attr('disabled', true);
+            else
+                cr.widget.attr('disabled', false);
+        },
+        true,
+        true
+    );
+}
+
+
 
 function checkClaimsNoCheckoutCountPerm() {
     new openils.User().getPermOrgList(