Issues (655)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Admin/AdminInterface.php (8 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\AdminBundle\Admin;
15
16
use Knp\Menu\FactoryInterface;
17
use Knp\Menu\ItemInterface;
18
use Sonata\AdminBundle\Builder\DatagridBuilderInterface;
19
use Sonata\AdminBundle\Builder\FormContractorInterface;
20
use Sonata\AdminBundle\Builder\ListBuilderInterface;
21
use Sonata\AdminBundle\Builder\RouteBuilderInterface;
22
use Sonata\AdminBundle\Datagrid\DatagridInterface;
23
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
24
use Sonata\AdminBundle\Filter\Persister\FilterPersisterInterface;
25
use Sonata\AdminBundle\Model\ModelManagerInterface;
26
use Sonata\AdminBundle\Object\MetadataInterface;
27
use Sonata\AdminBundle\Route\RouteGeneratorInterface;
28
use Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface;
29
use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;
30
use Sonata\Exporter\Source\SourceIteratorInterface;
31
use Sonata\Form\Validator\ErrorElement;
32
use Symfony\Component\Form\FormBuilderInterface;
33
use Symfony\Component\Form\FormInterface;
34
use Symfony\Component\HttpFoundation\Request;
35
use Symfony\Component\Validator\Validator\ValidatorInterface;
36
use Symfony\Contracts\Translation\TranslatorInterface;
37
38
/**
39
 * @author Thomas Rabaix <[email protected]>
40
 */
41
interface AdminInterface extends AccessRegistryInterface, FieldDescriptionRegistryInterface, LifecycleHookProviderInterface, MenuBuilderInterface, ParentAdminInterface, UrlGeneratorInterface
42
{
43
    public function setMenuFactory(FactoryInterface $menuFactory): void;
44
45
    public function getMenuFactory(): ?FactoryInterface;
46
47
    public function setFormContractor(FormContractorInterface $formContractor): void;
48
49
    public function setListBuilder(ListBuilderInterface $listBuilder): void;
50
51
    public function getListBuilder(): ?ListBuilderInterface;
52
53
    public function setDatagridBuilder(DatagridBuilderInterface $datagridBuilder): void;
54
55
    public function getDatagridBuilder(): ?DatagridBuilderInterface;
56
57
    public function setTranslator(TranslatorInterface $translator): void;
58
59
    public function setRequest(Request $request): void;
60
61
    public function setConfigurationPool(Pool $pool): void;
62
63
    /**
64
     * Returns subjectClass/class/subclass name managed
65
     * - subclass name if subclass parameter is defined
66
     * - subject class name if subject is defined
67
     * - class name if not.
68
     */
69
    public function getClass(): string;
70
71
    public function attachAdminClass(FieldDescriptionInterface $fieldDescription): void;
72
73
    public function getDatagrid(): DatagridInterface;
74
75
    public function getPagerType(): string;
76
77
    /**
78
     * Set base controller name.
79
     */
80
    public function setBaseControllerName(string $baseControllerName): void;
81
82
    /**
83
     * Get base controller name.
84
     */
85
    public function getBaseControllerName(): string;
86
87
    /**
88
     * Sets a list of templates.
89
     */
90
    public function setTemplates(array $templates): void;
91
92
    /**
93
     * Sets a specific template.
94
     */
95
    public function setTemplate(string $name, string $template): void;
96
97
    public function getModelManager(): ?ModelManagerInterface;
98
99
    /**
100
     * @return string the manager type of the admin
101
     */
102
    public function getManagerType(): ?string;
103
104
    public function createQuery(): ProxyQueryInterface;
105
106
    /**
107
     * @return FormBuilderInterface the form builder
108
     */
109
    public function getFormBuilder(): FormBuilderInterface;
110
111
    /**
112
     * Returns a form depend on the given $object.
113
     */
114
    public function getForm(): ?FormInterface;
115
116
    public function getRequest(): Request;
117
118
    /**
119
     * @return bool true if a request object is linked to this Admin, false
120
     *              otherwise
121
     */
122
    public function hasRequest(): bool;
123
124
    public function getCode(): string;
125
126
    public function getBaseCodeRoute(): string;
127
128
    /**
129
     * Return the roles and permissions per role
130
     * - different permissions per role for the acl handler
131
     * - one permission that has the same name as the role for the role handler
132
     * This should be used by experimented users.
133
     *
134
     * @return array 'role' => ['permission', 'permission']
135
     */
136
    public function getSecurityInformation(): array;
137
138
    public function setParentFieldDescription(FieldDescriptionInterface $parentFieldDescription): void;
139
140
    /**
141
     * Get parent field description.
142
     *
143
     * @return FieldDescriptionInterface The parent field description
144
     */
145
    public function getParentFieldDescription(): ?FieldDescriptionInterface;
146
147
    /**
148
     * Returns true if the Admin is linked to a parent FieldDescription.
149
     */
150
    public function hasParentFieldDescription(): bool;
151
152
    /**
153
     * Returns the parameter representing request id, ie: id or childId.
154
     */
155
    public function getIdParameter(): string;
156
157
    /**
158
     * Returns true if the route $name is available.
159
     */
160
    public function hasRoute(string $name): bool;
161
162
    public function setSecurityHandler(SecurityHandlerInterface $securityHandler): void;
163
164
    public function getSecurityHandler(): ?SecurityHandlerInterface;
165
166
    /**
167
     * @param string|array $name
168
     */
169
    public function isGranted($name, ?object $object = null): bool;
170
171
    /**
172
     * @param mixed $model
173
     *
174
     * @return string a string representation of the identifiers for this instance
175
     */
176
    public function getNormalizedIdentifier($model): ?string;
177
178
    /**
179
     * Shorthand method for templating.
180
     *
181
     * @param object $model
182
     */
183
    public function id($model): ?string;
184
185
    public function setValidator(ValidatorInterface $validator): void;
186
187
    public function getValidator(): ?ValidatorInterface;
188
189
    public function getShow(): ?FieldDescriptionCollection;
190
191
    public function setFormTheme(array $formTheme): void;
192
193
    public function getList(): ?FieldDescriptionCollection;
194
195
    /**
196
     * @return string[]
197
     */
198
    public function getFormTheme(): array;
199
200
    public function setFilterTheme(array $filterTheme): void;
201
202
    /**
203
     * @return string[]
204
     */
205
    public function getFilterTheme(): array;
206
207
    public function addExtension(AdminExtensionInterface $extension): void;
208
209
    /**
210
     * Returns an array of extension related to the current Admin.
211
     *
212
     * @return AdminExtensionInterface[]
213
     */
214
    public function getExtensions(): array;
215
216
    public function setRouteBuilder(RouteBuilderInterface $routeBuilder): void;
217
218
    public function getRouteBuilder(): ?RouteBuilderInterface;
219
220
    /**
221
     * @param object $object
222
     */
223
    public function toString($object): string;
224
225
    public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $labelTranslatorStrategy): void;
226
227
    public function getLabelTranslatorStrategy(): ?LabelTranslatorStrategyInterface;
228
229
    /**
230
     * Returning true will enable preview mode for
231
     * the target entity and show a preview button
232
     * when editing/creating an entity.
233
     */
234
    public function supportsPreviewMode(): bool;
235
236
    public function getNewInstance(): object;
237
238
    public function setUniqid(string $uniqId): void;
239
240
    /**
241
     * Returns the uniqid.
242
     */
243
    public function getUniqid(): string;
244
245
    /**
246
     * Returns the classname label.
247
     *
248
     * @return string the classname label
249
     */
250
    public function getClassnameLabel(): string;
251
252
    /**
253
     * @param mixed $id
254
     */
255
    public function getObject($id): ?object;
256
257
    public function setSubject(?object $subject): void;
258
259
    public function getSubject(): object;
260
261
    /**
262
     * Returns the array of allowed export formats.
263
     *
264
     * @return string[]
265
     */
266
    public function getExportFormats(): array;
267
268
    /**
269
     * Retuns a list of exported fields.
270
     */
271
    public function getExportFields(): array;
272
273
    /**
274
     * Returns SourceIterator.
275
     */
276
    public function getDataSourceIterator(): SourceIteratorInterface;
277
278
    /**
279
     * Call before the batch action, allow you to alter the query and the idx.
280
     */
281
    public function preBatchAction(string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements = false): void;
282
283
    /**
284
     * Return array of filter parameters.
285
     *
286
     * @return array<string, mixed>
0 ignored issues
show
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
287
     */
288
    public function getFilterParameters(): array;
289
290
    /**
291
     * Return true if the Admin is related to a subject.
292
     */
293
    public function hasSubject(): bool;
294
295
    /**
296
     * NEXT_MAJOR: remove this method.
297
     *
298
     * @param object $object
299
     *
300
     * @deprecated this feature cannot be stable, use a custom validator,
301
     *             the feature will be removed with Symfony 2.2
302
     */
303
    public function validate(ErrorElement $errorElement, $object): void;
304
305
    public function showIn(string $context): bool;
306
307
    /**
308
     * Add object security, fe. make the current user owner of the object.
309
     */
310
    public function createObjectSecurity(object $object): void;
311
312
    public function getParent(): self;
313
314
    public function setParent(self $admin): void;
315
316
    /**
317
     * Returns true if the Admin class has an Parent Admin defined.
318
     */
319
    public function isChild(): bool;
320
321
    /**
322
     * Set the translation domain.
323
     *
324
     * @param string $translationDomain the translation domain
325
     */
326
    public function setTranslationDomain(string $translationDomain): void;
327
328
    /**
329
     * Returns the translation domain.
330
     *
331
     * @return string the translation domain
332
     */
333
    public function getTranslationDomain(): string;
334
335
    /**
336
     * Return the form groups.
337
     *
338
     * @return array<string, mixed>
0 ignored issues
show
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
339
     */
340
    public function getFormGroups(): array;
341
342
    /**
343
     * Set the form groups.
344
     */
345
    public function setFormGroups(array $formGroups): void;
346
347
    /**
348
     * @return array<string, mixed>
0 ignored issues
show
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
349
     */
350
    public function getFormTabs(): array;
351
352
    public function setFormTabs(array $formTabs): void;
353
354
    /**
355
     * @return array<string, mixed>
0 ignored issues
show
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
356
     */
357
    public function getShowTabs(): array;
358
359
    public function setShowTabs(array $showTabs): void;
360
361
    /**
362
     * Remove a form group field.
363
     */
364
    public function removeFieldFromFormGroup(string $key): void;
365
366
    /**
367
     * Returns the show groups.
368
     *
369
     * @return array<string, mixed>
0 ignored issues
show
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
370
     */
371
    public function getShowGroups(): array;
372
373
    /**
374
     * Set the show groups.
375
     */
376
    public function setShowGroups(array $showGroups): void;
377
378
    /**
379
     * Reorder items in showGroup.
380
     */
381
    public function reorderShowGroup(string $group, array $keys): void;
382
383
    /**
384
     * Returns true if this admin uses ACL.
385
     */
386
    public function isAclEnabled(): bool;
387
388
    /**
389
     * Returns list of supported sub classes.
390
     */
391
    public function getSubClasses(): array;
392
393
    /**
394
     * Sets the list of supported sub classes.
395
     */
396
    public function setSubClasses(array $subClasses): void;
397
398
    /**
399
     * Returns true if the admin has the sub classes.
400
     *
401
     * @param string $name The name of the sub class
402
     */
403
    public function hasSubClass(string $name): bool;
404
405
    /**
406
     * Returns true if a subclass is currently active.
407
     */
408
    public function hasActiveSubClass(): bool;
409
410
    /**
411
     * Returns the currently active sub class.
412
     *
413
     * @return string the active sub class
414
     */
415
    public function getActiveSubClass(): string;
416
417
    /**
418
     * Returns the currently active sub class code.
419
     *
420
     * @return string the code for active sub class
421
     */
422
    public function getActiveSubclassCode(): string;
423
424
    /**
425
     * Returns the list of batchs actions.
426
     *
427
     * @return array<string, mixed> the list of batchs actions
0 ignored issues
show
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
428
     */
429
    public function getBatchActions(): array;
430
431
    /**
432
     * Returns Admin`s label.
433
     */
434
    public function getLabel(): ?string;
435
436
    /**
437
     * Returns an array of persistent parameters.
438
     *
439
     * @return array<string, mixed>
0 ignored issues
show
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
440
     */
441
    public function getPersistentParameters(): array;
442
443
    public function getPersistentParameter(string $name);
444
445
    /**
446
     * Set the current child status.
447
     */
448
    public function setCurrentChild(bool $currentChild): void;
449
450
    /**
451
     * Returns the current child status.
452
     */
453
    public function isCurrentChild(): bool;
454
455
    /**
456
     * Get translation label using the current TranslationStrategy.
457
     */
458
    public function getTranslationLabel(string $label, string $context = '', string $type = ''): string;
459
460
    /**
461
     * @param object $object
462
     */
463
    public function getObjectMetadata($object): MetadataInterface;
464
465
    /**
466
     * @return array<string, array<string, mixed>>
0 ignored issues
show
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
467
     */
468
    public function getListModes(): array;
469
470
    public function setListMode(string $mode): void;
471
472
    /**
473
     * return the list mode.
474
     */
475
    public function getListMode(): string;
476
477
    /**
478
     * Configure buttons for an action.
479
     */
480
    public function getActionButtons(string $action, ?object $object = null): array;
481
482
    /**
483
     * Get the list of actions that can be accessed directly from the dashboard.
484
     */
485
    public function getDashboardActions(): array;
486
487
    /**
488
     * Check the current request is given route or not.
489
     */
490
    public function isCurrentRoute(string $name, ?string $adminCode = null): bool;
491
492
    /**
493
     * Returns the result link for an object.
494
     */
495
    public function getSearchResultLink(object $object): ?string;
496
497
    /**
498
     * Setting to true will enable mosaic button for the admin screen.
499
     * Setting to false will hide mosaic button for the admin screen.
500
     */
501
    public function showMosaicButton(bool $isShown): void;
502
503
    public function configureActionButtons(array $buttonList, string $action, ?object $object = null): array;
504
505
    /**
506
     * Check object existence and access, without throwing Exception.
507
     */
508
    public function canAccessObject(string $action, ?object $object = null): bool;
509
510
    /**
511
     * Returns the master admin.
512
     */
513
    public function getRoot(): self;
514
515
    /**
516
     * Returns the root code.
517
     */
518
    public function getRootCode(): string;
519
520
    public function setFilterPersister(?FilterPersisterInterface $filterPersister = null): void;
521
522
    /**
523
     * Returns the baseRoutePattern used to generate the routing information.
524
     */
525
    public function getBaseRoutePattern(): string;
526
527
    /**
528
     * Returns the baseRouteName used to generate the routing information.
529
     */
530
    public function getBaseRouteName(): string;
531
532
    public function getSideMenu(string $action, ?self $childAdmin = null): ItemInterface;
533
534
    public function addParentAssociationMapping(string $code, string $value): void;
535
536
    public function getRouteGenerator(): ?RouteGeneratorInterface;
537
538
    /**
539
     * Returns the current child admin instance.
540
     */
541
    public function getCurrentChildAdmin(): ?self;
542
543
    /**
544
     * Returns the name of the parent related field, so the field can be use to set the default
545
     * value (ie the parent object) or to filter the object.
546
     */
547
    public function getParentAssociationMapping(): ?string;
548
549
    public function reorderFormGroup(string $group, array $keys): void;
550
551
    /**
552
     * This method is being called by the main admin class and the child class,
553
     * the getFormBuilder is only call by the main admin class.
554
     */
555
    public function defineFormBuilder(FormBuilderInterface $formBuilder): void;
556
}
557
558
class_exists(ErrorElement::class);
559