You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$stateProvider.state('app.start',{url: '/start',views: {'some@app': {// ble ble ble}},data: {title: 'Start'}});
It inherit perms from state app
Then, we need an authorization for our app, so create an auth state with state auth.login
$stateProvider.state('auth',{abstract: true,data: {permissions: {except: ['user'],redirectTo: 'app.start'}},views: {// bla bla bla}}).state('auth.login',{url: '/login',views: {// bla bla bla},data: {title: 'Login',htmlId: 'extr-page'}});
After this when you point your web browser to the root of the app fe: localhost:1337 they will do an infinite event loop, from state app.start to auth.login and back.
where user is an service with checkSession function that returns promise.
I just debug it, and it looks like it check that user (not logged, anonymous) have an permissions to app.start and he doesn't have of course, then is called state.go (because redirectTo is set up) to auth.login, an event is fired once again (due to my changes in #30 ) and then there are checked perms once again for state auth.login user is not authorizated, but permissions for auth.login is except user, so checkSession returns false, and process of Permission.authorize goes it returns resolve promise, but after this event is fired once again (have no idea why, maybe it's a bug in angular-ui-route [my version is: v0.2.11]). I have also check it on stock version of your code, and it happens exactly the same way.
Anyway, an fix is a remove event.preventDefault() from an your module, I will provide an pull request.
The text was updated successfully, but these errors were encountered:
Hello,
I figure out new problem an infinite loop. When it happen?
Let's say that we have some abstract state app with default permissions for rest of the states
Then create some state fe: app.start
It inherit perms from state app
Then, we need an authorization for our app, so create an auth state with state auth.login
After this when you point your web browser to the root of the app fe: localhost:1337 they will do an infinite event loop, from state app.start to auth.login and back.
How looks a defineRole of the user?:
where user is an service with checkSession function that returns promise.
I just debug it, and it looks like it check that user (not logged, anonymous) have an permissions to app.start and he doesn't have of course, then is called state.go (because redirectTo is set up) to auth.login, an event is fired once again (due to my changes in #30 ) and then there are checked perms once again for state auth.login user is not authorizated, but permissions for auth.login is except user, so checkSession returns false, and process of Permission.authorize goes it returns resolve promise, but after this event is fired once again (have no idea why, maybe it's a bug in angular-ui-route [my version is: v0.2.11]). I have also check it on stock version of your code, and it happens exactly the same way.
Anyway, an fix is a remove event.preventDefault() from an your module, I will provide an pull request.
The text was updated successfully, but these errors were encountered: