1
0
mirror of https://github.com/bitwarden/web synced 2025-12-15 07:43:16 +00:00

access control on orgs pages

This commit is contained in:
Kyle Spearrin
2017-03-27 21:55:39 -04:00
parent 77ddc83a04
commit 35e0f27f52
5 changed files with 47 additions and 30 deletions

View File

@@ -232,12 +232,26 @@ angular
event.preventDefault();
$state.go('backend.user.vault');
return;
}
if (!authService.isAuthenticated()) {
event.preventDefault();
authService.logOut();
$state.go('frontend.login.info');
return;
}
// user is guaranteed to be authenticated becuase of previous check
if (toState.name.indexOf('backend.org.') > -1 && toParams.orgId) {
authService.getUserProfile().then(function (profile) {
var orgs = profile.organizations;
if (!orgs || !(toParams.orgId in orgs) || orgs[toParams.orgId].status !== 2 ||
orgs[toParams.orgId].type === 2) {
event.preventDefault();
$state.go('backend.user.vault');
}
});
}
});
});