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:
parent
5e5e3b5359
commit
f80ba6b87c
@ -7,12 +7,22 @@
|
|||||||
$scope.login = {};
|
$scope.login = {};
|
||||||
$scope.subvaults = [];
|
$scope.subvaults = [];
|
||||||
$scope.organizations = [];
|
$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);
|
$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) {
|
if (profile && profile.organizations) {
|
||||||
var orgs = [];
|
var orgs = [];
|
||||||
for (var i = 0; i < profile.organizations.length; i++) {
|
for (var i = 0; i < profile.organizations.length; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user