- Splitted cronard definitions
- Added TMP_PATH env var - Added support for Events from attributes - Added Negundo client support
This commit is contained in:
1 parent
946281c884
commit
f482c19df5
23 files changed
+163
-82
No files matched your search
@@ -8,15 +8,11 @@ use %NAMESPACE%\{ Lib, Entity, Form, };
|
||||
|
||||
use function %NAMESPACE%\View\{ _, lang, url, route, form };
|
||||
|
||||
/**
|
||||
* @Language("%APPKEY%.home")
|
||||
*/
|
||||
#[Language("%APPKEY%.home")]
|
||||
class Home {
|
||||
use Lib\ControllerTrait;
|
||||
|
||||
/**
|
||||
* @Route("/", "name" => "home")
|
||||
*/
|
||||
#[Route("/", name: "home")]
|
||||
public function index(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||
{
|
||||
form(new Form\Form(), $this->pushContext(new Lib\FormContext($request, "form.name")));
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
namespace %NAMESPACE%\Entity;
|
||||
|
||||
use Ulmus\Entity\Field\Datetime;
|
||||
use Ulmus\{Attribute\Obj\Table;
|
||||
|
||||
use %NAMESPACE%\Lib;
|
||||
|
||||
/**
|
||||
* @Table('name' => "user")
|
||||
*/
|
||||
#[Table(name: "user")]
|
||||
class User extends \Ulmus\User\Entity\User implements \JsonSerializable
|
||||
{
|
||||
use Lib\EntityTrait;
|
||||
|
||||
@@ -14,6 +14,7 @@ new class(dirname(__DIR__)) extends \Lean\Kernel {
|
||||
'META_PATH' => "META_DIR",
|
||||
'PUBLIC_PATH' => "PUBLIC_DIR",
|
||||
'PRIVATE_PATH' => "PRIVATE_DIR",
|
||||
'TMP_PATH' => "TMP_DIR",
|
||||
'VIEW_PATH' => "VIEW_DIR",
|
||||
];
|
||||
|
||||
|
||||
@@ -6,12 +6,14 @@ use Picea\Picea;
|
||||
use Storage\Session;
|
||||
use Ulmus\User\Entity\User;
|
||||
use Ulmus\User\Lib\Authenticate;
|
||||
use Notes\Route\Attribute\Object\Route;
|
||||
use Notes\Security\Attribute\Security;
|
||||
use %NAMESPACE%\Entity;
|
||||
|
||||
/**
|
||||
* @Security("locked" => false)
|
||||
* @RouteParam("methods" => [ "GET", "POST" ])
|
||||
*/
|
||||
use Mcnd\Event\EventManager;
|
||||
|
||||
#[Security(locked: false)]
|
||||
#[Route(method: ['GET', 'POST', ])]
|
||||
trait ControllerTrait {
|
||||
use \Lean\ControllerTrait;
|
||||
|
||||
@@ -19,14 +21,18 @@ trait ControllerTrait {
|
||||
|
||||
protected Authenticate $authenticate;
|
||||
|
||||
public function __construct(Picea $picea, Session $session, Authenticate $authenticate) {
|
||||
$this->initializeController($picea, $session, $authenticate);
|
||||
protected EventManager $eventManager;
|
||||
|
||||
public function __construct(Picea $picea, Session $session, Authenticate $authenticate, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
|
||||
$this->initializeController($picea, $session, $authenticate, $breadcrumb, $eventManager);
|
||||
}
|
||||
|
||||
public function initializeController(Picea $picea, Session $session, Authenticate $authenticate) {
|
||||
public function initializeController(Picea $picea, Session $session, Authenticate $authenticate, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
|
||||
$this->picea = $picea;
|
||||
$this->authenticate = $authenticate;
|
||||
$this->session = $session;
|
||||
$this->eventManager = $eventManager;
|
||||
$this->breadcrumb = $breadcrumb;
|
||||
$this->user = $authenticate->rememberMe( Entity\User::repository() ) ?: new Entity\User();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,13 +23,9 @@ class Authentication implements MiddlewareInterface {
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Middleware request handling
|
||||
*
|
||||
* @param ServerRequestInterface $request
|
||||
* @param RequestHandlerInterface $handler
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
#[param ServerRequestInterface $request]
|
||||
#[param RequestHandlerInterface $handler]
|
||||
#[return ResponseInterface]
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
|
||||
{
|
||||
$user = $this->session->get( $this->sessionUserVariable() );
|
||||
@@ -41,12 +37,8 @@ class Authentication implements MiddlewareInterface {
|
||||
return $handler->handle($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter / setter of Session User Variable
|
||||
*
|
||||
* @param string|null sessionUserVariable
|
||||
* @return mixed
|
||||
*/
|
||||
#[param string|null sessionUserVariable]
|
||||
#[return mixed]
|
||||
public function sessionUserVariable(?string $set = null) : string
|
||||
{
|
||||
return $set !== null ? $this->sessionUserVariable = $set : $this->sessionUserVariable;
|
||||
|
||||
Reference in new issue
Block a user