1
0
mirror of https://github.com/bitwarden/web synced 2025-12-13 23:03:18 +00:00

org keys and optimized org profile load for sidenav

This commit is contained in:
Kyle Spearrin
2017-03-06 23:54:06 -05:00
parent b3c8337f83
commit 0ea4b4400f
6 changed files with 84 additions and 14 deletions

View File

@@ -1,17 +1,21 @@
angular
.module('bit.global')
.controller('sideNavController', function ($scope, $state, authService, apiService) {
.controller('sideNavController', function ($scope, $state, authService) {
$scope.$state = $state;
$scope.params = $state.params;
if ($state.includes('backend.user')) {
$scope.userProfile = authService.getUserProfile();
}
else if ($state.includes('backend.org')) {
$scope.orgProfile = {};
apiService.organizations.get({ id: $state.params.orgId }, function (response) {
$scope.orgProfile.name = response.Name;
});
if ($state.includes('backend.org')) {
var userProfile = authService.getUserProfile();
if (!userProfile.organizations.length) {
return;
}
for (var i = 0; i < userProfile.organizations.length; i++) {
if (userProfile.organizations[i].id === $state.params.orgId) {
$scope.orgProfile = userProfile.organizations[i];
break;
}
}
}
});