-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.include.php
More file actions
90 lines (75 loc) · 3.23 KB
/
Copy pathbootstrap.include.php
File metadata and controls
90 lines (75 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/**
* MediaBrowser
*
* @author Team phpManufaktur <team@phpmanufaktur.de>
* @link https://kit2.phpmanufaktur.de/MediaBrowser
* @copyright 2013 Ralf Hertsch <ralf.hertsch@phpmanufaktur.de>
* @license MIT License (MIT) http://www.opensource.org/licenses/MIT
*/
// grant the ROLE hierarchy for the flexContent ROLES
$roles = $app['security.role_hierarchy'];
if (!in_array('ROLE_MEDIABROWSER_ADMIN', $roles)) {
$roles['ROLE_ADMIN'][] = 'ROLE_MEDIABROWSER_ADMIN';
$roles['ROLE_MEDIABROWSER_ADMIN'][] = 'ROLE_MEDIABROWSER_USER';
$app['security.role_hierarchy'] = $roles;
}
// add a protected area and access rules
$access_rules = $app['security.access_rules'];
if (!in_array('^/mediabrowser', $access_rules)) {
$access_rules[] = array('^/mediabrowser', 'ROLE_MEDIABROWSER_USER');
$app['security.access_rules'] = $access_rules;
}
// add a access point for flexContent
$entry_points = $app['security.role_entry_points'];
if (!in_array('ROLE_MEDIABROWSER_USER', $entry_points)) {
$entry_points['ROLE_MEDIABROWSER_USER'] = array(
array(
'route' => '/mediabrowser/entrypoints',
'name' => 'MediaBrowser',
'info' => 'Acces the public and protected Media resources',
'icon' => array(
'path' => '/extension/phpmanufaktur/phpManufaktur/MediaBrowser/extension.jpg',
'url' => MANUFAKTUR_URL.'/MediaBrowser/extension.jpg'
)
)
);
$app['security.role_entry_points'] = $entry_points;
}
// add all ROLES provided and used by MediaBrowser
$roles = array(
'ROLE_MEDIABROWSER_ADMIN',
'ROLE_MEDIABROWSER_USER'
);
$roles_provided = $app['security.roles_provided'];
if (!in_array($roles, $roles_provided)) {
foreach ($roles as $role) {
if (!in_array($role, $roles_provided)) {
$roles_provided[] = $role;
}
}
$app['security.roles_provided'] = $roles_provided;
}
// main dialog - expect the parameters given as GET Request
$app->get('/mediabrowser',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerMediaBrowser');
// main dialog - special route for the Entry points
$app->get('/mediabrowser/entrypoints',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerEntryPoints');
// main dialog - get all parameters as encoded string
$app->get('/mediabrowser/init/{params}',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerMediaBrowserInit');
$app->get('/mediabrowser/delete/{delete}',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerMediaBrowserDelete');
$app->get('/mediabrowser/directory/{change}',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerMediaBrowserChangeDirectory');
$app->post('/mediabrowser/directory/create',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerMediaBrowserCreateDirectory');
$app->post('/mediabrowser/upload',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerMediaBrowserUpload');
$app->get('/mediabrowser/select/{select}',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerMediaBrowserSelect');
$app->get('/mediabrowser/exit/{usage}',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerMediaBrowserExit');
$app->get('/mediabrowser/cke',
'phpManufaktur\MediaBrowser\Control\Browser::ControllerMediaBrowserCKE');