Skip to content

Reference CorePermissions by FQCN instead of the removed mautic.security service id - #625

Open
promptless-for-oss wants to merge 3 commits into
mautic:7.2from
Promptless:promptless/pr-17121-mautic-security-fqcn
Open

Reference CorePermissions by FQCN instead of the removed mautic.security service id#625
promptless-for-oss wants to merge 3 commits into
mautic:7.2from
Promptless:promptless/pr-17121-mautic-security-fqcn

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

Open in Promptless

Mautic 8 (mautic/mautic PR #17121) replaces the PermissionsPass compiler pass with an AutowireIterator on CorePermissions and removes the mautic.security container service id along with its alias. The FQCN Mautic\CoreBundle\Security\Permissions\CorePermissions is now the only container identifier for the security service.

The plugin developer docs still reference the removed mautic.security id when showing how to obtain the security service, so those examples break on Mautic 8. This updates the four affected places to use the CorePermissions FQCN instead:

  • docs/plugins/permissions.rst — the "Using permissions" $this->get() example and the prose that names the service.
  • docs/plugin_services/security.rst — the same $this->get() example and prose; the prose no longer claims a mautic.security alias exists.
  • docs/plugins/config.rst — the methodCalls example that passed mautic.security as a service reference.
  • docs/plugin_extensions/api.rst — the controller arguments example that passed mautic.security.

The mautic.permissions service tag and the services.permissions registration group — how plugin developers register their own permission classes — are unchanged by the PR and are left untouched. This is a behavior-preserving reference swap consistent with the established pattern for other removed string service aliases.

Trigger Events

…ity service id

Mautic 8 (mautic/mautic PR #17121) replaces the PermissionsPass compiler
pass with an AutowireIterator on CorePermissions and removes the
mautic.security container service id and its alias. The FQCN
Mautic\CoreBundle\Security\Permissions\CorePermissions is now the only
container identifier for the security service, so update the plugin
developer examples that still reference the removed mautic.security id.
<?php

$security = $this->get('mautic.security');
$security = $this->get(\Mautic\CoreBundle\Security\Permissions\CorePermissions::class);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mautic/mautic PR #17121 removes the 'mautic.security' service id and its alias to CorePermissions::class in app/bundles/CoreBundle/Config/services.php, registering CorePermissions under its FQCN id instead ($services->set(Mautic\CoreBundle\Security\Permissions\CorePermissions::class)). Confirms $this->get(CorePermissions::class) is the correct replacement for $this->get('mautic.security').

Source: https://github.com/mautic/mautic/pull/17121/files


/** @var \Mautic\CoreBundle\Security\Permissions\CorePermissions */
$security = $this->get('mautic.security');
$security = $this->get(\Mautic\CoreBundle\Security\Permissions\CorePermissions::class);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mautic/mautic PR #17121 removes the 'mautic.security' service id/alias and registers CorePermissions under its FQCN id in app/bundles/CoreBundle/Config/services.php. Confirms $this->get(CorePermissions::class) replaces $this->get('mautic.security').

Source: https://github.com/mautic/mautic/pull/17121/files


/** @var \Mautic\CoreBundle\Security\Permissions\CorePermissions */
$security = $this->get('mautic.security');
$security = $this->get(\Mautic\CoreBundle\Security\Permissions\CorePermissions::class);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mautic's core services.php sets $services->defaults()->autowire()->autoconfigure()->public(), so services are public by default unless explicitly marked private. CorePermissions (registered by FQCN id with no ->public(false) override) remains a publicly gettable container service after PR #17121, so $this->get(CorePermissions::class) works the same way $this->get('mautic.security') did before.

Source: https://github.com/mautic/mautic/blob/505f0a7b912fa78ccaa01dd4d434ae2ceb1d6b43/app/bundles/CoreBundle/Config/services.php#L20

Comment thread docs/plugins/config.rst Outdated
- no
- array[]
- Define methods to call after the service is instantiated. Use an array of arrays with keys as the method name and values the arguments to pass into the given method. For example, ``['methodCalls' => ['setSecurity' => ['mautic.security'],],],``.
- Define methods to call after the service is instantiated. Use an array of arrays with keys as the method name and values the arguments to pass into the given method. For example, ``['methodCalls' => ['setSecurity' => [\Mautic\CoreBundle\Security\Permissions\CorePermissions::class],],],``.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mautic/mautic PR #17121 removes the 'mautic.security' service id/alias, registering CorePermissions under its FQCN id. The methodCalls example argument must reference the new FQCN id.

Source: https://github.com/mautic/mautic/pull/17121/files

'class' => \MauticPlugin\HelloWorldBundle\Controller\ApiController::class,
'arguments' => [
'mautic.security',
\Mautic\CoreBundle\Security\Permissions\CorePermissions::class,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mautic/mautic PR #17121 removes the 'mautic.security' service id/alias, registering CorePermissions under its FQCN id. Per docs/plugins/config.rst's own documentation of the 'arguments' key ("Any other string is assumed to be the name of a defined service"), the controller's constructor argument must reference the new FQCN service id.

Source: https://github.com/mautic/mautic/pull/17121/files

@adiati98 adiati98 added this to the 8.0 milestone Sep 2, 2026

@adiati98 adiati98 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.

@promptless-for-oss please address the suggestions.

@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Thanks @adiati98 — on it. I'll work through the review/lint suggestions on the changed pages, confirm Vale is clean, and push the update to this PR.

@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Update: traced the prose-check annotations — there's a single in-scope finding on the changed lines, a passive-voice phrase ("is instantiated") on the methodCalls line in config.rst. Fixing that and confirming Vale is clean, then pushing. The other changed files have no findings on their new lines.

Address maintainer review on PR mautic#625: rewrite the passive
'the service is instantiated' clause flagged by Vale (Google.Passive)
into active voice to match the Mautic documentation style guide.
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Addressed the review feedback on PR #625. The one automated lint suggestion in scope was a Vale active-voice warning on the methodCalls line I changed, so I rewrote "Define methods to call after the service is instantiated" to the active-voice "Define methods to call after Mautic instantiates the service" — Vale is now clean on that line. The other three changed files (permissions.rst, security.rst, api.rst) had no lint findings on their changed lines, and the remaining Vale warnings elsewhere in config.rst sit on pre-existing, unchanged lines outside this PR's scope. The update is pushed to the existing PR — nothing new to open.

If by "the suggestions" you meant specific line-level comments rather than the automated lint annotations, I don't see any on this PR — could you point me to them and I'll address them right away?

@promptless-for-oss
promptless-for-oss marked this pull request as ready for review September 2, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants