Skip to content
Snippets Groups Projects
Commit b26c1b97 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Enable modules by config

parent 9d8d4c60
Branches
Tags
No related merge requests found
...@@ -19,13 +19,7 @@ First we need to create the module directory: ...@@ -19,13 +19,7 @@ First we need to create the module directory:
cd modules cd modules
mkdir mymodule mkdir mymodule
Since this is a custom module, it should always be enabled. Since this is a custom module, it should always be enabled in the configuration.
Therefore we create a `default-enable` file in the module.
We do that by copying the `default-enable` file from the `core` module.
cd mymodule
cp ../core/default-enable .
Now that we have our own module, we can move on to creating an authentication source. Now that we have our own module, we can move on to creating an authentication source.
......
...@@ -46,23 +46,13 @@ Each SimpleSAMLphp module is stored in a directory under the ...@@ -46,23 +46,13 @@ Each SimpleSAMLphp module is stored in a directory under the
`modules`-directory. The module directory contains the following `modules`-directory. The module directory contains the following
directories and files: directories and files:
default-disable locales
: The presence of this file indicates that the module is disabled
by default. It can be enabled using the `module.enable`
option in `config.php`.
default-enable
: The presence of this file indicates that the module is enabled
by default. It can be disabled using the `module.enable`
option in `config.php`.
dictionaries
: This directory contains dictionaries which belong to this : This directory contains dictionaries which belong to this
module. To use a dictionary stored in a module, the extended tag module. To use a dictionary stored in a module, the extended tag
names can be used: names can be used:
`{<module name>:<dictionary name>:<tag name>}` For `{<module name>:<dictionary name>:<tag name>}` For
example, `{example:login:hello}` will look up `hello` in example, `{example:login:hello}` will look up `hello` in
`modules/example/dictionaries/login.php`. `modules/example/locales/<lang>/login.po`.
: It is also possible to specify : It is also possible to specify
`<module name>:<dictionary name>` as the default `<module name>:<dictionary name>` as the default
......
...@@ -44,8 +44,8 @@ The first thing you need to do is having a SimpleSAMLphp module to place your th ...@@ -44,8 +44,8 @@ The first thing you need to do is having a SimpleSAMLphp module to place your th
cd modules cd modules
mkdir mymodule mkdir mymodule
cd mymodule
touch default-enable Enable the module by setting `$config['module.enable' => ['mymodule' => true]]`
Then within this module, you can create a new theme named `fancytheme`. Then within this module, you can create a new theme named `fancytheme`.
......
...@@ -342,24 +342,6 @@ class Module ...@@ -342,24 +342,6 @@ class Module
throw new \Exception("Invalid module.enable value for the '$module' module."); throw new \Exception("Invalid module.enable value for the '$module' module.");
} }
if (
assert_options(ASSERT_ACTIVE)
&& !file_exists($moduleDir . '/default-enable')
&& !file_exists($moduleDir . '/default-disable')
) {
Logger::error("Missing default-enable or default-disable file for the module $module");
}
if (file_exists($moduleDir . '/enable')) {
self::$module_info[$module]['enabled'] = true;
return true;
}
if (!file_exists($moduleDir . '/disable') && file_exists($moduleDir . '/default-enable')) {
self::$module_info[$module]['enabled'] = true;
return true;
}
self::$module_info[$module]['enabled'] = false; self::$module_info[$module]['enabled'] = false;
return false; return false;
} }
......
...@@ -18,7 +18,7 @@ use Webmozart\Assert\Assert; ...@@ -18,7 +18,7 @@ use Webmozart\Assert\Assert;
* *
* To adapt this to your own web site, you should: * To adapt this to your own web site, you should:
* 1. Create your own module directory. * 1. Create your own module directory.
* 2. Add a file "default-enable" to that directory. * 2. Enable to module in the config by adding '<module-dir>' => true to the $config['module.enable'] array.
* 3. Copy this file and modules/exampleauth/www/resume.php to their corresponding * 3. Copy this file and modules/exampleauth/www/resume.php to their corresponding
* location in the new module. * location in the new module.
* 4. Replace all occurrences of "exampleauth" in this file and in resume.php with the name of your module. * 4. Replace all occurrences of "exampleauth" in this file and in resume.php with the name of your module.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment