Add basic logic for managing vaults
This commit is contained in:
@@ -66,6 +66,12 @@ export default class SideBarComponent extends Component {
|
||||
type: 'resource',
|
||||
resource: 'iam/Permission',
|
||||
},
|
||||
{
|
||||
text: 'Vaults',
|
||||
action: 'list',
|
||||
type: 'resource',
|
||||
resource: 'vault/Vault',
|
||||
},
|
||||
{
|
||||
text: 'Computers',
|
||||
action: 'list',
|
||||
|
||||
@@ -129,6 +129,7 @@ class PolicyResource extends CRUDBase {
|
||||
{display: 'API Scope', value: 'api_scope'},
|
||||
{display: 'Computer', value: 'machine'},
|
||||
{display: 'Computer Group', value: 'machine_group'},
|
||||
{display: 'Vault', value: 'vault'},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -179,6 +180,18 @@ class PolicyResource extends CRUDBase {
|
||||
},
|
||||
if: (form_data) => form_data.target_type === 'machine_group'
|
||||
},
|
||||
{
|
||||
name: 'Target',
|
||||
field: 'target_id',
|
||||
required: true,
|
||||
type: 'select.dynamic',
|
||||
options: {
|
||||
resource: 'vault/Vault',
|
||||
display: 'name',
|
||||
value: 'id',
|
||||
},
|
||||
if: (form_data) => form_data.target_type === 'vault'
|
||||
},
|
||||
{
|
||||
name: 'Permission',
|
||||
field: 'permission',
|
||||
@@ -243,6 +256,22 @@ class PolicyResource extends CRUDBase {
|
||||
},
|
||||
if: (form_data, opts) => form_data.target_type === 'machine_group' && opts?.length
|
||||
},
|
||||
{
|
||||
name: 'Permission',
|
||||
field: 'permission',
|
||||
required: false,
|
||||
type: 'select.dynamic',
|
||||
options: {
|
||||
resource: 'iam/Permission',
|
||||
display: 'permission',
|
||||
value: 'permission',
|
||||
other_params: {
|
||||
target_type: 'vault',
|
||||
include_unset: true,
|
||||
},
|
||||
},
|
||||
if: (form_data, opts) => form_data.target_type === 'vault' && opts?.length
|
||||
},
|
||||
],
|
||||
/*handlers: {
|
||||
insert: {
|
||||
|
||||
62
app/assets/app/resource/vault/Vault.resource.js
Normal file
62
app/assets/app/resource/vault/Vault.resource.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import CRUDBase from '../CRUDBase.js'
|
||||
|
||||
class VaultResource extends CRUDBase {
|
||||
constructor() {
|
||||
super()
|
||||
|
||||
this.endpoint = '/api/v1/vault/vaults'
|
||||
this.required_fields = ['name']
|
||||
this.permission_base = 'v1:vault:vaults'
|
||||
|
||||
this.item = 'Vault'
|
||||
this.plural = 'Vaults'
|
||||
|
||||
this.listing_definition = {
|
||||
display: `Vaults are encrypted key-value stores that can be managed with IAM and accessed via REST APIs.`,
|
||||
columns: [
|
||||
{
|
||||
name: 'Name',
|
||||
field: 'name',
|
||||
},
|
||||
],
|
||||
actions: [
|
||||
{
|
||||
type: 'resource',
|
||||
position: 'main',
|
||||
action: 'insert',
|
||||
text: 'Create New',
|
||||
color: 'success',
|
||||
},
|
||||
{
|
||||
type: 'resource',
|
||||
position: 'row',
|
||||
action: 'update',
|
||||
icon: 'fa fa-edit',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'resource',
|
||||
position: 'row',
|
||||
action: 'delete',
|
||||
icon: 'fa fa-times',
|
||||
color: 'danger',
|
||||
confirm: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
this.form_definition = {
|
||||
fields: [
|
||||
{
|
||||
name: 'Name',
|
||||
field: 'name',
|
||||
required: true,
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const vault_vault = new VaultResource()
|
||||
export { vault_vault }
|
||||
Reference in New Issue
Block a user