Closed oleg-demkovych closed 7 years ago
I am also facing exactly the same issue........Please help
@olegdemkovych Can you send more complete permission tree? Tests have passed, but maybe I missed a case.
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 =>
Exactly the same thing is happening to me.
Gotta think how to solve this issue. Eventually this will land as improvement in ui-router.
I have 2 states: users:
details:
When i login, i have permission canView. When i try open details state from users, i have error from ui-router: