This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Mamikon\RoleManager; |
||
4 | |||
5 | use Illuminate\Support\Facades\Request; |
||
6 | use \Illuminate\Support\ServiceProvider; |
||
7 | use Illuminate\Support\Facades\Validator; |
||
8 | use Mamikon\RoleManager\Commands\RoleMangerCommand; |
||
9 | |||
10 | /** |
||
11 | * Class RoleManagerProvider |
||
12 | * |
||
13 | * @category Laravel_Package |
||
14 | * @package Mamikon\RoleManager |
||
15 | * @author Mamikon Arakelyan <[email protected]> |
||
16 | * @license https://github.com/mamikon/role-manager/blob/master/LICENSE.md MIT |
||
17 | * @link https://github.com/mamikon/role-manager |
||
18 | */ |
||
19 | class RoleManagerProvider extends ServiceProvider |
||
20 | { |
||
21 | /** |
||
22 | * Bootstrap the application services. |
||
23 | * |
||
24 | * @return void |
||
25 | */ |
||
26 | public function boot() |
||
27 | { |
||
28 | $this->_extendedValidation(); |
||
29 | $this->_loadParts(); |
||
30 | $this->_publish(); |
||
31 | if ($this->app->runningInConsole()) { |
||
32 | $this->commands( |
||
33 | [RoleMangerCommand::class,] |
||
34 | ); |
||
35 | } |
||
36 | $roleManager = new RoleManager(); |
||
37 | $roleManager->defineAllPermissions(); |
||
38 | $this->app->instance('Mamikon\RoleManager', $roleManager); |
||
39 | |||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Register the application services. |
||
44 | * |
||
45 | * @return void |
||
46 | */ |
||
47 | public function register() |
||
48 | { |
||
49 | // |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Publish package Components |
||
54 | * |
||
55 | * @return void |
||
56 | */ |
||
57 | private function _publish() |
||
58 | { |
||
59 | $this->publishes( |
||
60 | [ |
||
61 | __DIR__ . '/config.php' => config_path('roleManager.php'), |
||
62 | ] |
||
63 | ); |
||
64 | $this->publishes( |
||
65 | [ |
||
66 | __DIR__ . '/translations' |
||
67 | => resource_path('lang/vendor/roleManager'), |
||
68 | ] |
||
69 | ); |
||
70 | $this->publishes( |
||
71 | [ |
||
72 | __DIR__ . '/views' => resource_path('views/vendor/RoleManager'), |
||
73 | ] |
||
74 | ); |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * Load Package Components |
||
79 | * |
||
80 | * @return void |
||
81 | */ |
||
82 | private function _loadParts() |
||
83 | { |
||
84 | $this->loadRoutesFrom(__DIR__ . '/routes.php'); |
||
85 | |||
86 | $this->mergeConfigFrom( |
||
87 | __DIR__ . '/config.php', 'roleManager.php' |
||
88 | ); |
||
89 | $this->loadMigrationsFrom(__DIR__ . '/migrations'); |
||
90 | $this->loadTranslationsFrom(__DIR__ . '/translations', 'RoleManager'); |
||
91 | $this->loadViewsFrom(__DIR__ . '/views', 'RoleManager'); |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * Add new Validation Types |
||
96 | * |
||
97 | * @return void |
||
98 | */ |
||
99 | private function _extendedValidation() |
||
100 | { |
||
101 | Validator::extend( |
||
102 | 'classExist', function ($attribute, $value, $parameters, $validator) { |
||
0 ignored issues
–
show
|
|||
103 | if (empty($value)) { |
||
104 | return true; |
||
105 | } |
||
106 | return class_exists($value); |
||
107 | } |
||
108 | ); |
||
109 | Validator::extend( |
||
110 | 'methodExist', function ($attribute, $value, $parameters, $validator) { |
||
0 ignored issues
–
show
|
|||
111 | if (!empty(Request::input('class'))) { |
||
112 | return method_exists(Request::input('class'), $value); |
||
113 | } |
||
114 | return true; |
||
115 | } |
||
116 | ); |
||
117 | |||
118 | Validator::replacer( |
||
119 | 'classExist', |
||
120 | function ($message, $attribute, $rule, $parameters) { |
||
0 ignored issues
–
show
|
|||
121 | return "Class does not exist"; |
||
122 | } |
||
123 | ); |
||
124 | Validator::replacer( |
||
125 | 'methodExist', |
||
126 | function ($message, $attribute, $rule, $parameters) { |
||
0 ignored issues
–
show
|
|||
127 | return |
||
128 | "Method in " |
||
129 | . Request::input('class') |
||
130 | . " class does not exist."; |
||
131 | } |
||
132 | ); |
||
133 | } |
||
134 | } |
||
135 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.