1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

share promises and readonly check

This commit is contained in:
Kyle Spearrin 2017-03-25 11:41:06 -04:00
parent 5e5e3b5359
commit f80ba6b87c

View File

@ -7,12 +7,22 @@
$scope.login = {};
$scope.subvaults = [];
$scope.organizations = [];
$scope.readOnly = false;
apiService.logins.get({ id: loginId }, function (login) {
apiService.logins.get({ id: loginId }).$promise.then(function (login) {
$scope.readOnly = !login.Edit;
if (login.Edit) {
$scope.login = cipherService.decryptLogin(login);
});
}
authService.getUserProfile().then(function (profile) {
return login.Edit;
}).then(function (canEdit) {
if (!canEdit) {
return;
}
return authService.getUserProfile();
}).then(function (profile) {
if (profile && profile.organizations) {
var orgs = [];
for (var i = 0; i < profile.organizations.length; i++) {