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

organization listing from side menu

This commit is contained in:
Kyle Spearrin
2017-03-29 19:21:06 -04:00
parent 9ab9fcd577
commit af2f7a7a5a
2 changed files with 27 additions and 45 deletions

View File

@@ -4,14 +4,28 @@ angular
.controller('sideNavController', function ($scope, $state, authService) {
$scope.$state = $state;
$scope.params = $state.params;
$scope.orgs = [];
if ($state.includes('backend.org')) {
authService.getUserProfile().then(function (userProfile) {
if (!userProfile.organizations || !($state.params.orgId in userProfile.organizations)) {
return;
}
authService.getUserProfile().then(function (userProfile) {
if (!userProfile.organizations) {
return;
}
if ($state.includes('backend.org') && ($state.params.orgId in userProfile.organizations)) {
$scope.orgProfile = userProfile.organizations[$state.params.orgId];
});
}
}
else {
var orgs = [];
for (var orgId in userProfile.organizations) {
if (userProfile.organizations.hasOwnProperty(orgId)) {
orgs.push(userProfile.organizations[orgId]);
}
}
$scope.orgs = orgs;
}
});
$scope.viewOrganization = function (id) {
$state.go('backend.org.dashboard', { orgId: id });
};
});