chg: [roles:index] Only show `add role` button for users having ACL access

refacto/CRUDComponent
Sami Mokaddem 2023-02-23 14:58:54 +01:00
parent 487670e522
commit a67c6b70d5
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 23 additions and 20 deletions

View File

@ -1,28 +1,31 @@
<?php
$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'
];
echo $this->element('genericElements/IndexTable/index_table', [
'data' => [
'data' => $data,
'top_bar' => [
'children' => [
[
'type' => 'simple',
'children' => [
'data' => [
'type' => 'simple',
'text' => __('Add role'),
'class' => 'btn btn-primary',
'popover_url' => '/roles/add'
]
]
],
[
'type' => 'search',
'button' => __('Search'),
'placeholder' => __('Enter value to search'),
'data' => '',
'searchKey' => 'value'
]
]
'children' => $topbarChildren,
],
'fields' => [
[