Support permissions ... but then disable them ... hmmm.

This commit is contained in:
Rich Lott / Artful Robot 2025-05-02 09:50:30 +01:00
parent daae65a5d3
commit d8a87d03d3
3 changed files with 8 additions and 3 deletions

View file

@ -32,7 +32,10 @@ class Sync extends \Civi\Api4\Generic\AbstractAction {
public function _run(Result $result) { public function _run(Result $result) {
ini_set('memory_limit', '256M'); ini_set('memory_limit', '256M');
Civi::log()->debug('Begin', ['=start' => 'ContactCatSync', '=timed' => 1]); Civi::log()->debug(
'Begin sync for ' . ($this->contact_id ? "contact $this->contact_id" : "all contacts"),
['=start' => 'ContactCatSync', '=timed' => 1]
);
if (!$this->force && !$this->contact_id) { if (!$this->force && !$this->contact_id) {
$nextRun = Civi::settings()->get('contactcats_next_run') ?? 0; $nextRun = Civi::settings()->get('contactcats_next_run') ?? 0;

View file

@ -36,8 +36,9 @@ class ContactCategory extends Generic\DAOEntity {
/** /**
* *
*/ */
public static function sync(): Sync { public static function sync($checkPermissions = TRUE): Sync {
return new Sync('ContactCategory', 'sync'); return (new Sync('ContactCategory', 'sync'))
->setCheckPermissions($checkPermissions);
} }
/** /**

View file

@ -286,6 +286,7 @@ class Processor {
} }
// We don't need them ordered. // We don't need them ordered.
unset($apiParams['orderBy']); unset($apiParams['orderBy']);
$apiParams['checkPermissions'] = FALSE;
$contactIDs = civicrm_api4($search['api_entity'], 'get', $apiParams)->column($contactIdKey); $contactIDs = civicrm_api4($search['api_entity'], 'get', $apiParams)->column($contactIdKey);
// Unsure if this batching is needed. // Unsure if this batching is needed.