RafaelVidaurre / angular-permission

Simple route authorization via roles/permissions
MIT License
1.13k stars 212 forks source link

Redirec stuck in $stateChangeStart #373

Closed RudmanMario closed 7 years ago

RudmanMario commented 7 years ago

I have a specific problem. This is the use case:

            .state('A', {
                url: '/A',
                templateUrl: 'app/A.html',
                controller: 'ACtrl',
                data: {
                    permissions: {
                        only: 'canReadAll',
                        redirectTo: 'B'
                    }
                }
            })
            .state('B', {
                url: '/B',
                templateUrl: 'app/B.html',
                controller: 'BCtrl',
                data: {
                    permissions: {
                        only: 'PERM_REPORT_BASIC',
                        redirectTo: 'page404'
                    }
                }
            })

When I'm in the state 'B' and I click ui-sref="A" everything is stuck in $stateChangeStart. So redirecting is stuck when I try to go into same state. Is that a known issue or am I doing something wrong? Thank you.

masterspambot commented 7 years ago

If user from state B does not have canReadAll to access state A is being redirected back to state B 😆

RudmanMario commented 7 years ago

Sorry for the late response. I understand it goes to state B if user does not have canReadAll permission, but the problem is that State Manager is stuck in $stateChangeStart, it never finishes into $stateChangeSuccess or $stateChangeError. Beacuse of that I'm stuck in loading mode.