From: Coleman Watts Date: Tue, 16 Jun 2015 15:05:35 +0000 (-0400) Subject: Code cleanup X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5bd6e0a322bbd5e3b2a62b4ff128460f70df648a;p=civicrm-core.git Code cleanup This is a less convoluted version of the same thing --- 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')) ) {