Integrate Dokuwiki ACL for file endpoint
This commit is contained in:
@@ -27,7 +27,6 @@ C:\\xampp\\htdocs\\wiki\\
|
||||
/linux/file/path/
|
||||
/linux/another/path/../..//another/blargh/../path
|
||||
A> alias
|
||||
W> webfoo
|
||||
EOT
|
||||
);
|
||||
}
|
||||
@@ -53,12 +52,12 @@ EOT
|
||||
'/linux/another/path/' => [
|
||||
'root' => '/linux/another/path/',
|
||||
'alias' => 'alias/',
|
||||
'web' => 'webfoo',
|
||||
'web' => '/lib/plugins/luxtools/file.php?root=%2Flinux%2Fanother%2Fpath%2F&file=',
|
||||
],
|
||||
'alias/' => [
|
||||
'root' => '/linux/another/path/',
|
||||
'alias' => 'alias/',
|
||||
'web' => 'webfoo',
|
||||
'web' => '/lib/plugins/luxtools/file.php?root=%2Flinux%2Fanother%2Fpath%2F&file=',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ A> start
|
||||
|
||||
C:\\pads\\notes.md
|
||||
A> notes
|
||||
W> ignored
|
||||
|
||||
\\\\server\\share\\pads\\team.txt
|
||||
A> team
|
||||
|
||||
@@ -29,7 +29,8 @@ class plugin_luxtools_test extends DokuWikiTest
|
||||
parent::setUp();
|
||||
|
||||
// Setup config so that access to the TMP directory will be allowed
|
||||
$conf ['plugin']['luxtools']['paths'] = TMP_DIR . '/filelistdata/' . "\n" . 'A> /Scape' . "\n" . 'W> http://localhost/';
|
||||
// Use the built-in file.php endpoint.
|
||||
$conf ['plugin']['luxtools']['paths'] = TMP_DIR . '/filelistdata/' . "\n" . 'A> /Scape';
|
||||
|
||||
}
|
||||
|
||||
@@ -244,6 +245,27 @@ class plugin_luxtools_test extends DokuWikiTest
|
||||
$this->assertStringContainsString('height="150"', $xhtml);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the built-in file endpoint includes the host page id so file.php can
|
||||
* enforce per-page ACL.
|
||||
*/
|
||||
public function test_file_links_include_page_id_for_acl()
|
||||
{
|
||||
global $ID;
|
||||
$ID = 'luxtools:acltest';
|
||||
|
||||
$instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=list&direct=1}}');
|
||||
$xhtml = p_render('xhtml', $instructions, $info);
|
||||
|
||||
$doc = new Document();
|
||||
$doc->html($xhtml);
|
||||
|
||||
$href = (string)$doc->find('div.luxtools-plugin a')->first()->attr('href');
|
||||
$this->assertNotSame('', $href);
|
||||
$this->assertStringContainsString('lib/plugins/luxtools/file.php', $href);
|
||||
$this->assertStringContainsString('id=luxtools%3Aacltest', $href);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks that the open syntax renders an inline link.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user