WIP on liteing the framework
This commit is contained in:
1 parent
bc55a2ab89
commit
9b795b857a
7 files changed
+36
-67
No files matched your search
@@ -25,11 +25,16 @@ return [
|
||||
|
||||
Event\EventDefinition::class => function($c) {
|
||||
return new Event\EventDefinition([
|
||||
new class() implements RoutingCompileRoutes {
|
||||
|
||||
new class($c->has(\Picea\Extension\UrlExtension::class) ? $c->get(\Picea\Extension\UrlExtension::class) : null) implements RoutingCompileRoutes {
|
||||
public function __construct(
|
||||
protected ? \Picea\Extension\UrlExtension $extension,
|
||||
) {}
|
||||
|
||||
public function execute(Routing $routing, Route $attribute) : void
|
||||
{
|
||||
if (null !== ($name = $attribute->name ?? null)) {
|
||||
$routing->extension->registerRoute($name, $attribute->getRoute(), $attribute->class, $attribute->classMethod, $attribute->methods ?? (array)$attribute->method);
|
||||
$this->extension->registerRoute($name, $attribute->getRoute(), $attribute->class, $attribute->classMethod, $attribute->methods ?? (array)$attribute->method);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -45,7 +50,9 @@ return [
|
||||
|
||||
# Checking if user needs to be logged
|
||||
if ( $container->has(SecurityHandler::class) ){
|
||||
if ( $redirect = $container->get(SecurityHandler::class)->verify($class, $method) ) {
|
||||
$securityHandler = $container->get(SecurityHandler::class);
|
||||
|
||||
if ( $redirect = $securityHandler->verify($class, $method) ) {
|
||||
if ( empty($object->user) || ! $object->user->logged ) {
|
||||
$routing->session->set('redirectedFrom', (string) $request->getUri());
|
||||
$routing->response = $redirect;
|
||||
@@ -54,7 +61,7 @@ return [
|
||||
}
|
||||
}
|
||||
|
||||
if ( $container->has(Taxus::class) ) {
|
||||
if ( $securityHandler->isLocked($class, $method) && $container->has(Taxus::class) ) {
|
||||
if ( $forbidden = $container->get(SecurityHandler::class)->taxus($class, $method, $object->user ?? null) ) {
|
||||
$routing->response = $forbidden;
|
||||
|
||||
|
||||
Reference in new issue
Block a user