Log out and change user, permission doesn't work(solved)
Closed this issue · 1 comments
jfan04 commented
@masterspambot Hi, I am using v2.3.8 for one of Triangular web applications. And I just have this kind of issue that when I logout from User A and login as User B, User service can get User B's info, but permission for view and display are not change, still User A's, until refresh the browser. Do you see these problem before?
function loginClick() {
$global.login(vm.user.email, vm.user.password).then(handleLoginRequestSuccess, handleLoginRequestError)
.then(function(res){
UserService.getCurrentUser();
},1000);
}
function handleLoginRequestSuccess(res) {
var token = res.data ? res.data.access_token : null;
if (token) {
$rootScope.authorities = $global.getAuthorities(token);
$rootScope.currentUserInfo = $global.getCurrentUserInfo(token);
$state.go($rootScope.currentUserInfo.homeState);
}
}
function handleLoginRequestError(res) {
alert("login failed");
}
masterspambot commented
Use ui-router $state
method reload
on your top level state - then all views will update the permission changes.