Skip to content

Commit 79f3965

Browse files
committed
wizard generated
0 parents  commit 79f3965

File tree

11 files changed

+872
-0
lines changed

11 files changed

+872
-0
lines changed

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Config file for travis-ci.org
2+
3+
language: php
4+
php:
5+
- "7.3"
6+
- "7.2"
7+
- "7.1"
8+
- "7.0"
9+
- "5.6"
10+
env:
11+
- DOKUWIKI=master
12+
- DOKUWIKI=stable
13+
before_install: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh
14+
install: sh travis.sh
15+
script: cd _test && ./phpunit.phar --stderr --group plugin_pureldap

LICENSE

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

README

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
pureldap Plugin for DokuWiki
2+
3+
A new LDAP auth plugin
4+
5+
All documentation for this plugin can be found at
6+
https://www.dokuwiki.org/plugin:pureldap
7+
8+
If you install this plugin manually, make sure it is installed in
9+
lib/plugins/pureldap/ - if the folder is called different it
10+
will not work!
11+
12+
Please refer to http://www.dokuwiki.org/plugins for additional info
13+
on how to install plugins in DokuWiki.
14+
15+
----
16+
Copyright (C) Andreas Gohr <[email protected]>
17+
18+
This program is free software; you can redistribute it and/or modify
19+
it under the terms of the GNU General Public License as published by
20+
the Free Software Foundation; version 2 of the License
21+
22+
This program is distributed in the hope that it will be useful,
23+
but WITHOUT ANY WARRANTY; without even the implied warranty of
24+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+
GNU General Public License for more details.
26+
27+
See the LICENSING file for details

_test/general.test.php

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/**
3+
* General tests for the pureldap plugin
4+
*
5+
* @group plugin_pureldap
6+
* @group plugins
7+
*/
8+
class general_plugin_pureldap_test extends DokuWikiTest
9+
{
10+
11+
/**
12+
* Simple test to make sure the plugin.info.txt is in correct format
13+
*/
14+
public function test_plugininfo()
15+
{
16+
$file = __DIR__ . '/../plugin.info.txt';
17+
$this->assertFileExists($file);
18+
19+
$info = confToHash($file);
20+
21+
$this->assertArrayHasKey('base', $info);
22+
$this->assertArrayHasKey('author', $info);
23+
$this->assertArrayHasKey('email', $info);
24+
$this->assertArrayHasKey('date', $info);
25+
$this->assertArrayHasKey('name', $info);
26+
$this->assertArrayHasKey('desc', $info);
27+
$this->assertArrayHasKey('url', $info);
28+
29+
$this->assertEquals('pureldap', $info['base']);
30+
$this->assertRegExp('/^https?:\/\//', $info['url']);
31+
$this->assertTrue(mail_isvalid($info['email']));
32+
$this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
33+
$this->assertTrue(false !== strtotime($info['date']));
34+
}
35+
36+
/**
37+
* Test to ensure that every conf['...'] entry in conf/default.php has a corresponding meta['...'] entry in
38+
* conf/metadata.php.
39+
*/
40+
public function test_plugin_conf()
41+
{
42+
$conf_file = __DIR__ . '/../conf/default.php';
43+
if (file_exists($conf_file)) {
44+
include($conf_file);
45+
}
46+
$meta_file = __DIR__ . '/../conf/metadata.php';
47+
if (file_exists($meta_file)) {
48+
include($meta_file);
49+
}
50+
51+
$this->assertEquals(
52+
gettype($conf),
53+
gettype($meta),
54+
'Both ' . DOKU_PLUGIN . 'pureldap/conf/default.php and ' . DOKU_PLUGIN . 'pureldap/conf/metadata.php have to exist and contain the same keys.'
55+
);
56+
57+
if (gettype($conf) != 'NULL' && gettype($meta) != 'NULL') {
58+
foreach ($conf as $key => $value) {
59+
$this->assertArrayHasKey(
60+
$key,
61+
$meta,
62+
'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'pureldap/conf/metadata.php'
63+
);
64+
}
65+
66+
foreach ($meta as $key => $value) {
67+
$this->assertArrayHasKey(
68+
$key,
69+
$conf,
70+
'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'pureldap/conf/default.php'
71+
);
72+
}
73+
}
74+
75+
}
76+
}

action.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/**
3+
* DokuWiki Plugin pureldap (Action Component)
4+
*
5+
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6+
* @author Andreas Gohr <[email protected]>
7+
*/
8+
9+
// must be run within Dokuwiki
10+
if (!defined('DOKU_INC')) {
11+
die();
12+
}
13+
14+
class action_plugin_pureldap extends DokuWiki_Action_Plugin
15+
{
16+
17+
/**
18+
* Registers a callback function for a given event
19+
*
20+
* @param Doku_Event_Handler $controller DokuWiki's event controller object
21+
*
22+
* @return void
23+
*/
24+
public function register(Doku_Event_Handler $controller)
25+
{
26+
$controller->register_hook('NONE', 'FIXME', $this, 'handle_none');
27+
28+
}
29+
30+
/**
31+
* [Custom event handler which performs action]
32+
*
33+
* Called for event:
34+
*
35+
* @param Doku_Event $event event object by reference
36+
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
37+
* handler was registered]
38+
*
39+
* @return void
40+
*/
41+
public function handle_none(Doku_Event $event, $param)
42+
{
43+
}
44+
45+
}
46+

0 commit comments

Comments
 (0)