Restricting read and write access to topics and webs, by users and groups
TWikiAccessControl allows you restrict access to single topics and entire webs, by individual user and by user groups, in three main areas: view; edit & attach; and rename/move/delete. These controls, combined with TWikiUserAuthentication, let you easily create and manage an extremely flexible, fine-grained privilege system.
Open, freeform editing is the essence of the WikiCulture - it's what makes TWiki different and often more effective than other collaboration tools. So, it is strongly recommended that decisions to restrict read or write access to a web or a topic are made with care. Experience shows that unrestricted write access works very well because:
As a collaboration guideline:
Access control is based on users and groups. Users are defined by their WikiNames, an then organized in unlimited combinations under different user groups.
A user is created by with the TWikiRegistration form. The process generates a topic in the Main web in the new user's WikiName. The default visitor name is TWikiGuest.
Groups are defined by group topics in the Main
web, like the TWikiAdminGroup. To start a new group:
SomeGroup
Set GROUP = Main.SomeUser, Main.OtherUser, Main.SomeOtherGroup
Set ALLOWTOPICCHANGE = Main.TWikiAdminGroup
You can define who is allowed to make changes to a web or a topic.
Denying editing of a topic also restricts attaching files to it; both privileges are assigned together.
* Set DENYTOPICCHANGE = Main.SomeBadBoy, Main.SomeBadGirl, Main.SomeHackerGroup
* Set ALLOWTOPICCHANGE = Main.SomeGoodGuy, Main.SomeGoodGirl, Main.TWikiAdminGroup
Restricting web-level editing blocks creating new topics, changing topics or attaching files.
The same rules apply as for restricting topics, with these additions:
You can define who is allowed to rename, move or delete a topic, or rename a web.
To allow a user to rename, move or delete a topic, they also need write (editing) permission. They also need write access to change references in referring topics.
* Set DENYTOPICRENAME = Main.SomeBadBoy, Main.SomeBadGirl, Main.SomeHackerGroup
* Set ALLOWTOPICRENAME = Main.SomeGoodGuy, Main.SomeGoodGirl, Main.TWikiAdminGroup
You can define restrictions of who is allowed to rename a ARC TWiki web.
The same rules apply as for topics, with these additions:
You can prevent selected users and groups from accessing certain webs, by hiding them using restricting read access, or by requiring login. There are two basic methods, one simple, using standard preferences variables to hide a web, but offering low security, and a secure log-in approach that is currently a workaround, involving some minor script and filesystem modification.
You can prevent selected users and groups from viewing certain ARC TWiki webs by setting one or both of these variables in each web's WebPreferences topic:
NOSEARCHALL
variable in WebPreferences: view
script is authenticated, which means that all users have to login, even for read-only access. (An open guest account, like TWikiGuest, can get around this, allowing anyone to login with, for example, view-only access for public webs.) TWikiInstallationGuide has more on Basic Authentication, using the .htaccess
file.
To selectively restrict web access with the security of Basic Authentication, there is a reliable workaround that involves some straightforward code modification:
view
script (rename) and create a view
subdirectory in its place.
view
subdirectory, create a separate copy of a modified viewing script for each web, and create .htaccess
settings for the restricted webs.
Example of viewing scriptredirect
#!/usr/bin/perl -w # chdir '..'; # Adjust SCRIPT and PATH_INFO variables to account for the changed directory my $web = $ENV{SCRIPT_NAME}; $web =~ s#^.*/view(/[^/]*).*$#$1#; # isolate the path element after "view" $ENV{PATH_TRANSLATED} =~ s#(/[^/]*)$#$web$1#; $ENV{PATH_INFO} =~ s#(/[^/]*)$#$web$1#; $ENV{SCRIPT_NAME} =~ s#/view$web#/view#; $ENV{SCRIPT_FILENAME} =~ s#/view$web#/view#; # open (LOG, '>>/tmp/redirect.log'); # print LOG join ("\n", scalar localtime (time ()), %ENV); # close LOG; exec ('/usr/bin/perl', '-wT', 'view.orig') or print <<EOF; Content-type: text/plain Error executing /cgi-bin/view.orig: $? Click the BACK button in your browser and contact webmaster\@bcs-oops.org. EOF
A SECOND OPTION: A less reliable workaround that also requires code changes is available to provide the same unrestricted viewing access, with authentication required only on selected webs:
view
script from the .htaccess
file.
$doRememberRemoteUser
flag in lib/TWiki.cfg
as described in TWikiUserAuthentication. ARC TWiki will now remember the IP address of an authenticated user. 1. Copy the view
script to viewauth
(or better, create a symbolic link) 1. Add viewauth
to the list of authenticated scripts in the .htaccess file. view
script to the viewauth
script once (this happens only if the user has never edited a topic). Doing so will ask for authentication. The viewauth
script shows the requested topic if the user could log on and if the user is authorized to see that web.
NOSEARCHALL
variable in its WebPreferences, like:
<!--
Set DENYTOPICCHANGE = Main.SomeGroup
-->
By mistyping a user or group name in the ALLOWTOPICCHANGE setting, it's possible to lock a topic so that it no-one can edit it from a browser. To avoid this:
$superAdminGroup
variable in lib/TWiki.cfg
to the name of a group of users that are always allowed to edit/view topics.
$superAdminGroup = "TWikiAdminGroup";
-- MikeMannix - 20 Mar 2002