Skip to content

Instantly share code, notes, and snippets.

@sanketmaru
Created October 13, 2014 15:02
Show Gist options
  • Save sanketmaru/d19c237b1d08fd445d09 to your computer and use it in GitHub Desktop.
Save sanketmaru/d19c237b1d08fd445d09 to your computer and use it in GitHub Desktop.
Permission Check
// Permissions.js
canAddFields: function(){
var returnVal = this.checkPermissions('isNotExternalUser','hasAddFieldsAccess');
return returnVal;
},
checkPermissions : function() {
var args = _.toArray(arguments);
var returnargs = _(args).every(lang.hitch(this, function(propName) {
return this[propName].bind(this).call();
}));
return returnargs;
},
hasAddFieldsAccess:function(){
return this.hasAccess(addfieldsAccess);
},
isNotExternalUser:function(){
// some code to check external user
}
// We will call from Fields.js
Permissions.canAddFields();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment