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/book/v3/configuration.md
+85-16Lines changed: 85 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,8 @@
2
2
3
3
As with many Dotkernel modules, we focus on the configuration based approach of customizing the module for your needs.
4
4
5
-
After installing, merge the module's `ConfigProvider` with your application's config to make sure required dependencies and default module configuration are registered. Create a configuration file for this module in your 'config/autoload' folder.
5
+
After installing, merge the module's `ConfigProvider` with your application's config to make sure required dependencies and default module configuration are registered.
6
+
Create a configuration file for this module in your 'config/autoload' folder.
6
7
7
8
## authorization-guards.global.php
8
9
@@ -41,8 +42,8 @@ return [
41
42
'logout' => ['admin', 'user', 'viewer'],
42
43
'account' => ['admin', 'user'],
43
44
'home' => ['*'],
44
-
]
45
-
]
45
+
],
46
+
],
46
47
],
47
48
[
48
49
'type' => 'RoutePermission',
@@ -51,40 +52,40 @@ return [
51
52
'premium' => ['premium'],
52
53
'account' => ['my-account'],
53
54
'logout' => ['only-logged'],
54
-
]
55
-
]
55
+
],
56
+
],
56
57
],
57
58
[
58
59
'type' => 'Controller',
59
60
'options' => [
60
61
'rules' => [
61
62
[
62
63
'route' => 'controller route name',
63
-
'actions' => [//list of actions to apply, or empty array for all actions],
64
-
//by default, authorization pass if all permissions are present(AND)
65
-
'roles' => [//list of roles to allow],
64
+
'actions' => [], //list of actions to apply, or empty array for all actions,
65
+
//by default, authorization passes if all permissions are present(AND)
66
+
'roles' => ['admin'], //list of roles to allow,
66
67
],
67
-
]
68
-
]
68
+
],
69
+
],
69
70
],
70
71
[
71
72
'type' => 'ControllerPermission',
72
73
'options' => [
73
74
'rules' => [
74
75
[
75
76
'route' => 'controller route name',
76
-
'actions' => [//list of actions to apply, or empty array for all actions],
77
-
//by default, authorization pass if all permissions are present(AND)
78
-
'permissions' => [//list of permissions to allow],
77
+
'actions' => [], //list of actions to apply, or empty array for all actions,
78
+
//by default, authorization passes if all permissions are present(AND)
79
+
'permissions' => ['authenticated'], //list of permissions to allow,
79
80
],
80
81
[
81
82
'route' => 'controller route name',
82
-
'actions' => [//list of actions to apply, or empty array for all actions],
83
+
'actions' => [], //list of actions to apply, or empty array for all actions,
83
84
'permissions' => [
84
85
//permission can be defined in this way too, for all permission type guards
85
-
'permissions' => [//list of permissions],
86
+
'permissions' => ['authenticated'], //list of permissions,
> It is **strongly recommended** to explicitly define permissions or roles and not leave the values empty, especially if using `GuardInterface::POLICY_DENY`!
109
+
110
+
## Route Name Placeholders
111
+
112
+
Route **names** are allowed to contain `*` as placeholders, allowing more compact specifications.
113
+
This feature is available for all types of guards.
114
+
115
+
> Note that route rules are verified in order of their writing, take care of the order when using placeholder routes, as not to overwrite any specific routes!
0 commit comments