From 5bd6e0a322bbd5e3b2a62b4ff128460f70df648a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 16 Jun 2015 11:05:35 -0400 Subject: [PATCH] Code cleanup This is a less convoluted version of the same thing --- CRM/ACL/API.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/CRM/ACL/API.php b/CRM/ACL/API.php index 56d9b7e0da..dc4a60771f 100644 --- a/CRM/ACL/API.php +++ b/CRM/ACL/API.php @@ -99,7 +99,7 @@ class CRM_ACL_API { $onlyDeleted = FALSE, $skipDeleteClause = FALSE ) { - // the default value which is valid for rhe final AND + // the default value which is valid for the final AND $deleteClause = ' ( 1 ) '; if (!$skipDeleteClause) { if (CRM_Core_Permission::check('access deleted contacts') and $onlyDeleted) { @@ -113,24 +113,18 @@ class CRM_ACL_API { // first see if the contact has edit / view all contacts if (CRM_Core_Permission::check('edit all contacts') || - ($type == self::VIEW && - CRM_Core_Permission::check('view all contacts') - ) + ($type == self::VIEW && CRM_Core_Permission::check('view all contacts')) ) { - return $skipDeleteClause ? ' ( 1 ) ' : $deleteClause; + return $deleteClause; } $user = CRM_Core_Session::getLoggedInContactID(); if ($contactID == NULL) { - $contactID = $user; + $contactID = $user ? $user : 0; } - if (!$contactID) { - // anonymous user - $contactID = 0; - } // Check if contact has permissions on self - elseif ($contactID == $user) { + if ($user && $contactID == $user) { if (CRM_Core_Permission::check('edit my contact') || ($type == self::VIEW && CRM_Core_Permission::check('view my contact')) ) { -- 2.25.1