mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENH handle sub-urls
This commit is contained in:
parent
2cb84e90d4
commit
b9b891d050
@ -44,6 +44,11 @@ class DevelopmentAdminConfirmationMiddleware extends PermissionAwareConfirmation
|
|||||||
}
|
}
|
||||||
|
|
||||||
$registeredRoutes = DevelopmentAdmin::config()->get('registered_controllers');
|
$registeredRoutes = DevelopmentAdmin::config()->get('registered_controllers');
|
||||||
|
while (!isset($registeredRoutes[$action]) && strpos($action, '/') !== false) {
|
||||||
|
// Check for the parent route if a specific route isn't found
|
||||||
|
$action = substr($action, 0, strrpos($action, '/'));
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($registeredRoutes[$action]['controller'])) {
|
if (isset($registeredRoutes[$action]['controller'])) {
|
||||||
$initPermissions = Config::forClass($registeredRoutes[$action]['controller'])->get('init_permissions');
|
$initPermissions = Config::forClass($registeredRoutes[$action]['controller'])->get('init_permissions');
|
||||||
foreach ($initPermissions as $permission) {
|
foreach ($initPermissions as $permission) {
|
||||||
|
@ -39,8 +39,7 @@ class URLSpecialsMiddleware extends PermissionAwareConfirmationMiddleware
|
|||||||
parent::__construct(
|
parent::__construct(
|
||||||
new ConfirmationMiddleware\GetParameter("flush"),
|
new ConfirmationMiddleware\GetParameter("flush"),
|
||||||
new ConfirmationMiddleware\GetParameter("isDev"),
|
new ConfirmationMiddleware\GetParameter("isDev"),
|
||||||
new ConfirmationMiddleware\GetParameter("isTest"),
|
new ConfirmationMiddleware\GetParameter("isTest")
|
||||||
new ConfirmationMiddleware\UrlPathStartswith("dev/build")
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,13 @@ class CleanupTestDatabasesTask extends BuildTask
|
|||||||
|
|
||||||
public function run($request)
|
public function run($request)
|
||||||
{
|
{
|
||||||
|
if (!$this->canView()) {
|
||||||
|
$response = Security::permissionFailure();
|
||||||
|
if ($response) {
|
||||||
|
$response->output();
|
||||||
|
}
|
||||||
|
die;
|
||||||
|
}
|
||||||
TempDatabase::create()->deleteAll();
|
TempDatabase::create()->deleteAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ use SilverStripe\Core\ClassInfo;
|
|||||||
use SilverStripe\Core\Environment;
|
use SilverStripe\Core\Environment;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Core\Manifest\ClassLoader;
|
use SilverStripe\Core\Manifest\ClassLoader;
|
||||||
|
use SilverStripe\Dev\DevBuildController;
|
||||||
use SilverStripe\Dev\DevelopmentAdmin;
|
use SilverStripe\Dev\DevelopmentAdmin;
|
||||||
use SilverStripe\ORM\Connect\DatabaseException;
|
use SilverStripe\ORM\Connect\DatabaseException;
|
||||||
use SilverStripe\ORM\Connect\TableBuilder;
|
use SilverStripe\ORM\Connect\TableBuilder;
|
||||||
@ -367,7 +368,7 @@ class DatabaseAdmin extends Controller
|
|||||||
// We need to ensure that DevelopmentAdminTest can simulate permission failures when running
|
// We need to ensure that DevelopmentAdminTest can simulate permission failures when running
|
||||||
// "dev/tests" from CLI.
|
// "dev/tests" from CLI.
|
||||||
|| (Director::is_cli() && $allowAllCLI)
|
|| (Director::is_cli() && $allowAllCLI)
|
||||||
|| Permission::check(['ADMIN', 'ALL_DEV_ADMIN', 'CAN_DEV_BUILD'])
|
|| Permission::check(DevBuildController::config()->get('init_permissions'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user