| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| @@ -0,0 +1,11 @@ | |||
| <?php | |||
|
|
|||
| return [ | |||
There was a problem hiding this comment.
This file returns all modules/bundles to be loaded. The kernel supports environments, so we can indicate if they should be loaded in all or just in a few of them.
Sorry, something went wrong.
|
|
||
| return [ | ||
| // Don't remove this bundles | ||
| Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], |
There was a problem hiding this comment.
Probably FrameworkBundle is too huge to be used and we can create a custom one.
Sorry, something went wrong.
| /** | ||
| * @param string $module | ||
| */ | ||
| public function __construct(string $module) |
There was a problem hiding this comment.
New Kernel is not just for one module.
Sorry, something went wrong.
| $confDir = Module::getModuleDir($this->module) . '/routing/services'; | ||
| if (is_dir($confDir)) { | ||
| $loader->load($confDir . '/**/*' . self::CONFIG_EXTS, 'glob'); | ||
| foreach ($this->bundles as $bundle) { |
There was a problem hiding this comment.
This iterator search in all bundles the ones that are SSP Modules and checks if they have a routes directory (and load the route files). The module name is used a prefix to the url.
Sorry, something went wrong.
| } | ||
| $confDir = __DIR__ . '/Resources/config'; | ||
|
|
||
| $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); |
There was a problem hiding this comment.
Load routes required by simplesaml to work. For example the route required to have the debug toolbar.
Sorry, something went wrong.
| * @return void | ||
| */ | ||
| private function registerModuleControllers(ContainerBuilder $container): void | ||
| protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) |
There was a problem hiding this comment.
Load services required by the core of simplesaml (modules services are loaded inside the Module loader class).
Sorry, something went wrong.
| use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; | ||
| use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
|
||
| abstract class Module extends Bundle |
There was a problem hiding this comment.
This abstract class extends from Symfony Bundle abstract class. So a module is a bundle. Probably we can create a thin abstract class because we don't require all the logic inside the base class.
Sorry, something went wrong.
| { | ||
| abstract public function getShortName(): string; | ||
|
|
||
| public function build(ContainerBuilder $container) |
There was a problem hiding this comment.
This method is called when the cache is warmed. Here we can define the services this module will use.
Sorry, something went wrong.
| * @param ContainerBuilder $container | ||
| * @return void | ||
| */ | ||
| private function registerModuleControllers(ContainerBuilder $container): void |
There was a problem hiding this comment.
We register controller services. The idea is to create similar methods for each service we want to define automatically (hooks/events, admin menus, etc.). The possibility to use a services.yml to load custom services will be available. But this methods exists to do the module development easiest.
Sorry, something went wrong.
| $baseDir = $this->configuration->getBaseDir(); | ||
| if (is_null($module)) { | ||
| $file = $baseDir . 'www/assets/' . $asset; | ||
| $file = $baseDir . 'www/' . $asset; |
There was a problem hiding this comment.
I use symfony/asset module that implements asset function in twig. This modification is to have the same behaviour in the old a new way to read templates.
Sorry, something went wrong.
|
Translations in symfony supports a lot of loaders (po, yaml, xliff, csv, ...). Gettext loader (po files) does not require gettext php module (apparently, I will investigate more about this). There are a difference. The structure of translations files change from locales/LANGCODE/LC_MESSAGES/module.po to translations/module.LANGCODE.po. With a script is easy to move files. But trans function in yaml files requires that we indicate the module if it is differente from default (messages). |
Sorry, something went wrong.
|
Oops, I did not intend to do this, but @sgomez should this be merged at some point? Let's not let this go to waste.. |
Sorry, something went wrong.
|
Hi @tvdijen This is just a PoC. This requires a lot of discussion because is a huge change in the way modules are loaded. |
Sorry, something went wrong.
Required to run the tests for simplesamlphp/simplesamlphp#1294
There was a problem hiding this comment.
The RouteCollectionBuilder was deprecated by Symfony in favour of the RoutingConfigurator.
Unfortunately I can't get it to work with the new class and I don't know what to do with the $prefix variable.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR is related to #1286 issue.
Changes:
Instructions:
I have this authsource to check the module:
'example-static' => [ 'exampleauth:StaticSource', 'uid' => ['testuser'], 'eduPersonAffiliation' => ['member', 'employee'], 'cn' => ['Test User'], 'schacExpiryDate' => '20051231235959Z' ],And this filter:
10 => array( 'class' => SimpleSAML\Modules\ExpiryCheckModule\Auth\Process\ExpiryDate::class, 'netid_attr' => 'eduPersonPrincipalName', 'expirydate_attr' => 'schacExpiryDate', 'warndaysbefore' => '60', 'date_format' => 'd.m.Y', # php date syntax ),The idea is to run the ExpiredController and load templates and translation from vendor without install the modules inside simplesamlphp directory.
More explanations in the code.