fix: [UI] Show edit icon for event reports just when user have permission

pull/8402/head
Jakub Onderka 2022-05-23 16:11:35 +02:00
parent a162f24c66
commit ca9be6e1bc
2 changed files with 9 additions and 3 deletions

View File

@ -14,8 +14,8 @@ class EventReportsController extends AppController
public $paginate = array(
'limit' => 60,
'order' => array(
'EventReport.event_id' => 'ASC',
'EventReport.name' => 'ASC'
'EventReport.event_id' => 'ASC',
'EventReport.name' => 'ASC'
),
'recursive' => -1,
'contain' => array(
@ -202,6 +202,8 @@ class EventReportsController extends AppController
$fetcherModule = $this->EventReport->isFetchURLModuleEnabled();
$this->set('importModuleEnabled', is_array($fetcherModule));
$this->render('ajax/indexForEvent');
} else {
$this->set('title_for_layout', __('Event Reports'));
}
}
}

View File

@ -58,6 +58,7 @@
),
array(
'name' => __('Event ID'),
'sort' => 'event_id',
'class' => 'short',
'element' => 'links',
'data_path' => 'EventReport.event_id',
@ -91,7 +92,10 @@
'url_params_data_paths' => array(
'EventReport.id'
),
'icon' => 'edit'
'icon' => 'edit',
'complex_requirement' => function (array $row) use ($me) {
return $me['Role']['perm_site_admin'] || $me['org_id'] == $row['Event']['orgc_id'];
}
),
array(
'title' => __('Delete'),