1
|
|
|
<?php |
2
|
|
|
// Routes |
3
|
|
|
$app->group('/api', function() { |
4
|
|
|
$this->options('[/{params:.*}]', function($request, $response) { |
|
|
|
|
5
|
|
|
return $response->withHeader('Access-Control-Allow-Origin', '*') |
6
|
|
|
->withHeader('Access-Control-Allow-Methods', 'GET, PUT, PATCH, POST, DELETE, OPTIONS') |
7
|
|
|
->withHeader('Access-Control-Allow-Credentials', 'true') |
8
|
|
|
->withHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With') |
9
|
|
|
->withStatus(200); |
10
|
|
|
}); |
11
|
|
|
|
12
|
|
|
$this->post('/token', 'App\Controller\TokenController:getToken'); |
13
|
|
|
$this->post('/refresh-token', 'App\Controller\TokenController:refreshToken'); |
14
|
|
|
$this->post('/{entity:user}/request-password-reset', 'App\Controller\UserController:actionRequestPasswordReset'); |
15
|
|
|
$this->post('/{entity:user}/password-reset', 'App\Controller\UserController:actionPasswordReset'); |
16
|
|
|
|
17
|
|
View Code Duplication |
$this->group('/{entity:user}', function() { |
|
|
|
|
18
|
|
|
$this->get('', 'App\Controller\UserController:actionIndex'); |
|
|
|
|
19
|
|
|
$this->post('', 'App\Controller\UserController:actionCreate'); |
20
|
|
|
$this->get('/{id:[0-9]+}', 'App\Controller\UserController:actionGet'); |
21
|
|
|
$this->put('/{id:[0-9]+}', 'App\Controller\UserController:actionUpdate'); |
22
|
|
|
$this->patch('/{id:[0-9]+}', 'App\Controller\UserController:actionUpdate'); |
23
|
|
|
$this->delete('/{id:[0-9]+}', 'App\Controller\UserController:actionDelete'); |
24
|
|
|
})->add(new \App\Middleware\Authentication($this->getContainer()->get('acl'), $this->getContainer()->get('settings'))); |
25
|
|
|
|
26
|
|
View Code Duplication |
$this->group('/{entity:role|right}', function() { |
|
|
|
|
27
|
|
|
$this->get('', 'App\Controller\CrudController:actionIndex'); |
|
|
|
|
28
|
|
|
$this->get('/{id:[0-9]+}', 'App\Controller\CrudController:actionGet'); |
29
|
|
|
$this->post('', 'App\Controller\CrudController:actionCreate'); |
30
|
|
|
$this->put('/{id:[0-9]+}', 'App\Controller\CrudController:actionUpdate'); |
31
|
|
|
$this->patch('/{id:[0-9]+}', 'App\Controller\CrudController:actionUpdate'); |
32
|
|
|
$this->delete('/{id:[0-9]+}', 'App\Controller\CrudController:actionDelete'); |
33
|
|
|
})->add(new \App\Middleware\Authentication($this->getContainer()->get('acl'), $this->getContainer()->get('settings'))); |
34
|
|
|
|
35
|
|
|
$this->group('/{entity:log}', function() { |
36
|
|
|
$this->get('', 'App\Controller\CrudController:actionIndex'); |
|
|
|
|
37
|
|
|
$this->get('/{id:[0-9]+}', 'App\Controller\CrudController:actionGet'); |
38
|
|
|
})->add(new \App\Middleware\Authentication($this->getContainer()->get('acl'), $this->getContainer()->get('settings'))); |
39
|
|
|
|
40
|
|
|
$this->group('/{entity:media-file}', function() { |
41
|
|
|
$this->get('', 'App\Controller\CrudController:actionIndex'); |
|
|
|
|
42
|
|
|
$this->get('/{id:[0-9]+}', 'App\Controller\CrudController:actionGet'); |
43
|
|
|
$this->delete('/{id:[0-9]+}', 'App\Controller\CrudController:actionDelete'); |
44
|
|
|
})->add(new \App\Middleware\Authentication($this->getContainer()->get('acl'), $this->getContainer()->get('settings'))); |
45
|
|
|
|
46
|
|
|
$this->post('/upload', 'App\Controller\UploadController:upload') |
47
|
|
|
->add(new \App\Middleware\Authentication($this->getContainer()->get('acl'), $this->getContainer()->get('settings'))); |
48
|
|
|
}); |
49
|
|
|
|
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.