2020-06-19 00:42:10 +02:00
|
|
|
<?php
|
2023-02-23 14:58:54 +01:00
|
|
|
$topbarChildren = [];
|
|
|
|
if (!empty($loggedUser->role->perm_admin)) {
|
|
|
|
$topbarChildren[] = [
|
|
|
|
'type' => 'simple',
|
|
|
|
'children' => [
|
|
|
|
'data' => [
|
|
|
|
'type' => 'simple',
|
|
|
|
'text' => __('Add role'),
|
|
|
|
'class' => 'btn btn-primary',
|
|
|
|
'popover_url' => '/roles/add'
|
|
|
|
]
|
|
|
|
]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$topbarChildren[] = [
|
|
|
|
'type' => 'search',
|
|
|
|
'button' => __('Search'),
|
|
|
|
'placeholder' => __('Enter value to search'),
|
|
|
|
'data' => '',
|
|
|
|
'searchKey' => 'value'
|
|
|
|
];
|
|
|
|
|
2020-06-19 00:42:10 +02:00
|
|
|
echo $this->element('genericElements/IndexTable/index_table', [
|
|
|
|
'data' => [
|
|
|
|
'data' => $data,
|
|
|
|
'top_bar' => [
|
2023-02-23 14:58:54 +01:00
|
|
|
'children' => $topbarChildren,
|
2020-06-19 00:42:10 +02:00
|
|
|
],
|
|
|
|
'fields' => [
|
|
|
|
[
|
|
|
|
'name' => '#',
|
|
|
|
'sort' => 'id',
|
|
|
|
'data_path' => 'id',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => __('Name'),
|
|
|
|
'sort' => 'name',
|
|
|
|
'data_path' => 'name',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => __('UUID'),
|
|
|
|
'sort' => 'uuid',
|
|
|
|
'data_path' => 'uuid',
|
|
|
|
'placeholder' => __('Leave empty to auto generate')
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => __('Admin'),
|
|
|
|
'sort' => 'perm_admin',
|
|
|
|
'data_path' => 'perm_admin',
|
|
|
|
'element' => 'boolean'
|
2021-06-28 23:27:21 +02:00
|
|
|
],
|
2023-09-12 09:26:07 +02:00
|
|
|
[
|
|
|
|
'name' => __('Group Admin'),
|
|
|
|
'sort' => 'perm_group_admin',
|
|
|
|
'data_path' => 'perm_group_admin',
|
|
|
|
'element' => 'boolean'
|
|
|
|
],
|
2021-10-01 13:19:26 +02:00
|
|
|
[
|
|
|
|
'name' => __('Org Admin'),
|
|
|
|
'sort' => 'perm_org_admin',
|
|
|
|
'data_path' => 'perm_org_admin',
|
|
|
|
'element' => 'boolean'
|
|
|
|
],
|
2021-06-28 23:27:21 +02:00
|
|
|
[
|
|
|
|
'name' => __('Sync'),
|
|
|
|
'sort' => 'perm_sync',
|
|
|
|
'data_path' => 'perm_sync',
|
|
|
|
'element' => 'boolean'
|
2020-06-19 00:42:10 +02:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'Default',
|
|
|
|
'sort' => 'is_default',
|
|
|
|
'data_path' => 'is_default',
|
|
|
|
'element' => 'boolean'
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'title' => __('Roles Index'),
|
|
|
|
'description' => __('A list of configurable user roles. Create or modify user access roles based on the settings below.'),
|
|
|
|
'pull' => 'right',
|
|
|
|
'actions' => [
|
|
|
|
[
|
|
|
|
'url' => '/roles/view',
|
|
|
|
'url_params_data_paths' => ['id'],
|
|
|
|
'icon' => 'eye'
|
|
|
|
],
|
|
|
|
[
|
2021-01-11 16:28:07 +01:00
|
|
|
'open_modal' => '/roles/edit/[onclick_params_data_path]',
|
|
|
|
'modal_params_data_path' => 'id',
|
2021-11-24 01:27:14 +01:00
|
|
|
'icon' => 'edit',
|
2021-11-25 00:55:36 +01:00
|
|
|
'requirement' => !empty($loggedUser['role']['perm_admin'])
|
2020-06-19 00:42:10 +02:00
|
|
|
],
|
|
|
|
[
|
2021-01-11 16:28:07 +01:00
|
|
|
'open_modal' => '/roles/delete/[onclick_params_data_path]',
|
|
|
|
'modal_params_data_path' => 'id',
|
2021-11-24 01:27:14 +01:00
|
|
|
'icon' => 'trash',
|
2021-11-25 00:55:36 +01:00
|
|
|
'requirement' => !empty($loggedUser['role']['perm_admin'])
|
2021-01-11 16:28:07 +01:00
|
|
|
],
|
2020-06-19 00:42:10 +02:00
|
|
|
]
|
|
|
|
]
|
|
|
|
]);
|
|
|
|
echo '</div>';
|
|
|
|
?>
|