Creation of aclUsers window

This commit is contained in:
Alexandre Cloutier
2014-09-30 15:17:44 -04:00
parent 22970bd510
commit ee5ef02f50
4 changed files with 254 additions and 31 deletions
@@ -108,4 +108,41 @@
return deferred.promise;
};
/**
* @function fetch
* @desc Fetch resources using a specific object, action and/or parameters
* @param {string} object_id - the object on which the action will be applied (ex: addressbook, calendar)
* @param {string} action - the action to be used in the URL
* @param {string} params - the url parameter
*/
Resource.prototype.fetch = function(object_id, action, params) {
var deferred = this._q.defer();
var object_id_path = object_id ? ("/" + object_id) : "";
var action_path = action ? ("/" + action) : "";
var params_path = params ? ("?" + params) : "";
var path = this._path + object_id_path + action_path + params_path;
this._http
.get(path)
.success(deferred.resolve)
.error(deferred.reject);
return deferred.promise;
};
Resource.prototype.saveAclUsers = function(object_id, action, data) {
var deferred = this._q.defer();
var object_id_path = object_id ? ("/" + object_id) : "";
var action_path = action ? ("/" + action) : "";
var path = this._path + object_id_path + action_path;
this._http
.post(path, data)
.success(deferred.resolve)
.error(deferred.reject);
return deferred.promise;
};
})();