Hello,
I have a private Wiki, in which access to any page requires authentication. I did that by using this configuration (as suggested in http://www.mediawiki.org/wiki/Manual:Preventing_access):
$wgGroupPermissions['*']['read'] = false; $wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['*']['createaccount'] = false;
I was annoyed by the fact that every time I accessed while not logged in I would get a "You must log in to view other pages" message, and then I would have to click on "log in" to go to the log in dialog, and then after the log in I would get a "You are now logged in" message and with a link to the page I originally wanted to see, and then I would have to click on this link again.
So I decided to patch MediaWiki to transform those into redirects instead of pages with messages. While doing it, I decided to do it in a generic and configurable fashion so that, if you agree that this might be useful to others, you may incorporate it on the main code.
This are the variables that I added to DefaultSettings.php:
/** * Set the $wgRedirectMustLogin flag to skip the "You must log in to * view other pages." notice when you do not have enough rights to view * the page. Set the $wgRedirectLoggedIn flag to skip the "You are now * logged in to ..." notice after you log in successfully. * These are convenient in a private Wiki, if you also set * $wgGroupPermissions['*']['read'], ['edit'] and * ['createaccount'] to false. */ $wgRedirectMustLogin = false; $wgRedirectLoggedIn = false;
If you set the first of them to true on your LocalSettings.php, it will skip the first page. If you set the second one of them to true, it will skip the page that comes after a successful login, and it will jump to the page you originally requested when you got the login dialog.
I am sending the patch attached with this e-mail. I created the patch with a "svn diff" on the trunk of phase3. I tested it against MediaWiki 1.13, it applies cleanly and it works.
I hope you find it useful and incorporate it to MediaWiki!
Thanks, Filipe
On Thu, Sep 4, 2008 at 7:01 PM, lists.filbranden@idilia.com wrote:
This are the variables that I added to DefaultSettings.php:
/**
- Set the $wgRedirectMustLogin flag to skip the "You must log in to
- view other pages." notice when you do not have enough rights to view
- the page. Set the $wgRedirectLoggedIn flag to skip the "You are now
- logged in to ..." notice after you log in successfully.
- These are convenient in a private Wiki, if you also set
- $wgGroupPermissions['*']['read'], ['edit'] and
- ['createaccount'] to false.
*/ $wgRedirectMustLogin = false; $wgRedirectLoggedIn = false;
Unless anyone can come up with a use case where these would be handy, I'd say they should both be removed, and the features always enabled.
I am sending the patch attached with this e-mail. I created the patch with a "svn diff" on the trunk of phase3. I tested it against MediaWiki 1.13, it applies cleanly and it works.
As Thomas Dalton says, this list doesn't accept attachments. Please post the patch to some relevant bug on Bugzilla, such as https://bugzilla.wikimedia.org/show_bug.cgi?id=10868, and post here saying which bug you've put the patch on. I'd be willing to review, and commit if appropriate.
Hi,
Please post the patch to some relevant bug on Bugzilla [...] and post here saying which bug you've put the patch on.
Done! https://bugzilla.wikimedia.org/show_bug.cgi?id=15484
$wgRedirectMustLogin = false; $wgRedirectLoggedIn = false;
Unless anyone can come up with a use case where these would be handy, I'd say they should both be removed, and the features always enabled.
Actually, those are mostly useful for Wikis that are completely private. For public Wikis the need to log in to do something is more uncommon, and I believe in those cases the page saying you have to log in is kind of useful... I think I would rather keep the default setting of keeping the pages and giving the admin the option to change the behaviour.
What I think would actually be useful would be mentioning this on this page: http://www.mediawiki.org/wiki/Manual:Preventing_access
This page instructs on how to configure a private Wiki, and these login redirects are particularly useful in those cases. I think we could add a "1.14 upwards" session under "Simple private wiki" with that information, including setting those variables.
Thanks a lot! Filipe
wikitech-l@lists.wikimedia.org