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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user