Skip to content

Commit abfb800

Browse files
authored
added comment with new possible rbac guard config
Signed-off-by: Jurj-Bogdan <[email protected]>
1 parent f46355c commit abfb800

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

config/autoload/authorization-guards.global.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
'type' => 'RoutePermission',
1919
'options' => [
2020
'rules' => [
21-
'admin::login-admin-form' => [],
22-
'admin::login-admin' => [],
21+
'admin::login-admin-form' => ['unauthenticated'],
22+
'admin::login-admin' => ['unauthenticated'],
2323
'admin::create-admin-form' => ['authenticated'],
2424
'admin::create-admin' => ['authenticated'],
2525
'admin::delete-admin-form' => ['authenticated'],
@@ -48,6 +48,34 @@
4848
],
4949
],
5050
],
51+
/*
52+
// Using version ^3.6.1 or ^4.1.1 of dot-rbac-guard now allows using placeholders (*) for route names
53+
// Here are a few ways the above configuration could be written instead:
54+
[
55+
'type' => 'RoutePermission',
56+
'options' => [
57+
'rules' => [
58+
// you can use placeholders for specific actions
59+
'admin::login-*' => ['unauthenticated'],
60+
'admin::create-*' => ['authenticated'],
61+
'admin::delete-*' => ['authenticated'],
62+
'admin::edit-*' => ['authenticated'],
63+
'admin::list-*' => ['authenticated'],
64+
// you may still use full route names
65+
'admin::change-account-password' => ['authenticated'],
66+
'admin::logout-admin' => ['authenticated'],
67+
'app::index-redirect' => ['authenticated'],
68+
'dashboard::view-dashboard' => ['authenticated'],
69+
'page::components' => ['authenticated'],
70+
// or even more permissive
71+
'setting::*' => ['authenticated'],
72+
'user::*' => ['authenticated'],
73+
],
74+
],
75+
],
76+
*/
77+
// You can find more details in the dot-rbac-guard documentation
78+
// https://docs.dotkernel.org/dot-rbac-guard/v4/configuration/
5179
],
5280
],
5381
],

0 commit comments

Comments
 (0)