(REF) Change CoreUtil::checkAccess() to CoreUtil::checkAccessRecord()
authorTim Otten <totten@civicrm.org>
Mon, 7 Jun 2021 06:28:43 +0000 (23:28 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 8 Jun 2021 04:10:03 +0000 (21:10 -0700)
commit849354a5e1bcdd1812f3848095b1571ffd082676
tree08240c7a35a81352836303ba2ce81e206cb3e0a2
parenta5d0f31af7fea240ee802a6eb7b692428dc772e4
(REF) Change CoreUtil::checkAccess() to CoreUtil::checkAccessRecord()

This change invovles a few things:

1. Pass the `AbstractAction $apiRequest` instead of the tuple `string $entity, string $action`.

2. There are a couple cases where we don't actually want to re-use the current `$apiRequest`.
   Switch these using `checkAccessDelegated()`.

3. Always resolve the userID before calling `checkAccessRecord()`. `$userID===null` can mean
   two different things (ie "active user" vs "anonymous user").  By
   resolving this once before we do any work with `checkAccess()`, we ensure that it will
   consistently mean "anonymous user" (even if there are multiple rounds of delegation).

3. Change the name from `checkAccess()` to `checkAccessRecord`. There are a few flavors of
   `...checkAccess...`, and this makes it easier to differentiate when skimming.
CRM/Core/DAO.php
Civi/Api4/Generic/AbstractCreateAction.php
Civi/Api4/Generic/AbstractSaveAction.php
Civi/Api4/Generic/BasicBatchAction.php
Civi/Api4/Generic/BasicUpdateAction.php
Civi/Api4/Generic/CheckAccessAction.php
Civi/Api4/Generic/DAODeleteAction.php
Civi/Api4/Generic/DAOUpdateAction.php
Civi/Api4/Utils/CoreUtil.php