@@ -12,5 +12,5 @@ |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | Broadcast::channel('users.{id}', function ($user, $id) { |
15 | - return (int) $user->id === (int) $id; |
|
15 | + return (int) $user->id === (int) $id; |
|
16 | 16 | }); |
@@ -11,6 +11,6 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Broadcast::channel('users.{id}', function ($user, $id) { |
|
14 | +Broadcast::channel('users.{id}', function($user, $id) { |
|
15 | 15 | return (int) $user->id === (int) $id; |
16 | 16 | }); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | |
5 | - /* |
|
5 | + /* |
|
6 | 6 | |-------------------------------------------------------------------------- |
7 | 7 | | Authentication Defaults |
8 | 8 | |-------------------------------------------------------------------------- |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | - 'defaults' => [ |
|
17 | - 'guard' => 'web', |
|
18 | - 'passwords' => 'users', |
|
19 | - ], |
|
16 | + 'defaults' => [ |
|
17 | + 'guard' => 'web', |
|
18 | + 'passwords' => 'users', |
|
19 | + ], |
|
20 | 20 | |
21 | - /* |
|
21 | + /* |
|
22 | 22 | |-------------------------------------------------------------------------- |
23 | 23 | | Authentication Guards |
24 | 24 | |-------------------------------------------------------------------------- |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | | |
36 | 36 | */ |
37 | 37 | |
38 | - 'guards' => [ |
|
39 | - 'web' => [ |
|
40 | - 'driver' => 'session', |
|
41 | - 'provider' => 'users', |
|
42 | - ], |
|
38 | + 'guards' => [ |
|
39 | + 'web' => [ |
|
40 | + 'driver' => 'session', |
|
41 | + 'provider' => 'users', |
|
42 | + ], |
|
43 | 43 | |
44 | - 'api' => [ |
|
45 | - 'driver' => 'passport', |
|
46 | - 'provider' => 'users', |
|
47 | - ], |
|
48 | - ], |
|
44 | + 'api' => [ |
|
45 | + 'driver' => 'passport', |
|
46 | + 'provider' => 'users', |
|
47 | + ], |
|
48 | + ], |
|
49 | 49 | |
50 | - /* |
|
50 | + /* |
|
51 | 51 | |-------------------------------------------------------------------------- |
52 | 52 | | User Providers |
53 | 53 | |-------------------------------------------------------------------------- |
@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | | |
65 | 65 | */ |
66 | 66 | |
67 | - 'providers' => [ |
|
68 | - 'users' => [ |
|
69 | - 'driver' => 'eloquent', |
|
70 | - 'model' => App\Modules\Users\AclUser::class, |
|
71 | - ], |
|
67 | + 'providers' => [ |
|
68 | + 'users' => [ |
|
69 | + 'driver' => 'eloquent', |
|
70 | + 'model' => App\Modules\Users\AclUser::class, |
|
71 | + ], |
|
72 | 72 | |
73 | - // 'users' => [ |
|
74 | - // 'driver' => 'database', |
|
75 | - // 'table' => 'users', |
|
76 | - // ], |
|
77 | - ], |
|
73 | + // 'users' => [ |
|
74 | + // 'driver' => 'database', |
|
75 | + // 'table' => 'users', |
|
76 | + // ], |
|
77 | + ], |
|
78 | 78 | |
79 | - /* |
|
79 | + /* |
|
80 | 80 | |-------------------------------------------------------------------------- |
81 | 81 | | Resetting Passwords |
82 | 82 | |-------------------------------------------------------------------------- |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | | |
92 | 92 | */ |
93 | 93 | |
94 | - 'passwords' => [ |
|
95 | - 'users' => [ |
|
96 | - 'provider' => 'users', |
|
97 | - 'table' => 'password_resets', |
|
98 | - 'expire' => 60, |
|
99 | - ], |
|
100 | - ], |
|
94 | + 'passwords' => [ |
|
95 | + 'users' => [ |
|
96 | + 'provider' => 'users', |
|
97 | + 'table' => 'password_resets', |
|
98 | + 'expire' => 60, |
|
99 | + ], |
|
100 | + ], |
|
101 | 101 | |
102 | 102 | ]; |
@@ -7,31 +7,31 @@ |
||
7 | 7 | |
8 | 8 | class AuthServiceProvider extends ServiceProvider |
9 | 9 | { |
10 | - /** |
|
11 | - * The policy mappings for the application. |
|
12 | - * |
|
13 | - * @var array |
|
14 | - */ |
|
15 | - protected $policies = [ |
|
16 | - 'App\Model' => 'App\Policies\ModelPolicy', |
|
17 | - ]; |
|
10 | + /** |
|
11 | + * The policy mappings for the application. |
|
12 | + * |
|
13 | + * @var array |
|
14 | + */ |
|
15 | + protected $policies = [ |
|
16 | + 'App\Model' => 'App\Policies\ModelPolicy', |
|
17 | + ]; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Register any authentication / authorization services. |
|
21 | - * |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function boot() |
|
25 | - { |
|
26 | - $this->registerPolicies(); |
|
19 | + /** |
|
20 | + * Register any authentication / authorization services. |
|
21 | + * |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function boot() |
|
25 | + { |
|
26 | + $this->registerPolicies(); |
|
27 | 27 | |
28 | - Passport::routes(function ($router) { |
|
29 | - $router->forAuthorization(); |
|
30 | - $router->forAccessTokens(); |
|
31 | - $router->forPersonalAccessTokens(); |
|
32 | - $router->forTransientTokens(); |
|
33 | - }); |
|
34 | - Passport::tokensExpireIn(\Carbon\Carbon::now()->addMinutes(10)); |
|
35 | - Passport::refreshTokensExpireIn(\Carbon\Carbon::now()->addDays(10)); |
|
36 | - } |
|
28 | + Passport::routes(function ($router) { |
|
29 | + $router->forAuthorization(); |
|
30 | + $router->forAccessTokens(); |
|
31 | + $router->forPersonalAccessTokens(); |
|
32 | + $router->forTransientTokens(); |
|
33 | + }); |
|
34 | + Passport::tokensExpireIn(\Carbon\Carbon::now()->addMinutes(10)); |
|
35 | + Passport::refreshTokensExpireIn(\Carbon\Carbon::now()->addDays(10)); |
|
36 | + } |
|
37 | 37 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | { |
26 | 26 | $this->registerPolicies(); |
27 | 27 | |
28 | - Passport::routes(function ($router) { |
|
28 | + Passport::routes(function($router) { |
|
29 | 29 | $router->forAuthorization(); |
30 | 30 | $router->forAccessTokens(); |
31 | 31 | $router->forPersonalAccessTokens(); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | |
5 | - /* |
|
5 | + /* |
|
6 | 6 | |-------------------------------------------------------------------------- |
7 | 7 | | Disable Confirm Email |
8 | 8 | |-------------------------------------------------------------------------- |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | - 'disable_confirm_email' => env('DISABLE_CONFIRM_EMAIL', false), |
|
14 | + 'disable_confirm_email' => env('DISABLE_CONFIRM_EMAIL', false), |
|
15 | 15 | |
16 | - /* |
|
16 | + /* |
|
17 | 17 | |-------------------------------------------------------------------------- |
18 | 18 | | Confirm Email URL |
19 | 19 | |-------------------------------------------------------------------------- |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | | |
23 | 23 | */ |
24 | 24 | |
25 | - 'confrim_email_url' => env('CONFIRM_EMAIL_URL'), |
|
25 | + 'confrim_email_url' => env('CONFIRM_EMAIL_URL'), |
|
26 | 26 | |
27 | - /* |
|
27 | + /* |
|
28 | 28 | |-------------------------------------------------------------------------- |
29 | 29 | | Reset Password URL |
30 | 30 | |-------------------------------------------------------------------------- |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | | |
34 | 34 | */ |
35 | 35 | |
36 | - 'reset_password_url' => env('RESET_PASSWORD_URL'), |
|
36 | + 'reset_password_url' => env('RESET_PASSWORD_URL'), |
|
37 | 37 | |
38 | - /* |
|
38 | + /* |
|
39 | 39 | |-------------------------------------------------------------------------- |
40 | 40 | | Passport Client Id |
41 | 41 | |-------------------------------------------------------------------------- |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | | |
45 | 45 | */ |
46 | 46 | |
47 | - 'passport_client_id' => env('PASSWORD_CLIENT_ID'), |
|
47 | + 'passport_client_id' => env('PASSWORD_CLIENT_ID'), |
|
48 | 48 | |
49 | - /* |
|
49 | + /* |
|
50 | 50 | |-------------------------------------------------------------------------- |
51 | 51 | | Passport Client Secret |
52 | 52 | |-------------------------------------------------------------------------- |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | | |
56 | 56 | */ |
57 | 57 | |
58 | - 'passport_client_secret' => env('PASSWORD_CLIENT_SECRET'), |
|
58 | + 'passport_client_secret' => env('PASSWORD_CLIENT_SECRET'), |
|
59 | 59 | |
60 | - /* |
|
60 | + /* |
|
61 | 61 | |-------------------------------------------------------------------------- |
62 | 62 | | Social Pass |
63 | 63 | |-------------------------------------------------------------------------- |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | | |
67 | 67 | */ |
68 | 68 | |
69 | - 'social_pass' => env('SOCIAL_PASS', false), |
|
69 | + 'social_pass' => env('SOCIAL_PASS', false), |
|
70 | 70 | |
71 | - /* |
|
71 | + /* |
|
72 | 72 | |-------------------------------------------------------------------------- |
73 | 73 | | Relations Between Models |
74 | 74 | |-------------------------------------------------------------------------- |
@@ -77,88 +77,88 @@ discard block |
||
77 | 77 | | |
78 | 78 | */ |
79 | 79 | |
80 | - 'relations' => [ |
|
81 | - 'user' => [ |
|
82 | - 'list' => [], |
|
83 | - 'find' => [], |
|
84 | - 'findby' => [], |
|
85 | - 'paginate' => [], |
|
86 | - 'paginateby' => [], |
|
87 | - 'first' => [], |
|
88 | - 'search' => [], |
|
89 | - 'account' => [], |
|
90 | - 'group' => [], |
|
91 | - 'deleted' => [], |
|
92 | - ], |
|
93 | - 'permission' => [ |
|
94 | - 'list' => [], |
|
95 | - 'find' => [], |
|
96 | - 'findby' => [], |
|
97 | - 'paginate' => [], |
|
98 | - 'paginateby' => [], |
|
99 | - 'first' => [], |
|
100 | - 'search' => [], |
|
101 | - 'deleted' => [], |
|
102 | - ], |
|
103 | - 'group' => [ |
|
104 | - 'list' => [], |
|
105 | - 'find' => [], |
|
106 | - 'findby' => [], |
|
107 | - 'paginate' => [], |
|
108 | - 'paginateby' => [], |
|
109 | - 'first' => [], |
|
110 | - 'search' => [], |
|
111 | - 'deleted' => [], |
|
112 | - ], |
|
113 | - 'oauthClient' => [ |
|
114 | - 'list' => [], |
|
115 | - 'find' => [], |
|
116 | - 'findby' => [], |
|
117 | - 'paginate' => [], |
|
118 | - 'paginateby' => [], |
|
119 | - 'first' => [], |
|
120 | - 'search' => [], |
|
121 | - 'account' => [], |
|
122 | - 'group' => [], |
|
123 | - 'deleted' => [], |
|
124 | - ], |
|
125 | - 'notification' => [ |
|
126 | - 'list' => [], |
|
127 | - 'unread' => [], |
|
128 | - ], |
|
129 | - 'pushNotificationDevice' => [ |
|
130 | - 'list' => [], |
|
131 | - 'find' => [], |
|
132 | - 'findby' => [], |
|
133 | - 'paginate' => [], |
|
134 | - 'paginateby' => [], |
|
135 | - 'first' => [], |
|
136 | - 'search' => [], |
|
137 | - 'deleted' => [], |
|
138 | - ], |
|
139 | - 'report' => [ |
|
140 | - 'list' => [], |
|
141 | - 'find' => [], |
|
142 | - 'findby' => [], |
|
143 | - 'paginate' => [], |
|
144 | - 'paginateby' => [], |
|
145 | - 'first' => [], |
|
146 | - 'search' => [], |
|
147 | - 'deleted' => [], |
|
148 | - ], |
|
149 | - 'setting' => [ |
|
150 | - 'list' => [], |
|
151 | - 'find' => [], |
|
152 | - 'findby' => [], |
|
153 | - 'paginate' => [], |
|
154 | - 'paginateby' => [], |
|
155 | - 'first' => [], |
|
156 | - 'search' => [], |
|
157 | - 'deleted' => [], |
|
158 | - ] |
|
159 | - ], |
|
80 | + 'relations' => [ |
|
81 | + 'user' => [ |
|
82 | + 'list' => [], |
|
83 | + 'find' => [], |
|
84 | + 'findby' => [], |
|
85 | + 'paginate' => [], |
|
86 | + 'paginateby' => [], |
|
87 | + 'first' => [], |
|
88 | + 'search' => [], |
|
89 | + 'account' => [], |
|
90 | + 'group' => [], |
|
91 | + 'deleted' => [], |
|
92 | + ], |
|
93 | + 'permission' => [ |
|
94 | + 'list' => [], |
|
95 | + 'find' => [], |
|
96 | + 'findby' => [], |
|
97 | + 'paginate' => [], |
|
98 | + 'paginateby' => [], |
|
99 | + 'first' => [], |
|
100 | + 'search' => [], |
|
101 | + 'deleted' => [], |
|
102 | + ], |
|
103 | + 'group' => [ |
|
104 | + 'list' => [], |
|
105 | + 'find' => [], |
|
106 | + 'findby' => [], |
|
107 | + 'paginate' => [], |
|
108 | + 'paginateby' => [], |
|
109 | + 'first' => [], |
|
110 | + 'search' => [], |
|
111 | + 'deleted' => [], |
|
112 | + ], |
|
113 | + 'oauthClient' => [ |
|
114 | + 'list' => [], |
|
115 | + 'find' => [], |
|
116 | + 'findby' => [], |
|
117 | + 'paginate' => [], |
|
118 | + 'paginateby' => [], |
|
119 | + 'first' => [], |
|
120 | + 'search' => [], |
|
121 | + 'account' => [], |
|
122 | + 'group' => [], |
|
123 | + 'deleted' => [], |
|
124 | + ], |
|
125 | + 'notification' => [ |
|
126 | + 'list' => [], |
|
127 | + 'unread' => [], |
|
128 | + ], |
|
129 | + 'pushNotificationDevice' => [ |
|
130 | + 'list' => [], |
|
131 | + 'find' => [], |
|
132 | + 'findby' => [], |
|
133 | + 'paginate' => [], |
|
134 | + 'paginateby' => [], |
|
135 | + 'first' => [], |
|
136 | + 'search' => [], |
|
137 | + 'deleted' => [], |
|
138 | + ], |
|
139 | + 'report' => [ |
|
140 | + 'list' => [], |
|
141 | + 'find' => [], |
|
142 | + 'findby' => [], |
|
143 | + 'paginate' => [], |
|
144 | + 'paginateby' => [], |
|
145 | + 'first' => [], |
|
146 | + 'search' => [], |
|
147 | + 'deleted' => [], |
|
148 | + ], |
|
149 | + 'setting' => [ |
|
150 | + 'list' => [], |
|
151 | + 'find' => [], |
|
152 | + 'findby' => [], |
|
153 | + 'paginate' => [], |
|
154 | + 'paginateby' => [], |
|
155 | + 'first' => [], |
|
156 | + 'search' => [], |
|
157 | + 'deleted' => [], |
|
158 | + ] |
|
159 | + ], |
|
160 | 160 | |
161 | - /* |
|
161 | + /* |
|
162 | 162 | |-------------------------------------------------------------------------- |
163 | 163 | | Cache Configurations |
164 | 164 | |-------------------------------------------------------------------------- |
@@ -167,46 +167,46 @@ discard block |
||
167 | 167 | | |
168 | 168 | */ |
169 | 169 | |
170 | - 'cache_config' => [ |
|
171 | - 'oauthClient' => [ |
|
172 | - 'cache' => [ |
|
173 | - 'all', |
|
174 | - 'find', |
|
175 | - 'findBy', |
|
176 | - 'paginate', |
|
177 | - 'paginateBy', |
|
178 | - 'first', |
|
179 | - 'search', |
|
180 | - 'deleted' |
|
181 | - ], |
|
182 | - 'clear' => [ |
|
183 | - 'update' => ['oauthClients', 'users', 'groups'], |
|
184 | - 'save' => ['oauthClients', 'users', 'groups'], |
|
185 | - 'delete' => ['oauthClients', 'users', 'groups'], |
|
186 | - 'restore' => ['oauthClients', 'users', 'groups'], |
|
187 | - 'revoke' => ['oauthClients', 'users', 'groups'], |
|
188 | - 'ubRevoke' => ['oauthClients', 'users', 'groups'], |
|
189 | - 'regenerateSecret' => ['oauthClients', 'users', 'groups'], |
|
190 | - ], |
|
191 | - ], |
|
192 | - 'setting' => [ |
|
193 | - 'cache' => [ |
|
194 | - 'all', |
|
195 | - 'find', |
|
196 | - 'findBy', |
|
197 | - 'paginate', |
|
198 | - 'paginateBy', |
|
199 | - 'first', |
|
200 | - 'search', |
|
201 | - 'deleted' |
|
202 | - ], |
|
203 | - 'clear' => [ |
|
204 | - 'update' => ['settings'], |
|
205 | - 'save' => ['settings'], |
|
206 | - 'delete' => ['settings'], |
|
207 | - 'restore' => ['settings'], |
|
208 | - 'saveMany' => ['settings'], |
|
209 | - ] |
|
210 | - ] |
|
211 | - ] |
|
170 | + 'cache_config' => [ |
|
171 | + 'oauthClient' => [ |
|
172 | + 'cache' => [ |
|
173 | + 'all', |
|
174 | + 'find', |
|
175 | + 'findBy', |
|
176 | + 'paginate', |
|
177 | + 'paginateBy', |
|
178 | + 'first', |
|
179 | + 'search', |
|
180 | + 'deleted' |
|
181 | + ], |
|
182 | + 'clear' => [ |
|
183 | + 'update' => ['oauthClients', 'users', 'groups'], |
|
184 | + 'save' => ['oauthClients', 'users', 'groups'], |
|
185 | + 'delete' => ['oauthClients', 'users', 'groups'], |
|
186 | + 'restore' => ['oauthClients', 'users', 'groups'], |
|
187 | + 'revoke' => ['oauthClients', 'users', 'groups'], |
|
188 | + 'ubRevoke' => ['oauthClients', 'users', 'groups'], |
|
189 | + 'regenerateSecret' => ['oauthClients', 'users', 'groups'], |
|
190 | + ], |
|
191 | + ], |
|
192 | + 'setting' => [ |
|
193 | + 'cache' => [ |
|
194 | + 'all', |
|
195 | + 'find', |
|
196 | + 'findBy', |
|
197 | + 'paginate', |
|
198 | + 'paginateBy', |
|
199 | + 'first', |
|
200 | + 'search', |
|
201 | + 'deleted' |
|
202 | + ], |
|
203 | + 'clear' => [ |
|
204 | + 'update' => ['settings'], |
|
205 | + 'save' => ['settings'], |
|
206 | + 'delete' => ['settings'], |
|
207 | + 'restore' => ['settings'], |
|
208 | + 'saveMany' => ['settings'], |
|
209 | + ] |
|
210 | + ] |
|
211 | + ] |
|
212 | 212 | ]; |
@@ -11,68 +11,68 @@ |
||
11 | 11 | |
12 | 12 | class CheckPermissions |
13 | 13 | { |
14 | - protected $route; |
|
15 | - protected $auth; |
|
16 | - protected $authMiddleware; |
|
17 | - protected $userService; |
|
18 | - protected $arr; |
|
14 | + protected $route; |
|
15 | + protected $auth; |
|
16 | + protected $authMiddleware; |
|
17 | + protected $userService; |
|
18 | + protected $arr; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Init new object. |
|
22 | - * |
|
23 | - * @param Route $route |
|
24 | - * @param Auth $auth |
|
25 | - * @param AuthMiddleware $authMiddleware |
|
26 | - * @param UserService $userService |
|
27 | - * @param Arr $arr |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function __construct(Route $route, Auth $auth, AuthMiddleware $authMiddleware, UserService $userService, Arr $arr) |
|
32 | - { |
|
33 | - $this->route = $route; |
|
34 | - $this->auth = $auth; |
|
35 | - $this->authMiddleware = $authMiddleware; |
|
36 | - $this->userService = $userService; |
|
37 | - $this->arr = $arr; |
|
38 | - } |
|
20 | + /** |
|
21 | + * Init new object. |
|
22 | + * |
|
23 | + * @param Route $route |
|
24 | + * @param Auth $auth |
|
25 | + * @param AuthMiddleware $authMiddleware |
|
26 | + * @param UserService $userService |
|
27 | + * @param Arr $arr |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function __construct(Route $route, Auth $auth, AuthMiddleware $authMiddleware, UserService $userService, Arr $arr) |
|
32 | + { |
|
33 | + $this->route = $route; |
|
34 | + $this->auth = $auth; |
|
35 | + $this->authMiddleware = $authMiddleware; |
|
36 | + $this->userService = $userService; |
|
37 | + $this->arr = $arr; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Handle an incoming request. |
|
42 | - * |
|
43 | - * @param \Illuminate\Http\Request $request |
|
44 | - * @param \Closure $next |
|
45 | - * @return mixed |
|
46 | - */ |
|
47 | - public function handle($request, Closure $next) |
|
48 | - { |
|
49 | - $routeActions = explode('@', $this->route->currentRouteAction()); |
|
50 | - $reflectionClass = new \ReflectionClass($routeActions[0]); |
|
51 | - $classProperties = $reflectionClass->getDefaultProperties(); |
|
52 | - $skipPermissionCheck = $this->arr->get($classProperties, 'skipPermissionCheck', []); |
|
53 | - $skipLoginCheck = $this->arr->get($classProperties, 'skipLoginCheck', []); |
|
54 | - $modelName = explode('\\', $routeActions[0]); |
|
55 | - $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
56 | - $permission = $routeActions[1]; |
|
40 | + /** |
|
41 | + * Handle an incoming request. |
|
42 | + * |
|
43 | + * @param \Illuminate\Http\Request $request |
|
44 | + * @param \Closure $next |
|
45 | + * @return mixed |
|
46 | + */ |
|
47 | + public function handle($request, Closure $next) |
|
48 | + { |
|
49 | + $routeActions = explode('@', $this->route->currentRouteAction()); |
|
50 | + $reflectionClass = new \ReflectionClass($routeActions[0]); |
|
51 | + $classProperties = $reflectionClass->getDefaultProperties(); |
|
52 | + $skipPermissionCheck = $this->arr->get($classProperties, 'skipPermissionCheck', []); |
|
53 | + $skipLoginCheck = $this->arr->get($classProperties, 'skipLoginCheck', []); |
|
54 | + $modelName = explode('\\', $routeActions[0]); |
|
55 | + $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
56 | + $permission = $routeActions[1]; |
|
57 | 57 | |
58 | - $this->auth->shouldUse('api'); |
|
59 | - if (! in_array($permission, $skipLoginCheck)) { |
|
60 | - $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
61 | - $user = $this->auth->user(); |
|
62 | - $isPasswordClient = $user->token()->client->password_client; |
|
58 | + $this->auth->shouldUse('api'); |
|
59 | + if (! in_array($permission, $skipLoginCheck)) { |
|
60 | + $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
61 | + $user = $this->auth->user(); |
|
62 | + $isPasswordClient = $user->token()->client->password_client; |
|
63 | 63 | |
64 | - if ($user->blocked) { |
|
65 | - \Errors::userIsBlocked(); |
|
66 | - } |
|
64 | + if ($user->blocked) { |
|
65 | + \Errors::userIsBlocked(); |
|
66 | + } |
|
67 | 67 | |
68 | - if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) { |
|
69 | - } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
70 | - } else { |
|
71 | - \Errors::noPermissions(); |
|
72 | - } |
|
73 | - }); |
|
74 | - } |
|
68 | + if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) { |
|
69 | + } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
70 | + } else { |
|
71 | + \Errors::noPermissions(); |
|
72 | + } |
|
73 | + }); |
|
74 | + } |
|
75 | 75 | |
76 | - return $next($request); |
|
77 | - } |
|
76 | + return $next($request); |
|
77 | + } |
|
78 | 78 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | $permission = $routeActions[1]; |
57 | 57 | |
58 | 58 | $this->auth->shouldUse('api'); |
59 | - if (! in_array($permission, $skipLoginCheck)) { |
|
60 | - $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
59 | + if ( ! in_array($permission, $skipLoginCheck)) { |
|
60 | + $this->authMiddleware->handle($request, function($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
61 | 61 | $user = $this->auth->user(); |
62 | 62 | $isPasswordClient = $user->token()->client->password_client; |
63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) { |
69 | - } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
69 | + } elseif ( ! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
70 | 70 | } else { |
71 | 71 | \Errors::noPermissions(); |
72 | 72 | } |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | class Errors extends Facade |
6 | 6 | { |
7 | - protected static function getFacadeAccessor() |
|
8 | - { |
|
9 | - return 'Errors'; |
|
10 | - } |
|
7 | + protected static function getFacadeAccessor() |
|
8 | + { |
|
9 | + return 'Errors'; |
|
10 | + } |
|
11 | 11 | } |
@@ -2,123 +2,123 @@ |
||
2 | 2 | |
3 | 3 | class Errors |
4 | 4 | { |
5 | - public function unAuthorized() |
|
6 | - { |
|
7 | - $error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')]; |
|
8 | - abort($error['status'], $error['message']); |
|
9 | - } |
|
10 | - |
|
11 | - public function invalidRefreshToken() |
|
12 | - { |
|
13 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')]; |
|
14 | - abort($error['status'], $error['message']); |
|
15 | - } |
|
16 | - |
|
17 | - public function noPermissions() |
|
18 | - { |
|
19 | - $error = ['status' => 403, 'message' => trans('core::errors.noPermissions')]; |
|
20 | - abort($error['status'], $error['message']); |
|
21 | - } |
|
22 | - |
|
23 | - public function loginFailed() |
|
24 | - { |
|
25 | - $error = ['status' => 400, 'message' => trans('core::errors.loginFailed')]; |
|
26 | - abort($error['status'], $error['message']); |
|
27 | - } |
|
28 | - |
|
29 | - public function noSocialEmail() |
|
30 | - { |
|
31 | - $error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')]; |
|
32 | - abort($error['status'], $error['message']); |
|
33 | - } |
|
34 | - |
|
35 | - public function userAlreadyRegistered() |
|
36 | - { |
|
37 | - $error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')]; |
|
38 | - abort($error['status'], $error['message']); |
|
39 | - } |
|
40 | - |
|
41 | - public function connectionError() |
|
42 | - { |
|
43 | - $error = ['status' => 400, 'message' => trans('core::errors.connectionError')]; |
|
44 | - abort($error['status'], $error['message']); |
|
45 | - } |
|
46 | - |
|
47 | - public function redisNotRunning() |
|
48 | - { |
|
49 | - $error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')]; |
|
50 | - abort($error['status'], $error['message']); |
|
51 | - } |
|
52 | - |
|
53 | - public function dbQueryError() |
|
54 | - { |
|
55 | - $error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')]; |
|
56 | - abort($error['status'], $error['message']); |
|
57 | - } |
|
58 | - |
|
59 | - public function cannotCreateSetting() |
|
60 | - { |
|
61 | - $error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')]; |
|
62 | - abort($error['status'], $error['message']); |
|
63 | - } |
|
64 | - |
|
65 | - public function cannotUpdateSettingKey() |
|
66 | - { |
|
67 | - $error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')]; |
|
68 | - abort($error['status'], $error['message']); |
|
69 | - } |
|
70 | - |
|
71 | - public function userIsBlocked() |
|
72 | - { |
|
73 | - $error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')]; |
|
74 | - abort($error['status'], $error['message']); |
|
75 | - } |
|
76 | - |
|
77 | - public function emailNotConfirmed() |
|
78 | - { |
|
79 | - $error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')]; |
|
80 | - abort($error['status'], $error['message']); |
|
81 | - } |
|
82 | - |
|
83 | - public function emailAlreadyConfirmed() |
|
84 | - { |
|
85 | - $error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')]; |
|
86 | - abort($error['status'], $error['message']); |
|
87 | - } |
|
88 | - |
|
89 | - public function invalidResetToken() |
|
90 | - { |
|
91 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')]; |
|
92 | - abort($error['status'], $error['message']); |
|
93 | - } |
|
94 | - |
|
95 | - public function invalidResetPassword() |
|
96 | - { |
|
97 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')]; |
|
98 | - abort($error['status'], $error['message']); |
|
99 | - } |
|
100 | - |
|
101 | - public function invalidOldPassword() |
|
102 | - { |
|
103 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')]; |
|
104 | - abort($error['status'], $error['message']); |
|
105 | - } |
|
106 | - |
|
107 | - public function invalidConfirmationCode() |
|
108 | - { |
|
109 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')]; |
|
110 | - abort($error['status'], $error['message']); |
|
111 | - } |
|
112 | - |
|
113 | - public function notFound($text) |
|
114 | - { |
|
115 | - $error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])]; |
|
116 | - abort($error['status'], $error['message']); |
|
117 | - } |
|
118 | - |
|
119 | - public function generalError() |
|
120 | - { |
|
121 | - $error = ['status' => 400, 'message' => trans('core::errors.generalError')]; |
|
122 | - abort($error['status'], $error['message']); |
|
123 | - } |
|
5 | + public function unAuthorized() |
|
6 | + { |
|
7 | + $error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')]; |
|
8 | + abort($error['status'], $error['message']); |
|
9 | + } |
|
10 | + |
|
11 | + public function invalidRefreshToken() |
|
12 | + { |
|
13 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')]; |
|
14 | + abort($error['status'], $error['message']); |
|
15 | + } |
|
16 | + |
|
17 | + public function noPermissions() |
|
18 | + { |
|
19 | + $error = ['status' => 403, 'message' => trans('core::errors.noPermissions')]; |
|
20 | + abort($error['status'], $error['message']); |
|
21 | + } |
|
22 | + |
|
23 | + public function loginFailed() |
|
24 | + { |
|
25 | + $error = ['status' => 400, 'message' => trans('core::errors.loginFailed')]; |
|
26 | + abort($error['status'], $error['message']); |
|
27 | + } |
|
28 | + |
|
29 | + public function noSocialEmail() |
|
30 | + { |
|
31 | + $error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')]; |
|
32 | + abort($error['status'], $error['message']); |
|
33 | + } |
|
34 | + |
|
35 | + public function userAlreadyRegistered() |
|
36 | + { |
|
37 | + $error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')]; |
|
38 | + abort($error['status'], $error['message']); |
|
39 | + } |
|
40 | + |
|
41 | + public function connectionError() |
|
42 | + { |
|
43 | + $error = ['status' => 400, 'message' => trans('core::errors.connectionError')]; |
|
44 | + abort($error['status'], $error['message']); |
|
45 | + } |
|
46 | + |
|
47 | + public function redisNotRunning() |
|
48 | + { |
|
49 | + $error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')]; |
|
50 | + abort($error['status'], $error['message']); |
|
51 | + } |
|
52 | + |
|
53 | + public function dbQueryError() |
|
54 | + { |
|
55 | + $error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')]; |
|
56 | + abort($error['status'], $error['message']); |
|
57 | + } |
|
58 | + |
|
59 | + public function cannotCreateSetting() |
|
60 | + { |
|
61 | + $error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')]; |
|
62 | + abort($error['status'], $error['message']); |
|
63 | + } |
|
64 | + |
|
65 | + public function cannotUpdateSettingKey() |
|
66 | + { |
|
67 | + $error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')]; |
|
68 | + abort($error['status'], $error['message']); |
|
69 | + } |
|
70 | + |
|
71 | + public function userIsBlocked() |
|
72 | + { |
|
73 | + $error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')]; |
|
74 | + abort($error['status'], $error['message']); |
|
75 | + } |
|
76 | + |
|
77 | + public function emailNotConfirmed() |
|
78 | + { |
|
79 | + $error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')]; |
|
80 | + abort($error['status'], $error['message']); |
|
81 | + } |
|
82 | + |
|
83 | + public function emailAlreadyConfirmed() |
|
84 | + { |
|
85 | + $error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')]; |
|
86 | + abort($error['status'], $error['message']); |
|
87 | + } |
|
88 | + |
|
89 | + public function invalidResetToken() |
|
90 | + { |
|
91 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')]; |
|
92 | + abort($error['status'], $error['message']); |
|
93 | + } |
|
94 | + |
|
95 | + public function invalidResetPassword() |
|
96 | + { |
|
97 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')]; |
|
98 | + abort($error['status'], $error['message']); |
|
99 | + } |
|
100 | + |
|
101 | + public function invalidOldPassword() |
|
102 | + { |
|
103 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')]; |
|
104 | + abort($error['status'], $error['message']); |
|
105 | + } |
|
106 | + |
|
107 | + public function invalidConfirmationCode() |
|
108 | + { |
|
109 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')]; |
|
110 | + abort($error['status'], $error['message']); |
|
111 | + } |
|
112 | + |
|
113 | + public function notFound($text) |
|
114 | + { |
|
115 | + $error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])]; |
|
116 | + abort($error['status'], $error['message']); |
|
117 | + } |
|
118 | + |
|
119 | + public function generalError() |
|
120 | + { |
|
121 | + $error = ['status' => 400, 'message' => trans('core::errors.generalError')]; |
|
122 | + abort($error['status'], $error['message']); |
|
123 | + } |
|
124 | 124 | } |
@@ -6,53 +6,53 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core'); |
|
18 | - |
|
19 | - $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app')); |
|
21 | - } |
|
22 | - |
|
23 | - /** |
|
24 | - * Register the module services. |
|
25 | - * |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public function register() |
|
29 | - { |
|
30 | - //Bind Core Facade to the Service Container |
|
31 | - $this->app->singleton('Core', function () { |
|
32 | - return new \App\Modules\Core\Core; |
|
33 | - }); |
|
34 | - |
|
35 | - //Bind Errors Facade to the Service Container |
|
36 | - $this->app->singleton('Errors', function () { |
|
37 | - return new \App\Modules\Core\Utl\Errors; |
|
38 | - }); |
|
39 | - |
|
40 | - //Bind CoreConfig Facade to the Service Container |
|
41 | - $this->app->singleton('CoreConfig', function () { |
|
42 | - return new \App\Modules\Core\Utl\CoreConfig; |
|
43 | - }); |
|
44 | - |
|
45 | - //Bind Media Facade to the Service Container |
|
46 | - $this->app->singleton('Media', function () { |
|
47 | - return new \App\Modules\Core\Utl\Media; |
|
48 | - }); |
|
49 | - |
|
50 | - //Bind ApiConsumer Facade to the Service Container |
|
51 | - $this->app->singleton('ApiConsumer', function () { |
|
52 | - $app = app(); |
|
53 | - return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
|
54 | - }); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core'); |
|
18 | + |
|
19 | + $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app')); |
|
21 | + } |
|
22 | + |
|
23 | + /** |
|
24 | + * Register the module services. |
|
25 | + * |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public function register() |
|
29 | + { |
|
30 | + //Bind Core Facade to the Service Container |
|
31 | + $this->app->singleton('Core', function () { |
|
32 | + return new \App\Modules\Core\Core; |
|
33 | + }); |
|
34 | + |
|
35 | + //Bind Errors Facade to the Service Container |
|
36 | + $this->app->singleton('Errors', function () { |
|
37 | + return new \App\Modules\Core\Utl\Errors; |
|
38 | + }); |
|
39 | + |
|
40 | + //Bind CoreConfig Facade to the Service Container |
|
41 | + $this->app->singleton('CoreConfig', function () { |
|
42 | + return new \App\Modules\Core\Utl\CoreConfig; |
|
43 | + }); |
|
44 | + |
|
45 | + //Bind Media Facade to the Service Container |
|
46 | + $this->app->singleton('Media', function () { |
|
47 | + return new \App\Modules\Core\Utl\Media; |
|
48 | + }); |
|
49 | + |
|
50 | + //Bind ApiConsumer Facade to the Service Container |
|
51 | + $this->app->singleton('ApiConsumer', function () { |
|
52 | + $app = app(); |
|
53 | + return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
|
54 | + }); |
|
55 | 55 | |
56 | - $this->app->register(RouteServiceProvider::class); |
|
57 | - } |
|
56 | + $this->app->register(RouteServiceProvider::class); |
|
57 | + } |
|
58 | 58 | } |
@@ -28,27 +28,27 @@ |
||
28 | 28 | public function register() |
29 | 29 | { |
30 | 30 | //Bind Core Facade to the Service Container |
31 | - $this->app->singleton('Core', function () { |
|
31 | + $this->app->singleton('Core', function() { |
|
32 | 32 | return new \App\Modules\Core\Core; |
33 | 33 | }); |
34 | 34 | |
35 | 35 | //Bind Errors Facade to the Service Container |
36 | - $this->app->singleton('Errors', function () { |
|
36 | + $this->app->singleton('Errors', function() { |
|
37 | 37 | return new \App\Modules\Core\Utl\Errors; |
38 | 38 | }); |
39 | 39 | |
40 | 40 | //Bind CoreConfig Facade to the Service Container |
41 | - $this->app->singleton('CoreConfig', function () { |
|
41 | + $this->app->singleton('CoreConfig', function() { |
|
42 | 42 | return new \App\Modules\Core\Utl\CoreConfig; |
43 | 43 | }); |
44 | 44 | |
45 | 45 | //Bind Media Facade to the Service Container |
46 | - $this->app->singleton('Media', function () { |
|
46 | + $this->app->singleton('Media', function() { |
|
47 | 47 | return new \App\Modules\Core\Utl\Media; |
48 | 48 | }); |
49 | 49 | |
50 | 50 | //Bind ApiConsumer Facade to the Service Container |
51 | - $this->app->singleton('ApiConsumer', function () { |
|
51 | + $this->app->singleton('ApiConsumer', function() { |
|
52 | 52 | $app = app(); |
53 | 53 | return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
54 | 54 | }); |
@@ -5,14 +5,14 @@ |
||
5 | 5 | |
6 | 6 | class DummyService extends BaseService |
7 | 7 | { |
8 | - /** |
|
9 | - * Init new object. |
|
10 | - * |
|
11 | - * @param DummyRepository $repo |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function __construct(DummyRepository $repo) |
|
15 | - { |
|
16 | - parent::__construct($repo); |
|
17 | - } |
|
8 | + /** |
|
9 | + * Init new object. |
|
10 | + * |
|
11 | + * @param DummyRepository $repo |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function __construct(DummyRepository $repo) |
|
15 | + { |
|
16 | + parent::__construct($repo); |
|
17 | + } |
|
18 | 18 | } |