You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.7 KiB
100 lines
2.7 KiB
import CRUDBase from '../CRUDBase.js'
|
|
|
|
class GroupResource extends CRUDBase {
|
|
endpoint = '/api/v1/ldap/groups'
|
|
required_fields = ['name', 'role']
|
|
permission_base = 'v1:ldap:groups'
|
|
|
|
item = 'LDAP Group'
|
|
plural = 'LDAP Groups'
|
|
|
|
listing_definition = {
|
|
columns: [
|
|
{
|
|
name: 'Group Name',
|
|
field: 'name',
|
|
},
|
|
{
|
|
name: 'Role',
|
|
field: 'role',
|
|
},
|
|
{
|
|
name: '# of Users',
|
|
field: 'user_ids',
|
|
renderer: (user_ids) => Array.isArray(user_ids) ? user_ids.length : 0,
|
|
},
|
|
],
|
|
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 = {
|
|
// back_action: {
|
|
// text: 'Back',
|
|
// action: 'back',
|
|
// },
|
|
fields: [
|
|
{
|
|
name: 'Group Name',
|
|
field: 'name',
|
|
placeholder: 'External App Users',
|
|
required: true,
|
|
type: 'text',
|
|
},
|
|
{
|
|
name: 'Role',
|
|
field: 'role',
|
|
placeholder: 'external_app',
|
|
required: true,
|
|
type: 'select.dynamic',
|
|
options: {
|
|
resource: 'auth/Role',
|
|
display: 'role',
|
|
value: 'role',
|
|
},
|
|
// options: [
|
|
// { value: 1, display: 'One' },
|
|
// { value: 2, display: 'Two' },
|
|
// { value: 3, display: 'Three' },
|
|
// ],
|
|
},
|
|
{
|
|
name: 'Users',
|
|
field: 'user_ids',
|
|
placeholder: 'John Doe',
|
|
type: 'select.dynamic.multiple',
|
|
options: {
|
|
resource: 'auth/User',
|
|
display: (user) => `${user.last_name}, ${user.first_name} (${user.uid})`,
|
|
value: 'id',
|
|
},
|
|
},
|
|
],
|
|
}
|
|
}
|
|
|
|
const ldap_group = new GroupResource()
|
|
export { ldap_group }
|