Show iam filter for machines
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

master
Garrett Mills 3 years ago
parent 64ad8931f3
commit 0844da594e
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

@ -89,6 +89,7 @@ class AppResource extends CRUDBase {
field: 'id',
type: 'text',
readonly: true,
hidden: ['insert'],
help: `(LDAP use) Allows restricting users to only those that can access this application. (filter: iamTarget)`,
},
{

@ -88,8 +88,17 @@ class MachineResource extends CRUDBase {
field: 'id',
type: 'text',
readonly: true,
hidden: ['insert'],
help: `(LDAP use) Allows restricting users to only those that can access this computer. (filter: iamTarget)`,
},
{
name: 'IAM Filter',
field: 'iam_filter',
type: 'text',
readonly: true,
hidden: ['insert'],
help: `(LDAP use) Use this filter to restrict access to only users granted IAM access to this computer.`,
},
],
}
}

@ -76,6 +76,7 @@ class MachineGroupResource extends CRUDBase {
field: 'id',
type: 'text',
readonly: true,
hidden: ['insert'],
help: `(LDAP use) Allows restricting users to only those that can access this computer group. (filter: iamTarget)`,
},
{

@ -20,6 +20,12 @@ class MachineModel extends Model {
}
async to_api() {
let iam_filter = `(|(iamTarget=${this.id})`
for ( const group of (await this.groups()) ) {
iam_filter += `(iamTarget=${group.id})`
}
iam_filter += ')'
return {
id: this.id,
name: this.name,
@ -27,9 +33,18 @@ class MachineModel extends Model {
host_name: this.host_name,
location: this.location,
ldap_visible: this.ldap_visible,
iam_filter,
}
}
async groups() {
const MachineGroup = this.models.get('ldap:MachineGroup')
return MachineGroup.find({
machine_ids: this.id,
active: true
})
}
async set_bind_password(password) {
this.bind_password = await bcrypt.hash(password, 10)
return this

Loading…
Cancel
Save