Update with latest SNJS changes

This commit is contained in:
Mo Bitar
2020-03-01 16:12:29 -06:00
parent fc88ab9b2b
commit 444c18bbde
27 changed files with 192 additions and 104131 deletions

View File

@@ -287,7 +287,7 @@ class AccountMenuCtrl extends PureCtrl {
const run = () => {
this.godService.presentPrivilegesManagementModal();
};
const needsPrivilege = await this.application.privilegesManager.actionRequiresPrivilege(
const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege(
ProtectedActions.ManagePrivileges
);
if (needsPrivilege) {
@@ -364,7 +364,7 @@ class AccountMenuCtrl extends PureCtrl {
await this.performImport(data, null);
}
};
const needsPrivilege = await this.application.privilegesManager.actionRequiresPrivilege(
const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege(
ProtectedActions.ManageBackups
);
if (needsPrivilege) {
@@ -447,7 +447,7 @@ class AccountMenuCtrl extends PureCtrl {
await this.lockManager.setAutoLockInterval(interval);
this.reloadAutoLockInterval();
};
const needsPrivilege = await this.application.privilegesManager.actionRequiresPrivilege(
const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege(
ProtectedActions.ManagePasscode
);
if (needsPrivilege) {
@@ -493,7 +493,7 @@ class AccountMenuCtrl extends PureCtrl {
this.state.formData.changingPasscode = true;
this.addPasscodeClicked();
};
const needsPrivilege = await this.application.privilegesManager.actionRequiresPrivilege(
const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege(
ProtectedActions.ManagePasscode
);
if (needsPrivilege) {
@@ -521,7 +521,7 @@ class AccountMenuCtrl extends PureCtrl {
}
});
};
const needsPrivilege = await this.application.privilegesManager.actionRequiresPrivilege(
const needsPrivilege = await this.application.privilegesService.actionRequiresPrivilege(
ProtectedActions.ManagePasscode
);
if (needsPrivilege) {

View File

@@ -14,14 +14,14 @@ class PrivilegesAuthModalCtrl {
$onInit() {
this.authParameters = {};
this.sessionLengthOptions = this.application.privilegesManager.getSessionLengthOptions();
this.application.privilegesManager.getSelectedSessionLength()
this.sessionLengthOptions = this.application.privilegesService.getSessionLengthOptions();
this.application.privilegesService.getSelectedSessionLength()
.then((length) => {
this.$timeout(() => {
this.selectedSessionLength = length;
});
});
this.application.privilegesManager.netCredentialsForAction(this.action)
this.application.privilegesService.netCredentialsForAction(this.action)
.then((credentials) => {
this.$timeout(() => {
this.requiredCredentials = credentials.sort();
@@ -34,7 +34,7 @@ class PrivilegesAuthModalCtrl {
}
promptForCredential(credential) {
return this.application.privilegesManager.displayInfoForCredential(credential).prompt;
return this.application.privilegesService.displayInfoForCredential(credential).prompt;
}
cancel() {
@@ -67,13 +67,13 @@ class PrivilegesAuthModalCtrl {
if (!this.validate()) {
return;
}
const result = await this.application.privilegesManager.authenticateAction(
const result = await this.application.privilegesService.authenticateAction(
this.action,
this.authParameters
);
this.$timeout(() => {
if (result.success) {
this.application.privilegesManager.setSessionLength(this.selectedSessionLength);
this.application.privilegesService.setSessionLength(this.selectedSessionLength);
this.onSuccess();
this.dismiss();
} else {

View File

@@ -24,7 +24,7 @@ class PrivilegesManagementModalCtrl extends PureCtrl {
}
displayInfoForCredential(credential) {
const info = this.application.privilegesManager.displayInfoForCredential(credential);
const info = this.application.privilegesService.displayInfoForCredential(credential);
if (credential === PrivilegeCredentials.LocalPasscode) {
info.availability = this.hasPasscode;
} else if (credential === PrivilegeCredentials.AccountPassword) {
@@ -36,7 +36,7 @@ class PrivilegesManagementModalCtrl extends PureCtrl {
}
displayInfoForAction(action) {
return this.application.privilegesManager.displayInfoForAction(action).label;
return this.application.privilegesService.displayInfoForAction(action).label;
}
isCredentialRequiredForAction(action, credential) {
@@ -47,21 +47,21 @@ class PrivilegesManagementModalCtrl extends PureCtrl {
}
async clearSession() {
await this.application.privilegesManager.clearSession();
await this.application.privilegesService.clearSession();
this.reloadPrivileges();
}
async reloadPrivileges() {
this.availableActions = this.application.privilegesManager.getAvailableActions();
this.availableCredentials = this.application.privilegesManager.getAvailableCredentials();
const sessionEndDate = await this.application.privilegesManager.getSessionExpirey();
this.availableActions = this.application.privilegesService.getAvailableActions();
this.availableCredentials = this.application.privilegesService.getAvailableCredentials();
const sessionEndDate = await this.application.privilegesService.getSessionExpirey();
this.sessionExpirey = sessionEndDate.toLocaleString();
this.sessionExpired = new Date() >= sessionEndDate;
this.credentialDisplayInfo = {};
for (const cred of this.availableCredentials) {
this.credentialDisplayInfo[cred] = this.displayInfoForCredential(cred);
}
const privs = await this.application.privilegesManager.getPrivileges();
const privs = await this.application.privilegesService.getPrivileges();
this.$timeout(() => {
this.privileges = privs;
});
@@ -69,7 +69,7 @@ class PrivilegesManagementModalCtrl extends PureCtrl {
checkboxValueChanged(action, credential) {
this.privileges.toggleCredentialForAction(action, credential);
this.application.privilegesManager.savePrivileges();
this.application.privilegesService.savePrivileges();
}
cancel() {