From f6807038cb0aff0b6f7344a17da1e935935393d2 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 15 Jul 2021 10:40:02 +1200 Subject: [PATCH] Remove deprecated code We deprecated NOT passing an id into the function in 2018 - this removes Note I double checked - if you pass in '2' to a strict casting of int it accepts it and casts to int --- CRM/Admin/Form/ScheduleReminders.php | 2 +- CRM/Event/BAO/Event.php | 7 +------ CRM/Event/Form/ManageEvent/Delete.php | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index 216f4fe09f4a..6c2f05a200d7 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -59,7 +59,7 @@ public function buildQuickForm(): void { if ($isEvent) { $this->setComponentID(CRM_Utils_Request::retrieve('compId', 'Integer', $this)); - if (!CRM_Event_BAO_Event::checkPermission($this->getComponentID(), CRM_Core_Permission::EDIT)) { + if (!CRM_Event_BAO_Event::checkPermission((int) $this->getComponentID(), CRM_Core_Permission::EDIT)) { throw new CRM_Core_Exception(ts('You do not have permission to access this page.')); } } diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 8501319ed2c1..8db65e8a0285 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -2045,12 +2045,7 @@ public static function checkRegistration($params) { * Whether the user has permission for this event (or if eventId=NULL an array of permissions) * @throws \CiviCRM_API3_Exception */ - public static function checkPermission($eventId = NULL, $permissionType = CRM_Core_Permission::VIEW) { - if (empty($eventId)) { - CRM_Core_Error::deprecatedFunctionWarning('CRM_Event_BAO_Event::getAllPermissions'); - return self::getAllPermissions(); - } - + public static function checkPermission(int $eventId, $permissionType = CRM_Core_Permission::VIEW) { switch ($permissionType) { case CRM_Core_Permission::EDIT: // We also set the cached "view" permission to TRUE if "edit" is TRUE diff --git a/CRM/Event/Form/ManageEvent/Delete.php b/CRM/Event/Form/ManageEvent/Delete.php index 376800f00c19..f6a5e7207b60 100644 --- a/CRM/Event/Form/ManageEvent/Delete.php +++ b/CRM/Event/Form/ManageEvent/Delete.php @@ -43,7 +43,7 @@ public function preProcess() { $this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'title'); } - if (!CRM_Event_BAO_Event::checkPermission($this->_id, CRM_Core_Permission::DELETE)) { + if (!CRM_Event_BAO_Event::checkPermission((int) $this->_id, CRM_Core_Permission::DELETE)) { CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.')); } }