RafaelVidaurre / angular-permission

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

TransitionRejection error with new version and ui-router 1.0.0.rc-1 #418

Closed oleg-demkovych closed 7 years ago

oleg-demkovych commented 7 years ago

I have 2 states: users:

permissions: {
   only: ['canView'],
   redirectTo: 'roles'
}

details:

permissions: {
   only: ['canEdit'],
   redirectTo: 'details'
}

When i login, i have permission canView. When i try open details state from users, i have error from ui-router:

TransitionRejection(type: 2, message: The transition has been superseded by a different transition, detail: Transition#2( 'app.users'{} -> 'app.users'{} ))

ajayngn commented 7 years ago

I am also facing exactly the same issue........Please help

masterspambot commented 7 years ago

@olegdemkovych Can you send more complete permission tree? Tests have passed, but maybe I missed a case.

yaroslavert commented 7 years ago

image

pns2050 commented 7 years ago

Hi,

"angular": "~1.6.4", "angular-ui-router": "~1.0.3",

PermPermissionStore
        .definePermission('isStudent', function () {
            return angular.isDefined(angular.fromJson($sessionStorage.info)) && angular.fromJson($sessionStorage.info).role === 'student';
        });

    PermPermissionStore
        .definePermission('isTeacher', function () {
            return angular.isDefined(angular.fromJson($sessionStorage.info)) && angular.fromJson($sessionStorage.info).role === 'teacher';
        });
    PermPermissionStore
        .definePermission('isAdmin', function () {
            return angular.isDefined(angular.fromJson($sessionStorage.info)) && angular.fromJson($sessionStorage.info).role === 'admin';
        });
$stateProvider.state('platform', {
        url: "/platform",
        templateUrl: "assets/views/app.html",
        abstract: true,
        data: {
            permissions: {
                only: ['isStudent', 'isTeacher', 'isAdmin'],
                redirectTo: 'login.signin'
            }
        }
    })

Visiting /platform without permissions =>

untitled

GabrielGil commented 7 years ago

Exactly the same thing is happening to me.

masterspambot commented 7 years ago

Gotta think how to solve this issue. Eventually this will land as improvement in ui-router.