Async permissions definition
See original GitHub issueHi,
I have a little problem: I have to update permissions after call an async request to the server, how should I do?
I have this permissions definition:
// GUEST
PermissionStore
.definePermission(USER_ROLES.guest, guest);
function guest(){
if ($rootScope.auth === USER_ROLES.guest || !$rootScope.auth) {
return true;
}
return false;
}
// USER
PermissionStore
.definePermission(USER_ROLES.user, user);
function user(){
if ($rootScope.auth === USER_ROLES.user) {
return true;
}
return false;
}
// ADMIN
PermissionStore
.definePermission(USER_ROLES.admin, admin);
function admin(){
if ($rootScope.auth === USER_ROLES.admin) {
return true;
}
return false;
}
and this is my async factory call to retrieve logged user data (and permission too)
deferred = $q.defer();
var apiUrl = 'http://localhost:8080/authorizer';
$http.post(apiUrl, null, {withCredentials: true})
.then(userLoginSuccess)
.catch(userLoginError);
return deferred.promise;
// success
function userLoginSuccess(response){
deferred.resolve(response);
}
// error
function userLoginError(err){
deferred.reject(err);
}
How can I update permissions? Your documentation isn’t very clear
Issue Analytics
- State:
- Created 8 years ago
- Comments:6
Top Results From Across the Web
async function - JavaScript - MDN Web Docs - Mozilla
The async function declaration declares an async function where the await keyword is permitted within the function body. The async and await ...
Read more >How to change the permissions of a file asynchronously using ...
To change permission on a file asynchronously, you can use the chmod() function from the fs (filesystem) module in Node.js.
Read more >Unblocking clipboard access - web.dev
The Async Clipboard API addresses these issues, providing a well-defined permissions model that doesn't block the page. The Async Clipboard ...
Read more >Asynchronous file access (C#) - Microsoft Learn
Learn how to use the async feature to access files in C#. You can call into asynchronous methods without using callbacks or splitting...
Read more >How to do asynchronous task while defining a permission ...
I'm using angular-permission library along with ui-router and satellizer. Following is the state definition for home . In that I'm checking ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Change success callback and redefine permissions there:
@masterspambot thanks a lot 👍