Add basic logic for managing vaults
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
2021-04-15 15:34:13 -05:00
parent 5391c7c6d6
commit 3730ddc2f2
11 changed files with 399 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ class PolicyModel extends Model {
entity_type: String, // user | group
entity_id: String,
access_type: String, // allow | deny
target_type: { type: String, default: 'application' }, // application | api_scope | machine | machine_group
target_type: { type: String, default: 'application' }, // application | api_scope | machine | machine_group | vault
target_id: String,
active: { type: Boolean, default: true },
for_permission: { type: Boolean, default: false },
@@ -209,6 +209,10 @@ class PolicyModel extends Model {
const MachineGroup = this.models.get('ldap:MachineGroup')
const group = await MachineGroup.findById(this.target_id)
target_display = `Computer Group: ${group.name} (${group.machine_ids.length} computers)`
} else if ( this.target_type === 'vault' ) {
const Vault = this.models.get('vault:Vault')
const vault = await Vault.findById(this.target_id)
target_display = `Vault: ${vault.name}`
}
return {