import CRUDBase from '../CRUDBase.js' import { session } from '../../service/Session.service.js' class ClientResource extends CRUDBase { endpoint = '/api/v1/ldap/clients' required_fields = ['name', 'uid', 'password'] permission_base = 'v1:ldap:clients' item = 'LDAP Client' plural = 'LDAP Clients' async server_config() { const results = await axios.get('/api/v1/ldap/config') if ( results && results.data && results.data.data ) return results.data.data } listing_definition = { display: ` LDAP Clients are special user accounts that external applications can use to bind to ${session.get('app.name')}'s built-in LDAP server to allow these applications to authenticate users.

These special accounts are permitted to bind to the LDAP server, but are not allowed to sign-in to ${session.get('app.name')}. `, columns: [ { name: 'Client Name', field: 'name', }, { name: 'User ID', field: 'uid', }, ], 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, }, ], } form_definition = { fields: [ { name: 'Provider Name', field: 'name', placeholder: 'Awesome External App', required: true, type: 'text', }, { name: 'User ID', field: 'uid', placeholder: 'some_username', required: true, type: 'text', }, { name: 'Password', field: 'password', required: ['insert'], type: 'password', }, ], } } const ldap_client = new ClientResource() export { ldap_client }