protected function create(Container $c) { if ($c->has('acl-backend')) { $backend = $c->get('acl-backend'); } else { $backend = new A\Backend\XML($c->get('app')->path('resources/acl/'), $c->get('cache')); } $acl = new A\ACL($backend); if ($c->has('auth')) { $acl->setSessionRole($c->get('auth')->getUser()); } return $acl; }
protected function create(Container $c) { $auth = new Manager($c->get('session'), $c->get('auth-provider'), $c->get('config')->get('session.autologin', true) && $c->has('autologin-provider') ? $c->get('autologin-provider') : null); $request = $c->get('request'); $c->get('controller')->addSendListener(function ($response) use($request, $auth) { $auth->visit($request); }); if ($auth->usesAutologin()) { $auth->addLoadListener(function ($user) use($request, $auth) { if ($user->isGuest()) { $auth->autologin($request); } }); } return $auth; }
protected function create(Container $c) { $config = $c->get('config'); $prefix = $config->get('routing.prefix'); if ($c->has('request')) { $req = $c->get('request'); $domain = $config->get('routing.domain', $req->host()); $scheme = $config->get('routing.scheme', $req->scheme()); $base = $config->get('routing.base', $req->guessBase()); } else { $domain = $config->get('routing.domain'); $scheme = $config->get('routing.scheme'); $base = $config->get('routing.base', '/'); } $router = new Routing\Router($base, $prefix, $domain, $scheme); $builder = new Routing\Builder\XML($c->get('app')->path('resources/routes/'), $c->get('cache')); return $builder->fill($router); }