[Lada-commits] [PATCH 1 of 4] Added helper function to get authorisation information for the current item

Wald Commits scm-commit at wald.intevation.org
Thu Aug 15 14:09:07 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1376568227 -7200
# Node ID 8bc067b5f9c5b1343a911f022b45766b1803a44d
# Parent  2b4ba307dae13a477763b07ecfcb9fd1bd02c5c7
Added helper function to get authorisation information for the current item.

diff -r 2b4ba307dae1 -r 8bc067b5f9c5 app/model/Base.js
--- a/app/model/Base.js	Tue Aug 13 16:22:00 2013 +0200
+++ b/app/model/Base.js	Thu Aug 15 14:03:47 2013 +0200
@@ -12,5 +12,25 @@
      */
     getEidi: function() {
         return "/" + idProperty;
+    },
+    /**
+     * Helper function to make a AJAX request against the authinfo interface
+     * of the server
+     * @param callback function(model, readonly, isowner)
+     * @private
+     */
+    getAuthInfo: function(cb) {
+        Ext.Ajax.request({
+            scope: this,
+            url: 'server/rest/authinfo/' + this.data.probeId,
+            success: function(response, opts) {
+                var obj = Ext.decode(Ext.decode(response.responseText).data);
+                cb(this, obj.readonly, obj.isOwner);
+            },
+            failure: function(response, opts) {
+                console.log('server-side failure with status code ' + response.status);
+                cb(this, true, false);
+            }
+        });
     }
 });


More information about the Lada-commits mailing list