Fixed ACL

Also changed some settings defaults and text
This commit is contained in:
Simon DELAGE 2014-08-31 03:13:16 +02:00
parent 77554d9fc3
commit fe71204944
4 changed files with 26 additions and 17 deletions

View file

@ -120,10 +120,19 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin
if ( $this->getConf('set_permissions') == 1 )
{
$acl = new admin_plugin_acl();
$ns = cleanID($this->home_wiki_ns.':'.$this->homePage());
$acl->_acl_add($ns, '@ALL', (int)$this->getConf('set_permissions_others'));
$acl->_acl_add($ns, strtolower($_SERVER['REMOTE_USER']), AUTH_DELETE);
}
// Old user-page ACL:
// $ns = cleanID($this->home_wiki_ns.':'.$this->homePage());
// New user-namespace ACL:
$ns = cleanID($this->home_wiki_ns).':*';
$acl->_acl_add($this->getConf('users_namespace').':*', '@ALL', (int)$this->getConf('set_permissions_others'));
$acl->_acl_add($this->getConf('users_namespace').':*', '@user', (int)$this->getConf('set_permissions_others'));
$acl->_acl_add($ns, strtolower($_SERVER['REMOTE_USER']), AUTH_DELETE); }
// If the 2 lines concerning set_permissions_others above allready existed in conf/acl.auth.php file they've been duplicated so let's read the file
$lines = file(DOKU_INC.'conf/acl.auth.php');
// Only keep unique lines (OK, we loose an empty comment line...)
$lines = array_unique($lines);
// Write things back to conf/acl.auth.php
file_put_contents(DOKU_INC.'conf/acl.auth.php', implode($lines));;
if (!$this->getConf('edit_before_create'))
{
//writes the user info to page

View file

@ -6,9 +6,9 @@
$conf['use_name_string'] = 0;
$conf['use_start_page'] = 1;
$conf['users_namespace'] = 'private';
$conf['set_permissions'] = 1;
$conf['set_permissions_others'] = '0';
$conf['templatepath'] = 'lib/plugins/userhomepage/_template.txt';
$conf['users_namespace'] = 'user';
$conf['group_by_name'] = 1;
$conf['edit_before_create'] = 1;
$conf['templatepath'] = 'lib/plugins/userhomepage/_template.txt';
$conf['edit_before_create'] = 0;

View file

@ -4,11 +4,11 @@
* FIXED by Simon Delage <simon.geekitude@gmail.com> on 2014-08-30
*/
$meta['use_name_string'] = array('onoff');
$meta['use_name_string'] = array('onoff','_caution' => 'warning');
$meta['use_start_page'] = array('onoff');
$meta['users_namespace'] = array('string','_pattern' => '/^(|[a-zA-Z\-:]+)$/');
$meta['set_permissions'] = array('onoff');
$meta['set_permissions_others'] = array('multichoice','_choices'=>array('0','1','2','4','8','16'));
$meta['templatepath'] = array('string','_pattern' => '/^(|[a-zA-Z\-]+)$/');
$meta['users_namespace'] = array('string','_pattern' => '/^(|[a-zA-Z\-:]+)$/');
$meta['group_by_name'] = array('onoff');
$meta['templatepath'] = array('string','_pattern' => '/^(|[a-zA-Z\-]+)$/');
$meta['edit_before_create'] = array('onoff');

View file

@ -5,17 +5,17 @@
* FIXED by Simon Delage <simon.geekitude@gmail.com> on 2014-08-30
*/
$lang['use_name_string'] = 'Use user\'s full name instead of login for his namespace.';
$lang['use_name_string'] = 'Use user\'s full name instead of login for his namespace and homepage (will break <code>%USER%</code> wildcard in ACL for that namespace).';
$lang['use_start_page'] = 'Use the wiki\'s start page string instead of the user\'s namespace string set above for the start page of his namespace.';
$lang['set_permissions'] = 'Automatically configure acl for user\'s namespace.';
$lang['set_permissions_others'] = 'If set permission is enabled, what permission for other people (both @ALL and @user groups)?';
$lang['users_namespace'] = 'Namespace under which user namespaces are created (can be anything but <code>user</code> without messing up with Dokuwiki default behaviour).';
$lang['set_permissions'] = 'Automatically configure acl for the namespace set above and give full rights to users on their own namespace.';
$lang['set_permissions_others'] = 'If set permission is enabled, what permission for other people (both <code>@ALL</code> and <code>@user</code> groups) ?';
$lang['set_permissions_others_o_0'] = 'None';
$lang['set_permissions_others_o_1'] = 'Read';
$lang['set_permissions_others_o_2'] = 'Edit';
$lang['set_permissions_others_o_4'] = 'Create';
$lang['set_permissions_others_o_8'] = 'Upload';
$lang['set_permissions_others_o_16'] = 'Delete';
$lang['templatepath'] = 'Doku relative path to the template file.';
$lang['users_namespace'] = 'Namespace under which user namespaces are created (can be anything without messing up with Dokuwiki default behaviour, previous default was "people" but "user" makes more sense).';
$lang['group_by_name'] = 'Group users\' namespaces by the first character of user name?';
$lang['edit_before_create'] = 'Allow users to edit their namespace start page before create';
$lang['group_by_name'] = 'Group users\' namespaces by the first character of user name ?';
$lang['templatepath'] = 'Doku relative path to the template file for user\'s namespace start page.';
$lang['edit_before_create'] = 'Allow users to edit their namespace start page before create (note that template will not be used if you enable this option).';