Skip to content

Fix api4 tag remove/add action for non-admins

bgm requested to merge bgm/civirules:tagPermissions into master

To reproduce:

  • Create a contact profile, so that anonymous or non-admins users can submit that profile
  • Create a new CiviRule that adds or removes tags from contacts, when they submit that profile. Do not include a processing delay.

Then submit the profile as the non-admin. The tags will not be added/removed, but it works fine if submitting as an admin.

I suspect it might also have an impact here:

$ grep -r Api4 | grep -E '(create|delete|get)\(\)'
CRM/CivirulesActions/Relationship/End.php:        \Civi\Api4\Relationship::delete()
CRM/CivirulesActions/Relationship/End.php:        $relationshipType = \Civi\Api4\RelationshipType::get()
CRM/CivirulesConditions/Generic/HasTag.php:      $tags = \Civi\Api4\EntityTag::get()
CRM/CivirulesConditions/Generic/HasTag.php:      $apiTags = \Civi\Api4\Tag::get()
CRM/CivirulesConditions/GroupContact/InGroupSince.php:        $groupContacts = \Civi\Api4\GroupContact::get()
CRM/CivirulesPostTrigger/Form/RelatedParticipantWhenActivityIsTagged.php:      $apiTags = \Civi\Api4\Tag::get()
CRM/Civirules/Utils.php:        $groups = \Civi\Api4\Group::get()
CRM/Civirules/Utils.php:        $apiGroups = \Civi\Api4\Group::get()
CRM/Civirules/Utils.php:        $optionValues = \Civi\Api4\OptionValue::get()
CRM/Civirules/Utils.php:          $events = \Civi\Api4\Event::get()

cc @ErikHommel

Merge request reports

Loading