Skip to content

Commit b26c1b9

Browse files
committed
Enable modules by config
1 parent 9d8d4c6 commit b26c1b9

5 files changed

Lines changed: 6 additions & 40 deletions

File tree

docs/simplesamlphp-customauth.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ First we need to create the module directory:
1919
cd modules
2020
mkdir mymodule
2121

22-
Since this is a custom module, it should always be enabled.
23-
Therefore we create a `default-enable` file in the module.
24-
We do that by copying the `default-enable` file from the `core` module.
25-
26-
cd mymodule
27-
cp ../core/default-enable .
28-
22+
Since this is a custom module, it should always be enabled in the configuration.
2923
Now that we have our own module, we can move on to creating an authentication source.
3024

3125

docs/simplesamlphp-modules.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,13 @@ Each SimpleSAMLphp module is stored in a directory under the
4646
`modules`-directory. The module directory contains the following
4747
directories and files:
4848

49-
default-disable
50-
: The presence of this file indicates that the module is disabled
51-
by default. It can be enabled using the `module.enable`
52-
option in `config.php`.
53-
54-
default-enable
55-
: The presence of this file indicates that the module is enabled
56-
by default. It can be disabled using the `module.enable`
57-
option in `config.php`.
58-
59-
dictionaries
49+
locales
6050
: This directory contains dictionaries which belong to this
6151
module. To use a dictionary stored in a module, the extended tag
6252
names can be used:
6353
`{<module name>:<dictionary name>:<tag name>}` For
6454
example, `{example:login:hello}` will look up `hello` in
65-
`modules/example/dictionaries/login.php`.
55+
`modules/example/locales/<lang>/login.po`.
6656

6757
: It is also possible to specify
6858
`<module name>:<dictionary name>` as the default

docs/simplesamlphp-theming.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ The first thing you need to do is having a SimpleSAMLphp module to place your th
4444

4545
cd modules
4646
mkdir mymodule
47-
cd mymodule
48-
touch default-enable
47+
48+
Enable the module by setting `$config['module.enable' => ['mymodule' => true]]`
4949

5050
Then within this module, you can create a new theme named `fancytheme`.
5151

lib/SimpleSAML/Module.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -342,24 +342,6 @@ private static function isModuleEnabledWithConf(string $module, array $mod_confi
342342
throw new \Exception("Invalid module.enable value for the '$module' module.");
343343
}
344344

345-
if (
346-
assert_options(ASSERT_ACTIVE)
347-
&& !file_exists($moduleDir . '/default-enable')
348-
&& !file_exists($moduleDir . '/default-disable')
349-
) {
350-
Logger::error("Missing default-enable or default-disable file for the module $module");
351-
}
352-
353-
if (file_exists($moduleDir . '/enable')) {
354-
self::$module_info[$module]['enabled'] = true;
355-
return true;
356-
}
357-
358-
if (!file_exists($moduleDir . '/disable') && file_exists($moduleDir . '/default-enable')) {
359-
self::$module_info[$module]['enabled'] = true;
360-
return true;
361-
}
362-
363345
self::$module_info[$module]['enabled'] = false;
364346
return false;
365347
}

modules/exampleauth/lib/Auth/Source/External.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* To adapt this to your own web site, you should:
2020
* 1. Create your own module directory.
21-
* 2. Add a file "default-enable" to that directory.
21+
* 2. Enable to module in the config by adding '<module-dir>' => true to the $config['module.enable'] array.
2222
* 3. Copy this file and modules/exampleauth/www/resume.php to their corresponding
2323
* location in the new module.
2424
* 4. Replace all occurrences of "exampleauth" in this file and in resume.php with the name of your module.

0 commit comments

Comments
 (0)