Commit 1c28c588 authored by kanellov's avatar kanellov
Browse files

authentication need reimplementation

parent b10ad7cf
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->notPath('data')
->filter(function (SplFileInfo $file) {
if (strstr($file->getPath(), 'compatibility')) {
return false;
}
});
$config = Symfony\CS\Config\Config::create();
$config->level(null);
$config->fixers(
array(
'braces',
'duplicate_semicolon',
'elseif',
'empty_return',
'encoding',
'eof_ending',
'function_call_space',
'function_declaration',
'indentation',
'join_function',
'line_after_namespace',
'linefeed',
'lowercase_keywords',
'parenthesis',
'multiple_use',
'method_argument_space',
'object_operator',
'php_closing_tag',
'psr0',
'remove_lines_between_uses',
'short_tag',
'standardize_not_equal',
'trailing_spaces',
'unused_use',
'visibility',
'whitespacy_lines',
'ternary_spaces',
'align_double_arrow',
'align_equals',
'concat_with_spaces',
'ordered_use',
'short_array_syntax',
'single_array_no_trailing_comma',
'multiline_array_trailing_comma',
'spaces_cast',
'return',
'double_arrow_multiline_whitespaces',
)
);
$config->finder($finder);
return $config;
\ No newline at end of file
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -11,7 +12,9 @@ return [
'modules' => [
'module/authentication/bootstrap.php',
'module/authorization/bootstrap.php',
'module/sch_ldap/bootstrap.php',
'module/sch_sso/bootstrap.php',
'module/sch_auto_create/bootstrap.php',
'module/application/bootstrap.php',
],
'cache_config' => 'data/cache/config/settings.php',
......
<?php
return [
'determineRouteBeforeAppMiddleware' => true,
'displayErrorDetails' => true,
'db' => [
'dsn' => 'sqlite:' . __DIR__ . '/../data/tmp/db.sq3',
'user' => null,
'pass' => null,
'options' => [
],
],
];
<?php
return [
'acl' => [
'default_role' => 'guest',
'roles' => [
'guest' => [],
'user' => [],
'admin' => ['user'],
],
'resoures' => [],
'guards' => [
'resources' => [],
'callables' => [],
'routes' => [
['/', ['guest', 'user'], ['get']],
['/user/login', ['guest'], ['get', 'post']],
['/user/logout', ['user'], ['get']],
['/school', ['guest', 'user'], ['get']],
['/school/labs', ['guest', 'user'], ['get']],
['/school/staff', ['guest', 'user'], ['get']],
['/school/assets', ['guest', 'user'], ['get']],
],
],
],
];
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......
<?php
/**
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
return [
'ldap' => [
'host' => '',
'username' => '',
'password' => '',
'baseDn' => '',
'port' => 389,
'useSsl' => false,
'bindRequiresDn' => true,
'accountCanonicalForm' => null,
'accountDomainName' => null,
'accountDomainNameShort' => null,
'accountFilterFormat' => null,
'allowEmptyPassword' => false,
'useStartTls' => false,
'optReferrals' => false,
'tryUsernameSplit' => true,
'networkTimeout' => null,
],
'sso' => [
'allowed' => '&(physicaldeliveryofficename=ΕΠΙΣΗΜΟΣ ΛΟΓΑΡΙΑΣΜΟΣ)(umdobject=account)',
],
];
\ No newline at end of file
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -22,22 +23,22 @@ return [
'info' => [
'label' => 'Πληροφορίες',
'route' => 'school',
'icon' => 'info'
'icon' => 'info',
],
'staff' => [
'label' => 'Εκπαιδευτικοί',
'route' => 'school.staff',
'icon' => 'users'
'icon' => 'users',
],
'labs' => [
'label' => 'Χώροι',
'route' => 'school.labs',
'icon' => 'building-o'
'icon' => 'building-o',
],
'assets' => [
'label' => 'Εξοπλισμός',
'route' => 'school.assets',
'icon' => 'tv'
'icon' => 'tv',
],
],
],
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -13,9 +14,9 @@ return function (Slim\App $app) {
$container['autoloader']->addPsr4('GrEduLabs\\Application\\', __DIR__ . '/src');
$container['view'] = function($c) {
$container['view'] = function ($c) {
$settings = $c['settings'];
$view = new Slim\Views\Twig(
$view = new Slim\Views\Twig(
$settings['view']['template_path'],
$settings['view']['twig']
);
......@@ -24,11 +25,7 @@ return function (Slim\App $app) {
$c['request']->getUri()
));
$view->addExtension(new GrEduLabs\Application\Twig\Extension\Navigation(
$settings['navigation'],
$c->get('router'),
$c->get('request')
));
$view->addExtension($c[GrEduLabs\Application\Twig\Extension\Navigation::class]);
$view->addExtension(new Knlv\Slim\Views\TwigMessages(
$c['flash']
));
......@@ -36,12 +33,20 @@ return function (Slim\App $app) {
return $view;
};
$container[GrEduLabs\Application\Twig\Extension\Navigation::class] = function ($c) {
return new GrEduLabs\Application\Twig\Extension\Navigation(
$c['settings']['navigation'],
$c['router'],
$c['request']
);
};
$container['flash'] = function ($c) {
return new \Slim\Flash\Messages();
};
$container['logger'] = function ($c) {
$settings = $c['settings'];
$settings = $c['settings'];
$logger = new Monolog\Logger($settings['logger']['name']);
$logger->pushProcessor(new Monolog\Processor\UidProcessor());
$logger->pushHandler(new Monolog\Handler\RotatingFileHandler(
......@@ -57,6 +62,10 @@ return function (Slim\App $app) {
return new GrEduLabs\Application\Authentication\RedbeanListener();
};
$container['csrf'] = function ($c) {
return new \Slim\Csrf\Guard();
};
$events = $container['events'];
$events('on', 'bootstrap', function () use ($container) {
session_name('GrEduLabs');
......@@ -65,17 +74,20 @@ return function (Slim\App $app) {
// setup RedbeanPHP
RedBeanPHP\R::setup(
$container['settings']['db']['dsn'],
$container['settings']['db']['dsn'],
$container['settings']['db']['user'],
$container['settings']['db']['pass']
);
}, 1000000);
$events('on', 'authenticate', $container['authenticate_redbean_listener']);
$container['csrf'] = function ($c) {
return new \Slim\Csrf\Guard();
};
define('REDBEAN_MODEL_PREFIX', 'GrEduLabs\\Application\\Model\\');
}, 10000000);
$events('on', 'bootstrap', function () use ($container) {
$container['router']->getNamedRoute('user.login')->add('csrf');
});
$events('on', 'authenticate', $container['authenticate_redbean_listener']);
$container['GrEduLabs\\Application\\Action\\Index'] = function ($c) {
return new GrEduLabs\Application\Action\Index($c['view']);
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -15,7 +16,6 @@ use Slim\Views\Twig;
class Index
{
protected $view;
public function __construct(Twig $view)
......@@ -28,19 +28,19 @@ class Index
return $this->view->render($res, 'app-form/index.twig', [
'assets' => [
[
'typeName' => 'ΒΙΝΤΕΟΠΡΟΒΟΛΕΑΣ',
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 1',
'quantity' => 2,
'typeName' => 'ΒΙΝΤΕΟΠΡΟΒΟΛΕΑΣ',
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 1',
'quantity' => 2,
],
[
'typeName' => 'LAPTOP',
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'quantity' => 1,
'typeName' => 'LAPTOP',
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'quantity' => 1,
],
[
'typeName' => 'ΠΛΗΚΤΡΟΛΟΓΙΟ',
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'quantity' => 10,
'typeName' => 'ΠΛΗΚΤΡΟΛΟΓΙΟ',
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'quantity' => 10,
],
],
'for_choices' => [
......@@ -59,26 +59,26 @@ class Index
],
'lab_choices' => [
[
'value' => 1,
'label' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 1',
'value' => 1,
'label' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 1',
],
[
'value' => 2,
'label' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'value' => 2,
'label' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
],
],
'type_choices' => [
[
'value' => 1,
'label' => 'ΒΙΝΤΕΟΠΡΟΒΟΛΕΑΣ',
'value' => 1,
'label' => 'ΒΙΝΤΕΟΠΡΟΒΟΛΕΑΣ',
],
[
'value' => 3,
'label' => 'LAPTOP',
'value' => 3,
'label' => 'LAPTOP',
],
[
'value' => 2,
'label' => 'ΠΛΗΚΤΡΟΛΟΓΙΟ',
'value' => 2,
'label' => 'ΠΛΗΚΤΡΟΛΟΓΙΟ',
],
],
]);
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -14,7 +15,6 @@ use Slim\Http\Response;
class SubmitAppForm
{
public function __invoke(Request $req, Response $res, array $args = [])
{
$params = $req->getParams();
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -21,7 +22,8 @@ class Index
protected $view;
/**
* Constructor
* Constructor.
*
* @param Twig $view
*/
public function __construct(Twig $view)
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -15,7 +16,6 @@ use Slim\Views\Twig;
class Assets
{
protected $view;
public function __construct(Twig $view)
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -15,7 +16,6 @@ use Slim\Views\Twig;
class Index
{
protected $view;
public function __construct(Twig $view)
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -15,7 +16,6 @@ use Slim\Views\Twig;
class Labs
{
protected $view;
public function __construct(Twig $view)
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -15,7 +16,6 @@ use Slim\Views\Twig;
class Staff
{
protected $view;
public function __construct(Twig $view)
......
<?php
/**
* gredu_labs
* gredu_labs.
*
* @link https://github.com/eellak/gredu_labs for the canonical source repository
*
* @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
* @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
*/
......@@ -17,7 +18,6 @@ class RedbeanListener
return false;
}
$stop();
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment