Skip to content

Commit

Permalink
Remove deprecated code
Browse files Browse the repository at this point in the history
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
  • Loading branch information
eileenmcnaughton committed Jul 14, 2021
1 parent 0caf521 commit f680703
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CRM/Admin/Form/ScheduleReminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'));
}
}
Expand Down
7 changes: 1 addition & 6 deletions CRM/Event/BAO/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Form/ManageEvent/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'));
}
}
Expand Down

0 comments on commit f680703

Please sign in to comment.