Skip to content

kidstuff/auth-angular-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

auth-angular-client

AngularJS client lib for kidstuff/auth REST API

Dependencies

Config

app = angular.module('app', ['kidstuff.auth']);
app.config([authProvider', function(authProvider) 
	authProvider.setEndPoint('http://example.com/auth');
}]);

API Reference

Methods

isLoged

isLoged() return boolean

currentUser

currentUser() return User obejct

login

login(email string, password string, success callback(data), error callback(error))
Example:

app.controller('LoginController', ['$scope', 'auth', function($scope, auth) {
	$scope.user = {};
	if(auth.isLoged()) {
		// warrning
	}

	$scope.submit = function() {
		auth.login($scope.user.Email, $scope.user.Pwd, function(data) {
			// show success message
		}, function(err) {
			// log error
		});
	}
}]);

setLoged

setLoged(token string, expired RFC 3999 string, user_object_)

logout

logout()

getUser

getUser(id string, success callback(data), error callback(error))

createUser

createUser(userInfo object, success callback(data), error callback(error))

removeUser

removeUser(userId string, success callback(data), error callback(error))

updateUserProfile

updateUserProfile(id string, profile object, success callback(data), error callback(error))

updateUserApproval

updateUserApproval(id string, approve boolean, success callback(data), error callback(error))

listUser

listUser(params object, success callback(data), error callback(error))

removeUserGroup

removeUserGroup(userId string, groupId string, success callback(data), error callback(error))

addUserGroup

addUserGroup(userId string, groupId string, success callback(data), error callback(error))

listGroup

listGroup(params object, success callback(data), error callback(error))

createGroup

createGroup(group object, success callback(data), error callback(error))

getGroup

getGroup(id string, success callback(data), error callback(error))

updateGroup

updateGroup(group object, success callback(data), error callback(error))

removeGroup

removeGroup(id string, success callback(data), error callback(error))

updateSettings

updateSettings(settings object, success callback(data), error callback(error))

getSettings

getSettings(keys array of string, success callback(data), error callback(error))

Example:

keys = ["key1", "key2", "key3"];
auth.getSettings(keys, function(settings) {
	// console.log(settings)
	// Object {key1: "val1", key2: "val2", key2: "val3"}
}, function(err) {

});

removeSettings

removeSettings(keys array of string, success callback(data), error callback(error))

About

AngularJS client lib for kidstuff/auth rest inteface

Resources

License

Stars

Watchers

Forks

Packages

No packages published