-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathauthorization-guards.global.php
More file actions
83 lines (80 loc) · 4.78 KB
/
Copy pathauthorization-guards.global.php
File metadata and controls
83 lines (80 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
declare(strict_types=1);
use Dot\Rbac\Guard\Guard\GuardInterface;
return [
'dot_authorization' => [
'protection_policy' => GuardInterface::POLICY_ALLOW,
'event_listeners' => [],
'guards_provider_manager' => [],
'guard_manager' => [],
'guards_provider' => [
'type' => 'ArrayGuards',
'options' => [
'guards' => [
[
'type' => 'RoutePermission',
'options' => [
'rules' => [
'admin::login-admin-form' => ['unauthenticated'],
'admin::login-admin' => ['unauthenticated'],
'admin::create-admin-form' => ['authenticated'],
'admin::create-admin' => ['authenticated'],
'admin::delete-admin-form' => ['authenticated'],
'admin::delete-admin' => ['authenticated'],
'admin::edit-admin-form' => ['authenticated'],
'admin::edit-admin' => ['authenticated'],
'admin::list-admin' => ['authenticated'],
'admin::list-admin-login' => ['authenticated'],
'admin::change-account-password' => ['authenticated'],
'admin::edit-account-form' => ['authenticated'],
'admin::edit-account' => ['authenticated'],
'admin::logout-admin' => ['authenticated'],
'app::index-redirect' => ['authenticated'],
'dashboard::view-dashboard' => ['authenticated'],
'page::components' => ['authenticated'],
'setting::store-setting' => ['authenticated'],
'setting::view-setting' => ['authenticated'],
'user::create-user-form' => ['authenticated'],
'user::create-user' => ['authenticated'],
'user::edit-user-form' => ['authenticated'],
'user::edit-user' => ['authenticated'],
'user::delete-user-form' => ['authenticated'],
'user::delete-user' => ['authenticated'],
'user::list-user' => ['authenticated'],
'user::edit-user-avatar' => ['authenticated'],
],
],
],
/*
// Using version ^3.6.1 or ^4.1.1 of dot-rbac-guard allows using placeholders (*) for route names
// Here are a few ways the above configuration could be written instead:
[
'type' => 'RoutePermission',
'options' => [
'rules' => [
// you can use placeholders for specific actions
'admin::login-*' => ['unauthenticated'],
'admin::create-*' => ['authenticated'],
'admin::delete-*' => ['authenticated'],
'admin::edit-*' => ['authenticated'],
'admin::list-*' => ['authenticated'],
// you may still use full route names
'admin::change-account-password' => ['authenticated'],
'admin::logout-admin' => ['authenticated'],
'app::index-redirect' => ['authenticated'],
'dashboard::view-dashboard' => ['authenticated'],
'page::components' => ['authenticated'],
// or even more permissive
'setting::*' => ['authenticated'],
'user::*' => ['authenticated'],
],
],
],
*/
// You can find more details in the dot-rbac-guard documentation
// https://docs.dotkernel.org/dot-rbac-guard/v4/configuration/
],
],
],
],
];