Skip to content

Handling own/other permissions for API v2#383

Open
escopecz wants to merge 10 commits into
stagingfrom
MAUT-13602
Open

Handling own/other permissions for API v2#383
escopecz wants to merge 10 commits into
stagingfrom
MAUT-13602

Conversation

@escopecz

@escopecz escopecz commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
Q A
Bug fix? (use the a.b branch) [ ]
New feature/enhancement? (use the a.x branch) [ ]
Deprecations? [ ]
BC breaks? (use the c.x branch) [ ]
Automated tests included? [ ]
Related user documentation PR URL mautic/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed Fixes #...

Description:

This is hooking into the latest security release of Mautic, backported to Campaign Studio. The Mautic version isn't handling the dynamically built permissions for this plugin. ACS had to add a new event so the CO plugin could hook into it and provide the permissions the core can work with.

Steps to test this PR:

  1. Create a new user with limited custom object permissions. Focus on own/other permissions for custom items, but the rest of the permissions should work as well. Test with API v2 endpoints.

@escopecz escopecz requested review from gunnrryy and rahuld-dev June 10, 2026 13:14
Comment thread EventListener/ApiPlatformPermissionContextSubscriber.php

@gunnrryy gunnrryy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohitp19 rohitp19 requested review from dongilbert and gunnrryy June 22, 2026 12:36

@dongilbert dongilbert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build is failing with:

Error {#22199
  #message: "Undefined constant Mautic\ApiBundle\ApiEvents::API_PLATFORM_PERMISSION_CONTEXT"
  #code: 0
  #file: "./plugins/CustomObjectsBundle/EventListener/ApiPlatformPermissionContextSubscriber.php"
  #line: 17
  trace: {
    ./plugins/CustomObjectsBundle/EventListener/ApiPlatformPermissionContextSubscriber.php:17 {
      MauticPlugin\CustomObjectsBundle\EventListener\ApiPlatformPermissionContextSubscriber::getSubscribedEvents(): array
      › return [
      ›     ApiEvents::API_PLATFORM_PERMISSION_CONTEXT => ['onApiPlatformPermissionContext', 0],
      › ];
    }
    ./vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php:172 { …}
    ./vendor/symfony/event-dispatcher/EventDispatcher.php:197 { …}
    ./vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php:120 { …}
    ./vendor/symfony/dependency-injection/Compiler/Compiler.php:94 { …}
    ./vendor/symfony/dependency-injection/ContainerBuilder.php:762 { …}
    ./vendor/symfony/http-kernel/Kernel.php:594 { …}
    ./app/AppKernel.php:254 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:169 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:75 { …}
    ./vendor/symfony/console/Application.php:149 { …}
    ./bin/console:42 { …}
  }
}

@escopecz

Copy link
Copy Markdown
Contributor Author

@dongilbert that happened after addressing your earlier comment. See #383 (comment)

There are 2 options:

  1. Keep the dummy param type you noticed and pass the CI
  2. Or have the proper param types and merge this PR once the new event is pushed and merged to Mautic

The CI in this repo runs agains stock Mautic, not ACS as it is open sourced.

On the team sync call last week we decided to go with 2. But I'm fine with either.

@escopecz escopecz requested a review from dongilbert June 22, 2026 13:49
dongilbert
dongilbert previously approved these changes Jun 22, 2026

@dongilbert dongilbert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with 2

@escopecz

Copy link
Copy Markdown
Contributor Author

Oh, I just realized that we are testing against Mautic 4.4:

https://github.com/acquia/mc-cs-plugin-custom-objects/blob/staging/.github/workflows/tests.yml#L23

So the new event won't ever show up there. I'll have to revert to make this plugin work for Mautic 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants