You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugins/permissions.rst
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Mautic defines custom Role permissions through Permission objects.
6
6
How permissions work
7
7
********************
8
8
9
-
Mautic calculates permissions based on bits assigned to a Plugin level and permission. Bits are integers that increase by doubling the value - 1, 2, 4, 8, 16, 32, 64, 128, 512, 1024, and so forth. Avoid assigning numbers in between - such as 3 or 5 - because the permission won't calculate correctly.
9
+
Mautic calculates permissions based on bits assigned to a Plugin level and permission. Bits are integers that increase by doubling the value - 1, 2, 4, 8, 16, 32, 64, 128, 512, 1024, and so forth. Avoid assigning numbers in between, such as 3 or 5, because the permission won't calculate correctly.
10
10
11
11
For example, if ``HelloWorldBundle`` manages access to a ``worlds`` entity, the permission set for ``plugin:helloWorld:worlds`` resembles this setup:
12
12
@@ -29,9 +29,9 @@ For example, if ``HelloWorldBundle`` manages access to a ``worlds`` entity, the
29
29
30
30
.. note::
31
31
32
-
The notation ``plugin:helloWorld:worlds:view`` typically requests permission in Mautic. This notation tells Mautic to verify the ``view`` permission for the Plugin, ``HelloWorldBundle``, within the ``worlds`` level. Levels allow Plugins to set permissions for multiple areas.
32
+
The notation ``plugin:helloWorld:worlds:view`` typically requests permission in Mautic. This notation tells Mautic to verify the ``view`` permission for the Plugin ``HelloWorldBundle`` at the ``worlds`` level. Levels allow Plugins to set permissions for multiple areas.
33
33
34
-
Mautic takes the summation of the bits for the permissions given to a Role and stores it in the database. For example, if a Role has ``view`` and ``edit`` access, the stored bit is 3. If given ``view`` and ``create`` access, the stored bit is 5.
34
+
Mautic sums the bits for the permissions granted to a Role and stores the result in the database. For example, if a Role has ``view`` and ``edit`` access, the stored bit is 3. If given ``view`` and ``create`` access, the stored bit is 5.
35
35
36
36
When permission verification is necessary - for instance ``plugin:helloWorld:worlds:create`` - Mautic verifies if the Role's generated bit for ``plugin:helloWorld:worlds`` includes bit 4. If so, Mautic grants permission.
37
37
@@ -92,14 +92,14 @@ Using permissions
92
92
// do something
93
93
}
94
94
95
-
To determine if a User has a specific permission, use the Mautic security service which you can obtain from the ``mautic.security`` service.
95
+
To determine if a User has a specific permission, use the Mautic security service, which you can obtain from the ``mautic.security`` service.
96
96
97
97
Mautic uses specific notation to identify permissions:
98
98
99
99
* **Core bundles**: use the format ``bundleName:permissionLevel:permission``.
100
100
* **Plugins**: append the ``plugin:`` prefix. For example, ``plugin:bundleName:permissionLevel:permission``. Plugins require this prefix because it directs Mautic to search for the permission class within the ``plugins/`` directory and the ``MauticPlugin`` namespace.
101
101
102
-
Core bundles or Plugins set the permission level and permissions. For example, the Core UserBundle has ``users`` and ``roles`` levels with ``view``, ``edit``, ``create``, ``delete``, and ``full`` permissions for each. To verify if a User has permission to edit Roles, use:
102
+
Core bundles or Plugins set the permission level and permissions. For example, the core UserBundle has ``users`` and ``roles`` levels with ``view``, ``edit``, ``create``, ``delete``, and ``full`` permissions for each. To verify if a User has permission to edit Roles, use:
0 commit comments