From: Aidan Saunders Date: Fri, 6 Jul 2018 14:51:28 +0000 (+0100) Subject: Make permission condition more explicit X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=da2c767957d883c5716d4e56f6916c05a8beee90;p=civicrm-core.git Make permission condition more explicit --- diff --git a/CRM/Contact/BAO/Contact/Permission.php b/CRM/Contact/BAO/Contact/Permission.php index c8ddb50a1f..4896b03ad8 100644 --- a/CRM/Contact/BAO/Contact/Permission.php +++ b/CRM/Contact/BAO/Contact/Permission.php @@ -358,9 +358,12 @@ AND ac.user_id IS NULL $directions = array(array('from' => 'a', 'to' => 'b'), array('from' => 'b', 'to' => 'a')); // CRM_Core_Permission::VIEW is satisfied by either CRM_Contact_BAO_Relationship::VIEW or CRM_Contact_BAO_Relationship::EDIT - $is_perm_condition = $type == CRM_Core_Permission::VIEW ? - ' != ' . CRM_Contact_BAO_Relationship::NONE : - ' = ' . CRM_Contact_BAO_Relationship::EDIT; + if ($type == CRM_Core_Permission::VIEW) { + $is_perm_condition = ' IN ( ' . CRM_Contact_BAO_Relationship::EDIT . ' , ' . CRM_Contact_BAO_Relationship::VIEW . ' ) '; + } + else { + $is_perm_condition = ' = ' . CRM_Contact_BAO_Relationship::EDIT; + } // NORMAL/SINGLE DEGREE RELATIONSHIPS foreach ($directions as $direction) {