|
18 | 18 | 'type' => 'RoutePermission', |
19 | 19 | 'options' => [ |
20 | 20 | 'rules' => [ |
21 | | - 'admin::login-admin-form' => [], |
22 | | - 'admin::login-admin' => [], |
| 21 | + 'admin::login-admin-form' => ['unauthenticated'], |
| 22 | + 'admin::login-admin' => ['unauthenticated'], |
23 | 23 | 'admin::create-admin-form' => ['authenticated'], |
24 | 24 | 'admin::create-admin' => ['authenticated'], |
25 | 25 | 'admin::delete-admin-form' => ['authenticated'], |
|
48 | 48 | ], |
49 | 49 | ], |
50 | 50 | ], |
| 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/ |
51 | 79 | ], |
52 | 80 | ], |
53 | 81 | ], |
|
0 commit comments