@@ -10,21 +10,21 @@ |
||
10 | 10 | class Permission extends Model |
11 | 11 | { |
12 | 12 | |
13 | - use SoftDeletes; |
|
14 | - protected $table = 'permissions'; |
|
15 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
16 | - protected $hidden = ['deleted_at']; |
|
17 | - protected $guarded = ['id']; |
|
18 | - public $fillable = ['name', 'model']; |
|
13 | + use SoftDeletes; |
|
14 | + protected $table = 'permissions'; |
|
15 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
16 | + protected $hidden = ['deleted_at']; |
|
17 | + protected $guarded = ['id']; |
|
18 | + public $fillable = ['name', 'model']; |
|
19 | 19 | |
20 | - public function roles() |
|
21 | - { |
|
22 | - return $this->belongsToMany(Role::class, 'permission_role', 'permission_id', 'role_id')->whereNull('permission_role.deleted_at')->withTimestamps(); |
|
23 | - } |
|
20 | + public function roles() |
|
21 | + { |
|
22 | + return $this->belongsToMany(Role::class, 'permission_role', 'permission_id', 'role_id')->whereNull('permission_role.deleted_at')->withTimestamps(); |
|
23 | + } |
|
24 | 24 | |
25 | - public static function boot() |
|
26 | - { |
|
27 | - parent::boot(); |
|
28 | - Permission::observe(PermissionObserver::class); |
|
29 | - } |
|
25 | + public static function boot() |
|
26 | + { |
|
27 | + parent::boot(); |
|
28 | + Permission::observe(PermissionObserver::class); |
|
29 | + } |
|
30 | 30 | } |
@@ -11,26 +11,26 @@ |
||
11 | 11 | class Role extends Model |
12 | 12 | { |
13 | 13 | |
14 | - use SoftDeletes; |
|
15 | - protected $table = 'roles'; |
|
16 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
17 | - protected $hidden = ['deleted_at']; |
|
18 | - protected $guarded = ['id']; |
|
19 | - public $fillable = ['name']; |
|
14 | + use SoftDeletes; |
|
15 | + protected $table = 'roles'; |
|
16 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
17 | + protected $hidden = ['deleted_at']; |
|
18 | + protected $guarded = ['id']; |
|
19 | + public $fillable = ['name']; |
|
20 | 20 | |
21 | - public function users() |
|
22 | - { |
|
23 | - return $this->belongsToMany(AclUser::class, 'role_user', 'role_id', 'user_id')->whereNull('role_user.deleted_at')->withTimestamps(); |
|
24 | - } |
|
21 | + public function users() |
|
22 | + { |
|
23 | + return $this->belongsToMany(AclUser::class, 'role_user', 'role_id', 'user_id')->whereNull('role_user.deleted_at')->withTimestamps(); |
|
24 | + } |
|
25 | 25 | |
26 | - public function permissions() |
|
27 | - { |
|
28 | - return $this->belongsToMany(Permission::class, 'permission_role', 'role_id', 'permission_id')->whereNull('permission_role.deleted_at')->withTimestamps(); |
|
29 | - } |
|
26 | + public function permissions() |
|
27 | + { |
|
28 | + return $this->belongsToMany(Permission::class, 'permission_role', 'role_id', 'permission_id')->whereNull('permission_role.deleted_at')->withTimestamps(); |
|
29 | + } |
|
30 | 30 | |
31 | - public static function boot() |
|
32 | - { |
|
33 | - parent::boot(); |
|
34 | - Role::observe(RoleObserver::class); |
|
35 | - } |
|
31 | + public static function boot() |
|
32 | + { |
|
33 | + parent::boot(); |
|
34 | + Role::observe(RoleObserver::class); |
|
35 | + } |
|
36 | 36 | } |
@@ -10,32 +10,32 @@ |
||
10 | 10 | class PushNotificationDevice extends Model |
11 | 11 | { |
12 | 12 | |
13 | - use SoftDeletes; |
|
14 | - protected $table = 'push_notification_devices'; |
|
15 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
16 | - protected $hidden = ['deleted_at', 'access_token']; |
|
17 | - protected $guarded = ['id']; |
|
18 | - public $fillable = ['device_token', 'user_id', 'access_token']; |
|
13 | + use SoftDeletes; |
|
14 | + protected $table = 'push_notification_devices'; |
|
15 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
16 | + protected $hidden = ['deleted_at', 'access_token']; |
|
17 | + protected $guarded = ['id']; |
|
18 | + public $fillable = ['device_token', 'user_id', 'access_token']; |
|
19 | 19 | |
20 | - public function user() |
|
21 | - { |
|
22 | - return $this->belongsTo(AclUser::class); |
|
23 | - } |
|
20 | + public function user() |
|
21 | + { |
|
22 | + return $this->belongsTo(AclUser::class); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Encrypt the access_token attribute before |
|
27 | - * saving it in the storage. |
|
28 | - * |
|
29 | - * @param string $value |
|
30 | - */ |
|
31 | - public function setLoginTokenAttribute($value) |
|
32 | - { |
|
33 | - $this->attributes['access_token'] = encrypt($value); |
|
34 | - } |
|
25 | + /** |
|
26 | + * Encrypt the access_token attribute before |
|
27 | + * saving it in the storage. |
|
28 | + * |
|
29 | + * @param string $value |
|
30 | + */ |
|
31 | + public function setLoginTokenAttribute($value) |
|
32 | + { |
|
33 | + $this->attributes['access_token'] = encrypt($value); |
|
34 | + } |
|
35 | 35 | |
36 | - public static function boot() |
|
37 | - { |
|
38 | - parent::boot(); |
|
39 | - PushNotificationDevice::observe(PushNotificationDeviceObserver::class); |
|
40 | - } |
|
36 | + public static function boot() |
|
37 | + { |
|
38 | + parent::boot(); |
|
39 | + PushNotificationDevice::observe(PushNotificationDeviceObserver::class); |
|
40 | + } |
|
41 | 41 | } |
@@ -6,64 +6,64 @@ |
||
6 | 6 | |
7 | 7 | class PushNotificationDevicesTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to settings table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * pushNotificationDevices model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'index', |
|
26 | - 'model' => 'pushNotificationDevice', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'show', |
|
32 | - 'model' => 'pushNotificationDevice', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'store', |
|
38 | - 'model' => 'pushNotificationDevice', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'update', |
|
44 | - 'model' => 'pushNotificationDevice', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'destroy', |
|
50 | - 'model' => 'pushNotificationDevice', |
|
51 | - 'created_at' => \DB::raw('NOW()'), |
|
52 | - 'updated_at' => \DB::raw('NOW()') |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'name' => 'deleted', |
|
56 | - 'model' => 'pushNotificationDevice', |
|
57 | - 'created_at' => \DB::raw('NOW()'), |
|
58 | - 'updated_at' => \DB::raw('NOW()') |
|
59 | - ], |
|
60 | - [ |
|
61 | - 'name' => 'restore', |
|
62 | - 'model' => 'pushNotificationDevice', |
|
63 | - 'created_at' => \DB::raw('NOW()'), |
|
64 | - 'updated_at' => \DB::raw('NOW()') |
|
65 | - ] |
|
66 | - ] |
|
67 | - ); |
|
68 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to settings table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * pushNotificationDevices model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'index', |
|
26 | + 'model' => 'pushNotificationDevice', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'show', |
|
32 | + 'model' => 'pushNotificationDevice', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'store', |
|
38 | + 'model' => 'pushNotificationDevice', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'update', |
|
44 | + 'model' => 'pushNotificationDevice', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'destroy', |
|
50 | + 'model' => 'pushNotificationDevice', |
|
51 | + 'created_at' => \DB::raw('NOW()'), |
|
52 | + 'updated_at' => \DB::raw('NOW()') |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'name' => 'deleted', |
|
56 | + 'model' => 'pushNotificationDevice', |
|
57 | + 'created_at' => \DB::raw('NOW()'), |
|
58 | + 'updated_at' => \DB::raw('NOW()') |
|
59 | + ], |
|
60 | + [ |
|
61 | + 'name' => 'restore', |
|
62 | + 'model' => 'pushNotificationDevice', |
|
63 | + 'created_at' => \DB::raw('NOW()'), |
|
64 | + 'updated_at' => \DB::raw('NOW()') |
|
65 | + ] |
|
66 | + ] |
|
67 | + ); |
|
68 | + } |
|
69 | 69 | } |
@@ -8,17 +8,17 @@ |
||
8 | 8 | |
9 | 9 | class OauthClient extends Client |
10 | 10 | { |
11 | - protected $dates = ['created_at', 'updated_at']; |
|
12 | - public $fillable = ['name', 'redirect', 'user_id', 'personal_access_client', 'password_client', 'revoked']; |
|
11 | + protected $dates = ['created_at', 'updated_at']; |
|
12 | + public $fillable = ['name', 'redirect', 'user_id', 'personal_access_client', 'password_client', 'revoked']; |
|
13 | 13 | |
14 | - public function user() |
|
15 | - { |
|
16 | - return $this->belongsTo(AclUser::class); |
|
17 | - } |
|
14 | + public function user() |
|
15 | + { |
|
16 | + return $this->belongsTo(AclUser::class); |
|
17 | + } |
|
18 | 18 | |
19 | - public static function boot() |
|
20 | - { |
|
21 | - parent::boot(); |
|
22 | - OauthClient::observe(OauthClientObserver::class); |
|
23 | - } |
|
19 | + public static function boot() |
|
20 | + { |
|
21 | + parent::boot(); |
|
22 | + OauthClient::observe(OauthClientObserver::class); |
|
23 | + } |
|
24 | 24 | } |
@@ -8,40 +8,40 @@ |
||
8 | 8 | |
9 | 9 | class SetSessions |
10 | 10 | { |
11 | - protected $app; |
|
12 | - protected $session; |
|
11 | + protected $app; |
|
12 | + protected $session; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Init new object. |
|
16 | - * |
|
17 | - * @param App $app |
|
18 | - * @param Session $session |
|
19 | - * |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public function __construct(App $app, Session $session) |
|
23 | - { |
|
24 | - $this->app = $app; |
|
25 | - $this->session = $session; |
|
26 | - } |
|
14 | + /** |
|
15 | + * Init new object. |
|
16 | + * |
|
17 | + * @param App $app |
|
18 | + * @param Session $session |
|
19 | + * |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + public function __construct(App $app, Session $session) |
|
23 | + { |
|
24 | + $this->app = $app; |
|
25 | + $this->session = $session; |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Handle an incoming request. |
|
30 | - * |
|
31 | - * @param \Illuminate\Http\Request $request |
|
32 | - * @param \Closure $next |
|
33 | - * @return mixed |
|
34 | - */ |
|
35 | - public function handle($request, Closure $next) |
|
36 | - { |
|
37 | - $locale = $request->header('Accept-Language', 'en'); |
|
38 | - $locale = $locale == 'ar' || $locale == 'all' ? $locale : 'en'; |
|
39 | - $timeZone = $request->header('time-zone', 0); |
|
28 | + /** |
|
29 | + * Handle an incoming request. |
|
30 | + * |
|
31 | + * @param \Illuminate\Http\Request $request |
|
32 | + * @param \Closure $next |
|
33 | + * @return mixed |
|
34 | + */ |
|
35 | + public function handle($request, Closure $next) |
|
36 | + { |
|
37 | + $locale = $request->header('Accept-Language', 'en'); |
|
38 | + $locale = $locale == 'ar' || $locale == 'all' ? $locale : 'en'; |
|
39 | + $timeZone = $request->header('time-zone', 0); |
|
40 | 40 | |
41 | - $this->session->put('time-zone', $timeZone); |
|
42 | - $this->session->put('locale', $locale); |
|
43 | - $this->app->setLocale($locale); |
|
41 | + $this->session->put('time-zone', $timeZone); |
|
42 | + $this->session->put('locale', $locale); |
|
43 | + $this->app->setLocale($locale); |
|
44 | 44 | |
45 | - return $next($request); |
|
46 | - } |
|
45 | + return $next($request); |
|
46 | + } |
|
47 | 47 | } |
@@ -8,39 +8,39 @@ |
||
8 | 8 | |
9 | 9 | class SetRelations |
10 | 10 | { |
11 | - protected $arr; |
|
12 | - protected $route; |
|
11 | + protected $arr; |
|
12 | + protected $route; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Init new object. |
|
16 | - * |
|
17 | - * @param Route $route |
|
18 | - * @param Arr $arr |
|
19 | - * |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public function __construct(Route $route, Arr $arr) |
|
23 | - { |
|
24 | - $this->arr = $arr; |
|
25 | - $this->route = $route; |
|
26 | - } |
|
14 | + /** |
|
15 | + * Init new object. |
|
16 | + * |
|
17 | + * @param Route $route |
|
18 | + * @param Arr $arr |
|
19 | + * |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + public function __construct(Route $route, Arr $arr) |
|
23 | + { |
|
24 | + $this->arr = $arr; |
|
25 | + $this->route = $route; |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Handle an incoming request. |
|
30 | - * |
|
31 | - * @param \Illuminate\Http\Request $request |
|
32 | - * @param \Closure $next |
|
33 | - * @return mixed |
|
34 | - */ |
|
35 | - public function handle($request, Closure $next) |
|
36 | - { |
|
37 | - $routeActions = explode('@', $this->route->currentRouteAction()); |
|
38 | - $modelName = explode('\\', $routeActions[0]); |
|
39 | - $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
40 | - $route = explode('@', $this->route->currentRouteAction())[1]; |
|
41 | - $relations = $this->arr->get(config('core.relations'), $modelName, false); |
|
42 | - $request->relations = $relations && isset($relations[$route]) ? $relations[$route] : []; |
|
28 | + /** |
|
29 | + * Handle an incoming request. |
|
30 | + * |
|
31 | + * @param \Illuminate\Http\Request $request |
|
32 | + * @param \Closure $next |
|
33 | + * @return mixed |
|
34 | + */ |
|
35 | + public function handle($request, Closure $next) |
|
36 | + { |
|
37 | + $routeActions = explode('@', $this->route->currentRouteAction()); |
|
38 | + $modelName = explode('\\', $routeActions[0]); |
|
39 | + $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
40 | + $route = explode('@', $this->route->currentRouteAction())[1]; |
|
41 | + $relations = $this->arr->get(config('core.relations'), $modelName, false); |
|
42 | + $request->relations = $relations && isset($relations[$route]) ? $relations[$route] : []; |
|
43 | 43 | |
44 | - return $next($request); |
|
45 | - } |
|
44 | + return $next($request); |
|
45 | + } |
|
46 | 46 | } |
@@ -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, $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, $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, $permission) { |
|
59 | + if ( ! in_array($permission, $skipLoginCheck)) { |
|
60 | + $this->authMiddleware->handle($request, function($request) use ($modelName, $skipPermissionCheck, $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 | } |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | |
5 | - /** |
|
6 | - * Here goes your error messages. |
|
7 | - */ |
|
8 | - 'connectionError' => 'Connection error', |
|
9 | - 'redisNotRunning' => 'Your redis notification server is\'t running', |
|
10 | - 'dbQueryError' => 'Please check the given inputes', |
|
11 | - 'cannotCreateSetting' => 'Can\'t create setting', |
|
12 | - 'cannotUpdateSettingKey' => 'Can\'t update setting key', |
|
13 | - 'notFound' => 'The requested :replace not found', |
|
14 | - 'cannotUploadImage' => 'Can\'t upload the given image' |
|
5 | + /** |
|
6 | + * Here goes your error messages. |
|
7 | + */ |
|
8 | + 'connectionError' => 'Connection error', |
|
9 | + 'redisNotRunning' => 'Your redis notification server is\'t running', |
|
10 | + 'dbQueryError' => 'Please check the given inputes', |
|
11 | + 'cannotCreateSetting' => 'Can\'t create setting', |
|
12 | + 'cannotUpdateSettingKey' => 'Can\'t update setting key', |
|
13 | + 'notFound' => 'The requested :replace not found', |
|
14 | + 'cannotUploadImage' => 'Can\'t upload the given image' |
|
15 | 15 | |
16 | 16 | ]; |