aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-08-13 11:08:13 +0200
committerArthurHoaro <arthur@hoa.ro>2020-08-13 11:08:13 +0200
commitbedbb845eec20363b928b424143787dbe988eefe (patch)
tree6b835ca247e39157b333323a539dde3c410c08f5 /index.php
parent1a68ae5a29bc33ab80c9cfbe043cb1213551533c (diff)
downloadShaarli-bedbb845eec20363b928b424143787dbe988eefe.tar.gz
Shaarli-bedbb845eec20363b928b424143787dbe988eefe.tar.zst
Shaarli-bedbb845eec20363b928b424143787dbe988eefe.zip
Move all admin controller into a dedicated group
Also handle authentication check in a new middleware for the admin group.
Diffstat (limited to 'index.php')
-rw-r--r--index.php54
1 files changed, 28 insertions, 26 deletions
diff --git a/index.php b/index.php
index 24c273be..e7471823 100644
--- a/index.php
+++ b/index.php
@@ -95,39 +95,41 @@ $app->group('', function () {
95 $this->get('/add-tag/{newTag}', '\Shaarli\Front\Controller\Visitor\TagController:addTag'); 95 $this->get('/add-tag/{newTag}', '\Shaarli\Front\Controller\Visitor\TagController:addTag');
96 $this->get('/remove-tag/{tag}', '\Shaarli\Front\Controller\Visitor\TagController:removeTag'); 96 $this->get('/remove-tag/{tag}', '\Shaarli\Front\Controller\Visitor\TagController:removeTag');
97 $this->get('/links-per-page', '\Shaarli\Front\Controller\Visitor\PublicSessionFilterController:linksPerPage'); 97 $this->get('/links-per-page', '\Shaarli\Front\Controller\Visitor\PublicSessionFilterController:linksPerPage');
98 $this->get('/untagged-only', '\Shaarli\Front\Controller\Admin\PublicSessionFilterController:untaggedOnly');
99})->add('\Shaarli\Front\ShaarliMiddleware');
98 100
99 /* -- LOGGED IN -- */ 101$app->group('/admin', function () {
100 $this->get('/logout', '\Shaarli\Front\Controller\Admin\LogoutController:index'); 102 $this->get('/logout', '\Shaarli\Front\Controller\Admin\LogoutController:index');
101 $this->get('/admin/tools', '\Shaarli\Front\Controller\Admin\ToolsController:index'); 103 $this->get('/tools', '\Shaarli\Front\Controller\Admin\ToolsController:index');
102 $this->get('/admin/password', '\Shaarli\Front\Controller\Admin\PasswordController:index'); 104 $this->get('/password', '\Shaarli\Front\Controller\Admin\PasswordController:index');
103 $this->post('/admin/password', '\Shaarli\Front\Controller\Admin\PasswordController:change'); 105 $this->post('/password', '\Shaarli\Front\Controller\Admin\PasswordController:change');
104 $this->get('/admin/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:index'); 106 $this->get('/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:index');
105 $this->post('/admin/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:save'); 107 $this->post('/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:save');
106 $this->get('/admin/tags', '\Shaarli\Front\Controller\Admin\ManageTagController:index'); 108 $this->get('/tags', '\Shaarli\Front\Controller\Admin\ManageTagController:index');
107 $this->post('/admin/tags', '\Shaarli\Front\Controller\Admin\ManageTagController:save'); 109 $this->post('/tags', '\Shaarli\Front\Controller\Admin\ManageTagController:save');
108 $this->get('/admin/add-shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:addShaare'); 110 $this->get('/add-shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:addShaare');
109 $this->get('/admin/shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:displayCreateForm'); 111 $this->get('/shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:displayCreateForm');
110 $this->get('/admin/shaare/{id:[0-9]+}', '\Shaarli\Front\Controller\Admin\ManageShaareController:displayEditForm'); 112 $this->get('/shaare/{id:[0-9]+}', '\Shaarli\Front\Controller\Admin\ManageShaareController:displayEditForm');
111 $this->post('/admin/shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:save'); 113 $this->post('/shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:save');
112 $this->get('/admin/shaare/delete', '\Shaarli\Front\Controller\Admin\ManageShaareController:deleteBookmark'); 114 $this->get('/shaare/delete', '\Shaarli\Front\Controller\Admin\ManageShaareController:deleteBookmark');
113 $this->get('/admin/shaare/visibility', '\Shaarli\Front\Controller\Admin\ManageShaareController:changeVisibility'); 115 $this->get('/shaare/visibility', '\Shaarli\Front\Controller\Admin\ManageShaareController:changeVisibility');
114 $this->get('/admin/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark'); 116 $this->get('/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark');
115 $this->patch( 117 $this->patch(
116 '/admin/shaare/{id:[0-9]+}/update-thumbnail', 118 '/shaare/{id:[0-9]+}/update-thumbnail',
117 '\Shaarli\Front\Controller\Admin\ThumbnailsController:ajaxUpdate' 119 '\Shaarli\Front\Controller\Admin\ThumbnailsController:ajaxUpdate'
118 ); 120 );
119 $this->get('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:index'); 121 $this->get('/export', '\Shaarli\Front\Controller\Admin\ExportController:index');
120 $this->post('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:export'); 122 $this->post('/export', '\Shaarli\Front\Controller\Admin\ExportController:export');
121 $this->get('/admin/import', '\Shaarli\Front\Controller\Admin\ImportController:index'); 123 $this->get('/import', '\Shaarli\Front\Controller\Admin\ImportController:index');
122 $this->post('/admin/import', '\Shaarli\Front\Controller\Admin\ImportController:import'); 124 $this->post('/import', '\Shaarli\Front\Controller\Admin\ImportController:import');
123 $this->get('/admin/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:index'); 125 $this->get('/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:index');
124 $this->post('/admin/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:save'); 126 $this->post('/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:save');
125 $this->get('/admin/token', '\Shaarli\Front\Controller\Admin\TokenController:getToken'); 127 $this->get('/token', '\Shaarli\Front\Controller\Admin\TokenController:getToken');
126 $this->get('/admin/thumbnails', '\Shaarli\Front\Controller\Admin\ThumbnailsController:index'); 128 $this->get('/thumbnails', '\Shaarli\Front\Controller\Admin\ThumbnailsController:index');
127 129
128 $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility'); 130 $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility');
129 $this->get('/untagged-only', '\Shaarli\Front\Controller\Admin\SessionFilterController:untaggedOnly'); 131})->add('\Shaarli\Front\ShaarliAdminMiddleware');
130})->add('\Shaarli\Front\ShaarliMiddleware'); 132
131 133
132// REST API routes 134// REST API routes
133$app->group('/api/v1', function () { 135$app->group('/api/v1', function () {