New users.resource
This commit is contained in:
@@ -46,15 +46,15 @@ function entityResource($q, $http, umbRequestHelper) {
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.contentResource#getByIds
|
||||
* @methodOf umbraco.resources.contentResource
|
||||
* @name umbraco.resources.entityResource#getByIds
|
||||
* @methodOf umbraco.resources.entityResource
|
||||
*
|
||||
* @description
|
||||
* Gets an array of content items, given a collection of ids
|
||||
* Gets an array of entities, given a collection of ids
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* contentResource.getByIds( [1234,2526,28262])
|
||||
* entityResource.getByIds( [1234,2526,28262])
|
||||
* .then(function(contentArray) {
|
||||
* var myDoc = contentArray;
|
||||
* alert('they are here!');
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name umbraco.resources.userResource
|
||||
* @description Retrives user data from the server, cannot be used for authentication, for this, use the user.service
|
||||
*
|
||||
*
|
||||
**/
|
||||
function userResource($q, $http, umbRequestHelper) {
|
||||
|
||||
//the factory object returned
|
||||
return {
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.userResource#getById
|
||||
* @methodOf umbraco.resources.userResource
|
||||
*
|
||||
* @description
|
||||
* Gets a user with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* userResource.getById(1234)
|
||||
* .then(function(ent) {
|
||||
* var myUser = ent;
|
||||
* alert('im here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id id of user to return
|
||||
* @returns {Promise} resourcePromise object containing the user.
|
||||
*
|
||||
*/
|
||||
getById: function (id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"userApiBaseUrl",
|
||||
"GetById",
|
||||
[{ id: id }])),
|
||||
'Failed to retreive user data for id ' + id);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.userResource#getAll
|
||||
* @methodOf umbraco.resources.userResource
|
||||
*
|
||||
* @description
|
||||
* Gets all users available on the system
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* contentResource.getAll()
|
||||
* .then(function(userArray) {
|
||||
* var myUsers = userArray;
|
||||
* alert('they are here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @returns {Promise} resourcePromise object containing the user array.
|
||||
*
|
||||
*/
|
||||
getAll: function () {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"userApiBaseUrl",
|
||||
"GetAll")),
|
||||
'Failed to retreive all users');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('umbraco.resources').factory('userResource', userResource);
|
||||
Reference in New Issue
Block a user