Show privileges manager if protection not set up
This commit is contained in:
@@ -415,6 +415,13 @@ angular.module('app')
|
||||
this.toggleProtectNote = function() {
|
||||
this.note.content.protected = !this.note.content.protected;
|
||||
this.changesMade({dontUpdateClientModified: true, dontUpdatePreviews: true});
|
||||
|
||||
// Show privilegesManager if Protection is not yet set up
|
||||
privilegesManager.actionHasPrivilegesConfigured(PrivilegesManager.ActionViewProtectedNotes).then((configured) => {
|
||||
if(!configured) {
|
||||
privilegesManager.presentPrivilegesManagementModal();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.toggleNotePreview = function() {
|
||||
|
||||
@@ -30,12 +30,12 @@ class PrivilegesManager {
|
||||
PrivilegesManager.SessionLengthOneWeek = 604800;
|
||||
|
||||
this.availableActions = [
|
||||
PrivilegesManager.ActionManagePrivileges,
|
||||
PrivilegesManager.ActionManageExtensions,
|
||||
PrivilegesManager.ActionManageBackups,
|
||||
PrivilegesManager.ActionManagePasscode,
|
||||
PrivilegesManager.ActionViewProtectedNotes,
|
||||
PrivilegesManager.ActionDeleteNote
|
||||
PrivilegesManager.ActionDeleteNote,
|
||||
PrivilegesManager.ActionManagePasscode,
|
||||
PrivilegesManager.ActionManageBackups,
|
||||
PrivilegesManager.ActionManageExtensions,
|
||||
PrivilegesManager.ActionManagePrivileges,
|
||||
]
|
||||
|
||||
this.availableCredentials = [
|
||||
@@ -249,6 +249,10 @@ class PrivilegesManager {
|
||||
}
|
||||
}
|
||||
|
||||
async actionHasPrivilegesConfigured(action) {
|
||||
return (await this.netCredentialsForAction(action)).length > 0;
|
||||
}
|
||||
|
||||
async actionRequiresPrivilege(action) {
|
||||
let expiresAt = await this.getSessionExpirey();
|
||||
if(expiresAt > new Date()) {
|
||||
|
||||
Reference in New Issue
Block a user