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 Sco\Admin\Http\Controllers; |
||
4 | |||
5 | use Illuminate\Auth\Access\AuthorizationException; |
||
6 | use Illuminate\Http\Request; |
||
7 | use Illuminate\Routing\Controller; |
||
8 | use Sco\Admin\Contracts\ComponentInterface; |
||
9 | use Sco\Admin\Facades\AdminNavigation; |
||
10 | |||
11 | /** |
||
12 | * Class AdminController |
||
13 | * |
||
14 | * @package Sco\Admin\Http\Controllers |
||
15 | */ |
||
16 | class AdminController extends Controller |
||
17 | { |
||
18 | /** |
||
19 | * Get page left navigation |
||
20 | * |
||
21 | * @return \Illuminate\Http\JsonResponse |
||
22 | */ |
||
23 | public function getMenu() |
||
24 | { |
||
25 | $pages = AdminNavigation::filterByAccessRights() |
||
26 | ->sort() |
||
27 | ->getPages(); |
||
28 | return response()->json($pages); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Component index page |
||
33 | * |
||
34 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
35 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||
36 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
37 | */ |
||
38 | public function index(ComponentInterface $component) |
||
39 | { |
||
40 | if (! $component->isDisplay()) { |
||
41 | throw new AuthorizationException(); |
||
42 | } |
||
43 | |||
44 | return view('admin::app'); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Component list data |
||
49 | * |
||
50 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
51 | * @return mixed |
||
52 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
53 | */ |
||
54 | public function getList(ComponentInterface $component) |
||
55 | { |
||
56 | if (! $component->isDisplay()) { |
||
57 | throw new AuthorizationException(); |
||
58 | } |
||
59 | |||
60 | return $component->get(); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Component config data |
||
65 | * |
||
66 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
67 | * @return \Illuminate\Support\Collection |
||
68 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
69 | */ |
||
70 | public function config(ComponentInterface $component) |
||
71 | { |
||
72 | if (! $component->isDisplay()) { |
||
73 | throw new AuthorizationException(); |
||
74 | } |
||
75 | |||
76 | return $component->getConfigs(); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
81 | * @return null|\Sco\Admin\Contracts\Form\FormInterface |
||
82 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
83 | */ |
||
84 | public function getCreateInfo(ComponentInterface $component) |
||
85 | { |
||
86 | if (! $component->isCreate()) { |
||
87 | throw new AuthorizationException(); |
||
88 | } |
||
89 | |||
90 | $form = $component->fireCreate(); |
||
91 | |||
92 | return $form; |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
97 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||
98 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
99 | */ |
||
100 | public function create(ComponentInterface $component) |
||
101 | { |
||
102 | if (! $component->isCreate()) { |
||
103 | throw new AuthorizationException(); |
||
104 | } |
||
105 | |||
106 | return view('admin::app'); |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
111 | * @param \Illuminate\Http\Request $request |
||
112 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
113 | */ |
||
114 | public function store(ComponentInterface $component, Request $request) |
||
0 ignored issues
–
show
|
|||
115 | { |
||
116 | if (! $component->isCreate()) { |
||
117 | throw new AuthorizationException(); |
||
118 | } |
||
119 | |||
120 | $component->store(); |
||
121 | } |
||
122 | |||
123 | /** |
||
124 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
125 | * @param $id |
||
126 | * @return null|\Sco\Admin\Contracts\Form\FormInterface |
||
127 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
128 | */ |
||
129 | public function getEditInfo(ComponentInterface $component, $id) |
||
130 | { |
||
131 | if (! $component->isEdit()) { |
||
132 | throw new AuthorizationException(); |
||
133 | } |
||
134 | |||
135 | $form = $component->fireEdit($id); |
||
136 | |||
137 | return $form; |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
142 | * @param $id |
||
143 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||
144 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
145 | */ |
||
146 | public function edit(ComponentInterface $component, $id) |
||
0 ignored issues
–
show
|
|||
147 | { |
||
148 | if (! $component->isEdit()) { |
||
149 | throw new AuthorizationException(); |
||
150 | } |
||
151 | |||
152 | return view('admin::app'); |
||
153 | } |
||
154 | |||
155 | /** |
||
156 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
157 | * @param \Illuminate\Http\Request $request |
||
158 | * @param $id |
||
159 | * @return \Illuminate\Http\JsonResponse |
||
160 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
161 | */ |
||
162 | public function update(ComponentInterface $component, Request $request, $id) |
||
0 ignored issues
–
show
|
|||
163 | { |
||
164 | if (! $component->isEdit()) { |
||
165 | throw new AuthorizationException(); |
||
166 | } |
||
167 | |||
168 | $component->update($id); |
||
169 | |||
170 | return response()->json(['message' => 'ok']); |
||
171 | } |
||
172 | |||
173 | /** |
||
174 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
175 | * @param $id |
||
176 | * @return \Illuminate\Http\JsonResponse |
||
177 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
178 | */ |
||
179 | View Code Duplication | public function delete(ComponentInterface $component, $id) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
180 | { |
||
181 | if (! $component->isDelete()) { |
||
182 | throw new AuthorizationException(); |
||
183 | } |
||
184 | |||
185 | $component->delete($id); |
||
186 | |||
187 | return response()->json(['message' => 'ok']); |
||
188 | } |
||
189 | |||
190 | /** |
||
191 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
192 | * @param $id |
||
193 | * @return \Illuminate\Http\JsonResponse |
||
194 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
195 | */ |
||
196 | public function forceDelete(ComponentInterface $component, $id) |
||
197 | { |
||
198 | if (! $component->isDestroy()) { |
||
199 | throw new AuthorizationException(); |
||
200 | } |
||
201 | |||
202 | $component->forceDelete($id); |
||
203 | |||
204 | return response()->json(['message' => 'ok']); |
||
205 | } |
||
206 | |||
207 | /** |
||
208 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
209 | * @param $id |
||
210 | * @return \Illuminate\Http\JsonResponse |
||
211 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
212 | */ |
||
213 | public function restore(ComponentInterface $component, $id) |
||
214 | { |
||
215 | if (! $component->isRestore()) { |
||
216 | throw new AuthorizationException(); |
||
217 | } |
||
218 | $component->restore($id); |
||
219 | |||
220 | return response()->json(['message' => 'ok']); |
||
221 | } |
||
222 | |||
223 | /** |
||
224 | * @param \Sco\Admin\Contracts\ComponentInterface $component |
||
225 | * @return \Illuminate\Http\JsonResponse |
||
226 | * @throws \Illuminate\Auth\Access\AuthorizationException |
||
227 | */ |
||
228 | View Code Duplication | public function reorder(ComponentInterface $component) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
229 | { |
||
230 | if (! $component->isEdit()) { |
||
231 | throw new AuthorizationException(); |
||
232 | } |
||
233 | |||
234 | //TODO |
||
235 | |||
236 | return response()->json(['message' => 'ok']); |
||
237 | } |
||
238 | } |
||
239 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.