Skip to content

Commit

Permalink
Admin page refactoring (first steps)
Browse files Browse the repository at this point in the history
  • Loading branch information
sveneld committed Nov 16, 2024
1 parent 43ee525 commit 00b244a
Show file tree
Hide file tree
Showing 14 changed files with 586 additions and 526 deletions.
182 changes: 0 additions & 182 deletions admin.php

This file was deleted.

7 changes: 7 additions & 0 deletions config/packages/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
]
);

$security->roleHierarchy('ROLE_ADMIN', ['ROLE_USER']);
$security->roleHierarchy('ROLE_SUPER_ADMIN', ['ROLE_ADMIN']);

$security->accessControl()
->path('^/admin')
->roles(['ROLE_ADMIN']);

$security
->accessControl()
->path('^/login$')
Expand Down
4 changes: 3 additions & 1 deletion config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
->controller([\BikeShare\Controller\CommandController::class, 'index']);
$routes->add('scan', '/scan.php/{action}/{id}')
->controller([\BikeShare\Controller\ScanController::class, 'index']);
$routes->add('admin', '/admin.php')
$routes->add('admin_old', '/admin.php')
->controller([\BikeShare\Controller\AdminController::class, 'index']);
$routes->add('admin', '/admin')
->controller([\BikeShare\Controller\AdminController::class, 'index']);
$routes->add('register', '/register.php')
->controller([\BikeShare\Controller\RegisterController::class, 'index']);
Expand Down
8 changes: 0 additions & 8 deletions cron.php

This file was deleted.

15 changes: 8 additions & 7 deletions docker-data/mysql/create-database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,14 @@ CREATE TABLE `sent` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `sessions`;
CREATE TABLE `sessions` (
`userId` int(10) unsigned NOT NULL,
`sessionId` varchar(256) CHARACTER SET latin1 NOT NULL,
`timeStamp` varchar(256) CHARACTER SET latin1 NOT NULL,
UNIQUE KEY `userId` (`userId`),
KEY `sessionId` (`sessionId`)
DROP TABLE IF EXISTS `remember_me_token`;
CREATE TABLE `remember_me_token` (
`series` varchar(88) NOT NULL,
`value` varchar(88) NOT NULL,
`class` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL,
`lastUsed` TIMESTAMP NOT NULL,
PRIMARY KEY (`series`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<li><a href="<?= $configuration->get('systemrules'); ?>" target="_blank"><span class="glyphicon glyphicon-question-sign"></span><?= _('Help'); ?></a></li>
<?php
if ($auth->isLoggedIn() && $user->findPrivileges($userid) > 0) {
echo '<li><a href="admin.php"><span class="glyphicon glyphicon-cog"></span> ', _('Admin'), '</a></li>';
echo '<li><a href="/admin"><span class="glyphicon glyphicon-cog"></span> ', _('Admin'), '</a></li>';
}

if ($auth->isLoggedIn()) {
Expand Down
Loading

0 comments on commit 00b244a

Please sign in to comment.