<commit_before><?php
$canAccess = function ($controller, $action) use ($me, $aclComponent) {
    return $aclComponent->canUserAccess($me, $controller, $action);
};

$this->set('menuItem', $menuItem);
$divider = $this->element('/genericElements/SideMenu/side_menu_divider');
?>
<div class="actions sideMenu">
    <ul class="nav nav-list">
        <?php
            switch ($menuList) {
                case 'dashboard':
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardIndex',
                        'url' => $baseurl . '/dashboards',
                        'text' => __('View Dashboard')
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardAdd',
                        'text' => __('Add Widget'),
                        'onClick' => array(
                            'function' => 'openGenericModalPost',
                            'params' => array($baseurl . '/dashboards/getForm/add')
                        ),
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardImport',
                        'text' => __('Import Config JSON'),
                        'onClick' => array(
                            'function' => 'openGenericModal',
                            'params' => array($baseurl . '/dashboards/import')
                        ),
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardExport',
                        'text' => __('Export Config JSON'),
                        'onClick' => array(
                            'function' => 'openGenericModal',
                            'params' => array($baseurl . '/dashboards/export')
                        ),
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardSave',
                        'text' => __('Save Dashboard Config'),
                        'onClick' => array(
                            'function' => 'openGenericModal',
                            'params' => array($baseurl . '/dashboards/saveTemplate')
                        ),
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardTemplateIndex',
                        'url' => $baseurl . '/dashboards/listTemplates',
                        'text' => __('List Dashboard Templates')
                    ));
                    break;
                case 'event':
                    $eventId = intval($event['Event']['id']);
                    echo '<div id="hiddenSideMenuData" class="hidden" data-event-id="' . $eventId . '"></div>';
                    if (in_array($menuItem, array('editEvent', 'addAttribute', 'addObject', 'addAttachment', 'addIOC', 'addThreatConnect', 'populateFromTemplate', 'merge'))) {
                        // we can safely assume that mayModify is true if coming from these actions, as they require it in the controller and the user has already passed that check
                        $mayModify = true;
                        if ($isAclPublish) $mayPublish = true;
                    }
                    if (($menuItem === 'template_populate_results')) {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'template_populate_results',
                            'url' => $baseurl . '/templates/index',
                            'text' => __('Populate From Template')
                        ));
                    }
                    if ($menuItem === 'enrichmentResults') {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'enrichmentResults',
                            'text' => __('Enrichment Module Result')
                        ));
                        echo $divider;
                    }
                    if ($menuItem === 'freetextResults') {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'freetextResults',
                            'text' => __('Freetext Import Result')
                        ));
                        echo $divider;
                    }
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'viewEvent',
                        'url' => $baseurl . '/events/view/' . $eventId,
                        'text' => __('View Event')
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'viewGraph',
                        'url' => $baseurl . '/events/viewGraph/' . $eventId,
                        'text' => __('View Correlation Graph')
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'eventLog',
                        'url' => $baseurl . '/logs/event_index/' . $eventId,
                        'text' => __('View Event History')
                    ));
                    echo $divider;
                    if ($isSiteAdmin || (isset($mayModify) && $mayModify)) {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'editEvent',
                            'url' => $baseurl . '/events/edit/' . $eventId,
                            'text' => __('Edit Event')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_post_link', array(
                            'url' => $baseurl . '/events/delete/' . $eventId,
                            'text' => __('Delete Event'),
                            'message' => __('Are you sure you want to delete event #%s?', $eventId)
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'addAttribute',
                            'url' => $baseurl . '/attributes/add/' . $eventId,
                            'text' => __('Add Attribute')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'addObject',
                            'text' => __('Add Object'),
                            'onClick' => array(
                                'function' => 'popoverPopup',
                                'params' => array('this', $eventId, 'objectTemplates', 'objectMetaChoice')
                            ),
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'addAttachment',
                            'url' => $baseurl . '/attributes/add_attachment/' . $eventId,
                            'text' => __('Add Attachment')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'add',
                            'url' => '/eventReports/add/' . h($event['Event']['id']),
                            'text' => __('Add Event Report')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'populateFrom',
                            'onClick' => array(
                                'function' => 'getPopup',
                                'params' => array($eventId, 'events', 'importChoice')
                            ),
                            'text' => __('Populate from…')
                        ));
                        if ($menuItem === 'populateFromtemplate') {
                            echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                                'element_id' => 'populateFromtemplate',
                                'url' => $baseurl . '/templates/populateEventFromTemplate/' . $template_id . '/' . $eventId,
                                'text' => __('Populate From Template')
                            ));
                        }
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'onClick' => array(
                                'function' => 'genericPopup',
                                'params' => array($baseurl . '/events/enrichEvent/' . $eventId, '#confirmation_box')
                            ),
                            'text' => __('Enrich Event')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'merge',
                            'url' => $baseurl . '/events/merge/' . $eventId,
                            'text' => __('Merge attributes from…')
                        ));
                    }
                    if (($isSiteAdmin && (!isset($mayModify) || !$mayModify)) || (!isset($mayModify) || !$mayModify)) {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'proposeAttribute',
                            'url' => $baseurl . '/shadow_attributes/add/' . $eventId,
                            'text' => __('Propose Attribute')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(<commit_msg>fix: [UI] Do not show proposals menu link when user don't have permission<commit_after><?php
$canAccess = function ($controller, $action) use ($me, $aclComponent) {
    return $aclComponent->canUserAccess($me, $controller, $action);
};

$this->set('menuItem', $menuItem);
$divider = $this->element('/genericElements/SideMenu/side_menu_divider');
?>
<div class="actions sideMenu">
    <ul class="nav nav-list">
        <?php
            switch ($menuList) {
                case 'dashboard':
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardIndex',
                        'url' => $baseurl . '/dashboards',
                        'text' => __('View Dashboard')
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardAdd',
                        'text' => __('Add Widget'),
                        'onClick' => array(
                            'function' => 'openGenericModalPost',
                            'params' => array($baseurl . '/dashboards/getForm/add')
                        ),
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardImport',
                        'text' => __('Import Config JSON'),
                        'onClick' => array(
                            'function' => 'openGenericModal',
                            'params' => array($baseurl . '/dashboards/import')
                        ),
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardExport',
                        'text' => __('Export Config JSON'),
                        'onClick' => array(
                            'function' => 'openGenericModal',
                            'params' => array($baseurl . '/dashboards/export')
                        ),
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardSave',
                        'text' => __('Save Dashboard Config'),
                        'onClick' => array(
                            'function' => 'openGenericModal',
                            'params' => array($baseurl . '/dashboards/saveTemplate')
                        ),
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'dashboardTemplateIndex',
                        'url' => $baseurl . '/dashboards/listTemplates',
                        'text' => __('List Dashboard Templates')
                    ));
                    break;
                case 'event':
                    $eventId = intval($event['Event']['id']);
                    echo '<div id="hiddenSideMenuData" class="hidden" data-event-id="' . $eventId . '"></div>';
                    if (in_array($menuItem, array('editEvent', 'addAttribute', 'addObject', 'addAttachment', 'addIOC', 'addThreatConnect', 'populateFromTemplate', 'merge'))) {
                        // we can safely assume that mayModify is true if coming from these actions, as they require it in the controller and the user has already passed that check
                        $mayModify = true;
                        if ($isAclPublish) $mayPublish = true;
                    }
                    if (($menuItem === 'template_populate_results')) {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'template_populate_results',
                            'url' => $baseurl . '/templates/index',
                            'text' => __('Populate From Template')
                        ));
                    }
                    if ($menuItem === 'enrichmentResults') {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'enrichmentResults',
                            'text' => __('Enrichment Module Result')
                        ));
                        echo $divider;
                    }
                    if ($menuItem === 'freetextResults') {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'freetextResults',
                            'text' => __('Freetext Import Result')
                        ));
                        echo $divider;
                    }
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'viewEvent',
                        'url' => $baseurl . '/events/view/' . $eventId,
                        'text' => __('View Event')
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'viewGraph',
                        'url' => $baseurl . '/events/viewGraph/' . $eventId,
                        'text' => __('View Correlation Graph')
                    ));
                    echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                        'element_id' => 'eventLog',
                        'url' => $baseurl . '/logs/event_index/' . $eventId,
                        'text' => __('View Event History')
                    ));
                    echo $divider;
                    if ($isSiteAdmin || (isset($mayModify) && $mayModify)) {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'editEvent',
                            'url' => $baseurl . '/events/edit/' . $eventId,
                            'text' => __('Edit Event')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_post_link', array(
                            'url' => $baseurl . '/events/delete/' . $eventId,
                            'text' => __('Delete Event'),
                            'message' => __('Are you sure you want to delete event #%s?', $eventId)
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'addAttribute',
                            'url' => $baseurl . '/attributes/add/' . $eventId,
                            'text' => __('Add Attribute')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'addObject',
                            'text' => __('Add Object'),
                            'onClick' => array(
                                'function' => 'popoverPopup',
                                'params' => array('this', $eventId, 'objectTemplates', 'objectMetaChoice')
                            ),
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'addAttachment',
                            'url' => $baseurl . '/attributes/add_attachment/' . $eventId,
                            'text' => __('Add Attachment')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'add',
                            'url' => '/eventReports/add/' . h($event['Event']['id']),
                            'text' => __('Add Event Report')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'populateFrom',
                            'onClick' => array(
                                'function' => 'getPopup',
                                'params' => array($eventId, 'events', 'importChoice')
                            ),
                            'text' => __('Populate from…')
                        ));
                        if ($menuItem === 'populateFromtemplate') {
                            echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                                'element_id' => 'populateFromtemplate',
                                'url' => $baseurl . '/templates/populateEventFromTemplate/' . $template_id . '/' . $eventId,
                                'text' => __('Populate From Template')
                            ));
                        }
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'onClick' => array(
                                'function' => 'genericPopup',
                                'params' => array($baseurl . '/events/enrichEvent/' . $eventId, '#confirmation_box')
                            ),
                            'text' => __('Enrich Event')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'merge',
                            'url' => $baseurl . '/events/merge/' . $eventId,
                            'text' => __('Merge attributes from…')
                        ));
                    }
                    if ($canAccess('shadowAttributes', 'add') && (($isSiteAdmin && (!isset($mayModify) || !$mayModify)) || (!isset($mayModify) || !$mayModify))) {
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
                            'element_id' => 'proposeAttribute',
                            'url' => $baseurl . '/shadow_attributes/add/' . $eventId,
                            'text' => __('Propose Attribute')
                        ));
                        echo $this->element('/genericElements/SideMenu/side_menu_link', array(
{'fraction_non_alphanumeric': 0.13171950801195667, 'fraction_numerical': 0.0, 'mean_word_length': 1.151380982500527, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 227, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '824141', 'n_tokens_mistral': 4795, 'n_tokens_neox': 4596, 'n_words': 861}