aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-02-11 20:13:30 -0500
committerJoey Hess <joey@gnu.kitenet.net>2010-02-11 20:13:30 -0500
commit7af18f2a1ec8b5ce4764813b0464112f517e806f (patch)
treecbb37ccbea33ee3321365d78e0446d986055947b /IkiWiki
parent6f1d6236185148930a2c7694c9ae59877997d0d4 (diff)
downloadikiwiki-7af18f2a1ec8b5ce4764813b0464112f517e806f.tar
ikiwiki-7af18f2a1ec8b5ce4764813b0464112f517e806f.tar.gz
reorder canedit checks during page creation to have best_loc first
When creating a page, multiple locations are tested to see if they can be edited. If all fail, one of the failure subs is called, to log the user in to allow them to proceed with the edit. So far so good. But, what if some pages fail for one reason, and some for another? This occurs when httpauth_pagespec is used in conjunction with signinedit (and openid or something). When the user is not signed in at all The former will fail to edit a page because the user was not httpauthed. The latter will fail to edit a different page, because the user was not signed in. One of their failure methods gets to run first. The page creation code always ran the failure method corresponding to the topmost page location. So, when editing a foo/Discussion page, and with httpauth_pagespec => "*!/Discussion", it ran the httpauth failure method, which was exactly the wrong thing to do. I fixed this by making it instead run the failure method for the *best* page location. In the above example, that's foo/Discussion, so signinedit runs, as desired, and we get the signin page. This seems like it will be the right choice, or at least an acceptable choice. If a user wants to use httpauth they can always choose it on the signin page.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/editpage.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm
index 219386a30..9211cca89 100644
--- a/IkiWiki/Plugin/editpage.pm
+++ b/IkiWiki/Plugin/editpage.pm
@@ -272,8 +272,10 @@ sub cgi_editpage ($$) {
check_canedit($_, $q, $session, 1)
} @page_locs;
if (! @editable_locs) {
- # let it throw an error this time
- map { check_canedit($_, $q, $session) } @page_locs;
+ # now let it throw an error, or prompt for
+ # login
+ map { check_canedit($_, $q, $session) }
+ ($best_loc, @page_locs);
}
my @page_types;