Repository navigation
services authorizationService
Baasic Authorization Service provides an easy way to consume Baasic Application Authorization REST API end-points.
Gets the currently logged in user.
Example:
baasicAuthorizationService.getUser();Sets the current user information. If no user information is provided, the user information will be cleared from the storage and rootScope.
Example:
baasicAuthorizationService.setUser(null);Updates current user information with new data.
Example:
baasicLoginService.loadUserData()
.success(function (data) {
// Update user information with refreshed data
baasicAuthorizationService.updateUser(data);
})
.error(function (data) {})
.finally (function () {}); Retrives current user's access token.
Example:
baasicAuthorizationService.getAccessToken();Stores access token information.
Example:
baasicLoginService.login({
username : '<username>',
password : '<password>',
options : ['session', 'sliding']
})
.success(function (data) {
// Store token information
baasicAuthorizationService.updateAccessToken(data);
})
.error(function (data, status) {})
.finally (function () {}); Retrives user permission hash. This action should be performed when user information is updated.
Example:
baasicLoginService.loadUserData()
.success(function (data) {
baasicAuthorizationService.resetPermissions();
baasicAuthorizationService.updateUser(data);
})
.error(function (data) {})
.finally (function () {}); Checks if current user has permissions to perform a certain action. To optimize performance this information is cached and can be reset using the resetPermissions action. Permissions cache should be reset when updated user information is set.
Example:
baasicAuthorizationService.hasPermission("<baasic-Section>.<action>");