From c8cd908c9c7cca9d05598dfa63c1141f39232a86 Mon Sep 17 00:00:00 2001 From: Jakub Onderka Date: Tue, 25 Oct 2022 12:03:14 +0200 Subject: [PATCH] fix: [acl] Add event to template when adding shadow attribute --- app/Controller/ShadowAttributesController.php | 15 ++++++++------- app/View/ShadowAttributes/edit.ctp | 2 -- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/Controller/ShadowAttributesController.php b/app/Controller/ShadowAttributesController.php index 938c3db7f..48b448091 100644 --- a/app/Controller/ShadowAttributesController.php +++ b/app/Controller/ShadowAttributesController.php @@ -598,9 +598,9 @@ class ShadowAttributesController extends AppController public function edit($id = null) { $existingAttribute = $this->ShadowAttribute->Event->Attribute->fetchAttributes($this->Auth->user(), array( - 'contain' => array('Event' => array('fields' => array('Event.id', 'Event.orgc_id', 'Event.org_id', 'Event.distribution', 'Event.uuid'))), - 'conditions' => $this->__attributeIdToConditions($id), - 'flatten' => 1 + 'contain' => array('Event' => array('fields' => array('Event.id', 'Event.orgc_id', 'Event.org_id', 'Event.distribution', 'Event.uuid'))), + 'conditions' => $this->__attributeIdToConditions($id), + 'flatten' => 1 )); if (empty($existingAttribute)) { throw new NotFoundException(__('Invalid Attribute.')); @@ -632,13 +632,13 @@ class ShadowAttributesController extends AppController } if ($attachment) { $fields = array( - 'static' => array('old_id' => 'Attribute.id', 'uuid' => 'Attribute.uuid', 'event_id' => 'Attribute.event_id', 'event_uuid' => 'Event.uuid', 'event_org_id' => 'Event.orgc_id', 'category' => 'Attribute.category', 'type' => 'Attribute.type'), - 'optional' => array('value', 'to_ids', 'comment', 'first_seen', 'last_seen') + 'static' => array('old_id' => 'Attribute.id', 'uuid' => 'Attribute.uuid', 'event_id' => 'Attribute.event_id', 'event_uuid' => 'Event.uuid', 'event_org_id' => 'Event.orgc_id', 'category' => 'Attribute.category', 'type' => 'Attribute.type'), + 'optional' => array('value', 'to_ids', 'comment', 'first_seen', 'last_seen') ); } else { $fields = array( - 'static' => array('old_id' => 'Attribute.id', 'uuid' => 'Attribute.uuid', 'event_id' => 'Attribute.event_id', 'event_uuid' => 'Event.uuid', 'event_org_id' => 'Event.orgc_id'), - 'optional' => array('category', 'type', 'value', 'to_ids', 'comment', 'first_seen', 'last_seen') + 'static' => array('old_id' => 'Attribute.id', 'uuid' => 'Attribute.uuid', 'event_id' => 'Attribute.event_id', 'event_uuid' => 'Event.uuid', 'event_org_id' => 'Event.orgc_id'), + 'optional' => array('category', 'type', 'value', 'to_ids', 'comment', 'first_seen', 'last_seen') ); if ($existingAttribute['Attribute']['object_id']) { unset($fields['optional']['type']); @@ -728,6 +728,7 @@ class ShadowAttributesController extends AppController } } } + $this->set('event', ['Event' => $existingAttribute['Event']]); $this->set('categories', $categories); $this->__common(); $this->set('attrDescriptions', $this->ShadowAttribute->fieldDescriptions); diff --git a/app/View/ShadowAttributes/edit.ctp b/app/View/ShadowAttributes/edit.ctp index dba266268..04e2df914 100644 --- a/app/View/ShadowAttributes/edit.ctp +++ b/app/View/ShadowAttributes/edit.ctp @@ -92,9 +92,7 @@ ?> request->data['ShadowAttribute']['event_id']; echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'event', 'menuItem' => 'proposeAttribute', 'event' => $event)); - echo $this->element('form_seen_input'); ?>