From 5f162cfd344f6b75fa39a57be4b3d488cadd1535 Mon Sep 17 00:00:00 2001 From: joey Date: Fri, 2 Feb 2007 02:33:03 +0000 Subject: * Add canedit hook, allowing arbitrary controls over when a page can be edited. * Move code forcing signing before edit to a new "signinedit" plugin, and code checking for locked pages into a new "lockedit" plugin. Both are enabled by default. * Remove the anonok config setting. This is now implemented by a new "anonok" plugin. Anyone with a wiki allowing anonymous edits should change their configs to enable this new plugin. * Add an opendiscussion plugin that allows anonymous users to edit discussion pages, on a wiki that is otherwise wouldn't allow it. * Lots of CGI code reorg and cleanup. --- doc/features.mdwn | 10 ++++++---- doc/ikiwiki.setup | 4 +--- doc/index/discussion.mdwn | 18 ------------------ doc/plugins.mdwn | 8 ++++---- doc/plugins/anonok.mdwn | 5 +++++ doc/plugins/lockedit.mdwn | 4 ++++ doc/plugins/opendiscussion.mdwn | 5 +++++ doc/plugins/signinedit.mdwn | 5 +++++ doc/plugins/type/auth.mdwn | 2 +- doc/plugins/write.mdwn | 14 ++++++++++++++ doc/todo/discuss_without_login.mdwn | 19 +++++++++++++++++++ doc/usage.mdwn | 6 ------ doc/w3mmode/ikiwiki.setup | 2 +- 13 files changed, 65 insertions(+), 37 deletions(-) create mode 100644 doc/plugins/anonok.mdwn create mode 100644 doc/plugins/lockedit.mdwn create mode 100644 doc/plugins/opendiscussion.mdwn create mode 100644 doc/plugins/signinedit.mdwn create mode 100644 doc/todo/discuss_without_login.mdwn (limited to 'doc') diff --git a/doc/features.mdwn b/doc/features.mdwn index b2c810f30..58d6d09cd 100644 --- a/doc/features.mdwn +++ b/doc/features.mdwn @@ -129,7 +129,7 @@ and can be enabled by enabling [[CGI]]. ### User registration -Can optionally be configured to allow only registered users to post +Can optionally be configured to allow only registered users to edit pages. User registration can be done using a web form, or ikiwiki can be @@ -142,10 +142,12 @@ Thanks to subpages, every page can easily and automatically have a /Discussion subpage. By default, these links are included in the [[templates]] for each page. -### Page locking +### Edit controls -Wiki admins can [[lock_pages|page_locking]] so that only other admins -can edit them. +Wiki admins can [[lock_pages|page_locking]] so that only other admins can +edit them. Or a wiki can be set up to allow anyone to edit Discussion +pages, but only registered users to edit other pages. These are just two +possibilities, since page edit controls can be changed via plugins. ### [[PageHistory]] diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup index 910b2b527..a25d9f50e 100644 --- a/doc/ikiwiki.setup +++ b/doc/ikiwiki.setup @@ -71,8 +71,6 @@ use IkiWiki::Setup::Standard { #}, ], - # Can anonymous web users edit pages? - #anonok => 1, # Generate rss feeds for blogs? rss => 1, # Generate atom feeds for blogs? @@ -98,7 +96,7 @@ use IkiWiki::Setup::Standard { # To add plugins, list them here. #add_plugins => [qw{goodstuff openid search wikitext camelcase - # htmltidy fortune sidebar map rst}], + # htmltidy fortune sidebar map rst anonok}], # If you want to disable any of the default plugins, list them here. #disable_plugins => [qw{inline htmlscrubber passwordauth}], diff --git a/doc/index/discussion.mdwn b/doc/index/discussion.mdwn index e60ab0f50..7f82e87ce 100644 --- a/doc/index/discussion.mdwn +++ b/doc/index/discussion.mdwn @@ -162,21 +162,3 @@ Clicking on an old "?" or going to a create link but new Markdown content exists >>> discussion, or users/discussion, but not index/discussion, since this >>> page already exists. If all the pages existed, it would do the redirect >>> thing. --[[Joey]] - ----- - -# Discuss without login? Or feedback forum? Or fine-tuned per-page access control? - -Any plugin or option for allowing website visitors to edit the discuss page without logging in (without having ikiwiki accounts)? - -Or any plugin to add a feedback form (and maybe threads) to extend a Wiki webpage? - -Or is there per-page access control that can be fine-tuned to lock some users or groups for specific pages? -(The [[pagespec]] does show a way to lock all pages except for Discussion pages, but I want some users to also be able to edit other pages.) - -I want a way for website visitors to be able to give feedback on the wiki pages without having to sign up or log in. -I don't want them to be able to edit the exiting wiki pages except maybe Discussion page. - -(For some reason, it seems like I asked this before ...) - ---JeremyReed \ No newline at end of file diff --git a/doc/plugins.mdwn b/doc/plugins.mdwn index 46527ce4f..1006a9e1c 100644 --- a/doc/plugins.mdwn +++ b/doc/plugins.mdwn @@ -7,10 +7,10 @@ wiki, or just have [[type/fun]]. There's documentation if you want to [[write]] your own plugins, or you can install and use plugins [[contributed|contrib]] by others. -The [[mdwn]], [[inline]], [[htmlscrubber]], and [[passwordauth]] plugins -are enabled by default. To enable other plugins, use the `--plugin` switch -described in [[usage]], or the equivalent `add_plugins` line in -[[ikiwiki.setup]]. +The [[mdwn]], [[inline]], [[htmlscrubber]], [[passwordauth]], +[[signinedit]], and [[lockedit]] plugins are enabled by default. +To enable other plugins, use the `--plugin` switch described in +[[usage]], or the equivalent `add_plugins` line in [[ikiwiki.setup]]. # Plugin directory diff --git a/doc/plugins/anonok.mdwn b/doc/plugins/anonok.mdwn new file mode 100644 index 000000000..ae1c87f43 --- /dev/null +++ b/doc/plugins/anonok.mdwn @@ -0,0 +1,5 @@ +[[template id=plugin name=anonok included=1 author="[[Joey]]"]] +[[tag type/auth]] + +By default, anonymous users cannot edit the wiki. This plugin allows +anonymous web users, who have not signed in, to edit any page in the wiki. diff --git a/doc/plugins/lockedit.mdwn b/doc/plugins/lockedit.mdwn new file mode 100644 index 000000000..be9ca841c --- /dev/null +++ b/doc/plugins/lockedit.mdwn @@ -0,0 +1,4 @@ +[[template id=plugin name=lockedit core=1 included=1 author="[[Joey]]"]] +[[tag type/auth]] + +This plugin enables [[page_locking]]. It is enabled by default. diff --git a/doc/plugins/opendiscussion.mdwn b/doc/plugins/opendiscussion.mdwn new file mode 100644 index 000000000..3257224dc --- /dev/null +++ b/doc/plugins/opendiscussion.mdwn @@ -0,0 +1,5 @@ +[[template id=plugin name=opendiscussion included=1 author="[[Joey]]"]] +[[tag type/auth]] + +This plugin allows editing of Discussion pages by anonymous users who have +not logged into the wiki. diff --git a/doc/plugins/signinedit.mdwn b/doc/plugins/signinedit.mdwn new file mode 100644 index 000000000..5beae9dab --- /dev/null +++ b/doc/plugins/signinedit.mdwn @@ -0,0 +1,5 @@ +[[template id=plugin name=signinedit core=1 included=1 author="[[Joey]]"]] +[[tag type/auth]] + +This plugin, which is enabled by default, requires users be logged in +before editing pages in the wiki. diff --git a/doc/plugins/type/auth.mdwn b/doc/plugins/type/auth.mdwn index a6ae5e4ea..400a5bcca 100644 --- a/doc/plugins/type/auth.mdwn +++ b/doc/plugins/type/auth.mdwn @@ -1,2 +1,2 @@ These plugins add different authentication methods for logging in to the -wiki. +wiki and control what pages users can edit. diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 6c475024a..d0f256ca2 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -192,6 +192,20 @@ object's "name" parameter to the authenticated user's name. Note that if the name is set to the name of a user who is not registered, a basic registration of the user will be automatically performed. +### canedit + + hook(type => "canedit", id => "foo", call => \&pagelocked); + +This hook can be used to implement arbitrary access methods to control when +a page can be edited using the web interface (commits from revision control +bypass it). When a page is edited, each registered canedit hook is called +in turn, and passed the page name, a CGI object, and a session object. + +If edit can proceed, the hook should return "". If the edit is not allowed +by this hook, the hook should return an error message for the user to see. +If the hook has no opinion about whether the edit can proceed, return +`undef`, and the next plugin will be asked to decide. + ### formbuilder hook(type => "formbuilder_setup", id => "foo", call => \&formbuilder_setup); diff --git a/doc/todo/discuss_without_login.mdwn b/doc/todo/discuss_without_login.mdwn new file mode 100644 index 000000000..74f3cde70 --- /dev/null +++ b/doc/todo/discuss_without_login.mdwn @@ -0,0 +1,19 @@ +# Discuss without login? Or feedback forum? Or fine-tuned per-page access control? + +Any plugin or option for allowing website visitors to edit the discuss page without logging in (without having ikiwiki accounts)? + +Or any plugin to add a feedback form (and maybe threads) to extend a Wiki webpage? + +Or is there per-page access control that can be fine-tuned to lock some users or groups for specific pages? +(The [[pagespec]] does show a way to lock all pages except for Discussion pages, but I want some users to also be able to edit other pages.) + +I want a way for website visitors to be able to give feedback on the wiki pages without having to sign up or log in. +I don't want them to be able to edit the exiting wiki pages except maybe Discussion page. + +(For some reason, it seems like I asked this before ...) + +--JeremyReed + +[[todo/Done]]; there's now a plugin interface for this and several nice +plugins including one allowing [[plugins/opendiscussion]]. More special-purpose +(and less wiki-like plugins) can be added based on this. --[[Joey]] diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 9980cca03..afd699194 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -154,12 +154,6 @@ configuration options of their own. This defaults to trunk; change it if your wiki is at some other location inside the repository. -* --anonok, --noanonok - - If anonok is set, it will allow anonymous web users, who have not signed in, to make changes to the wiki. - - By default, anonymous users cannot edit the wiki. - * --rss, --norss If rss is set, ikiwiki will generate RSS feeds for pages that inline diff --git a/doc/w3mmode/ikiwiki.setup b/doc/w3mmode/ikiwiki.setup index 216e066c8..d71221a8f 100644 --- a/doc/w3mmode/ikiwiki.setup +++ b/doc/w3mmode/ikiwiki.setup @@ -26,7 +26,7 @@ use IkiWiki::Setup::Standard { }, ], - anonok => 1, + add_plugins => [qw{anonok}], rss => 1, atom => 1, discussion => 1, -- cgit v1.2.3