Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/plugin_extensions/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This places the route behind ``/api`` which is only accessible to authorized Use
'plugin.hello_world.controller.api' => [
'class' => \MauticPlugin\HelloWorldBundle\Controller\ApiController::class,
'arguments' => [
'mautic.security',
\Mautic\CoreBundle\Security\Permissions\CorePermissions::class,
Comment thread
adiati98 marked this conversation as resolved.
'plugin.hello_world.model.worlds'
],
'methodCalls' => [
Expand Down
4 changes: 2 additions & 2 deletions docs/plugin_services/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You can use permissions as follows in your controllers and services:
declare(strict_types=1);

/** @var \Mautic\CoreBundle\Security\Permissions\CorePermissions */
$security = $this->get('mautic.security');
$security = $this->get(\Mautic\CoreBundle\Security\Permissions\CorePermissions::class);
Comment thread
adiati98 marked this conversation as resolved.
Comment thread
adiati98 marked this conversation as resolved.

// Check if user is granted a single permission
if ($security->isGranted('plugin:helloWorld:worlds:view')) {
Expand Down Expand Up @@ -96,7 +96,7 @@ You can use permissions as follows in your controllers and services:
// do something
}

To determine if a User has a specific permission, use Mautic's security service which has the ``mautic.security`` alias. The class is ``Mautic\CoreBundle\Security\Permissions\CorePermissions``.
To determine if a User has a specific permission, use Mautic's security service, provided by the ``Mautic\CoreBundle\Security\Permissions\CorePermissions`` class.

As suggested in the preceding section, Mautic uses a special permission notation to refer to a specific permission.
For core bundles, use ``bundleName:permissionLevel:permission``.
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ Key each service with a unique name to all of Mautic, including other Plugins.
* - ``methodCalls``
- 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 Mautic instantiates the service. 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],],],``.
* - ``decoratedService``
- no
- string
Expand Down
4 changes: 2 additions & 2 deletions docs/plugins/permissions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Using permissions

<?php

$security = $this->get('mautic.security');
$security = $this->get(\Mautic\CoreBundle\Security\Permissions\CorePermissions::class);
Comment thread
adiati98 marked this conversation as resolved.

// Check if user is granted a single permission
if ($security->isGranted('plugin:helloWorld:worlds:view')) {
Expand Down Expand Up @@ -92,7 +92,7 @@ Using permissions
// do something
}

To determine if a User has a specific permission, use the Mautic security service, which you can obtain from the ``mautic.security`` service.
To determine if a User has a specific permission, use Mautic's security service, provided by the ``Mautic\CoreBundle\Security\Permissions\CorePermissions`` class.

Mautic uses specific notation to identify permissions:

Expand Down
Loading