access_control3Add my vote for this tag create new tag
, view all tags
Get Involved!
TWiki is an open source project with 10+ years of history, built by a team of volunteers from around the world, and used by millions of people in over 100 countries. The community is focusing on building the best collaboration platform for the workplace. We invite you to get involved!

ALERT! NOTE: This is a DistributionDocument. Please help maintain high quality documentation: This is a wiki, please fix the documentation if you find errors or incomplete content. Put questions and suggestions concerning the documentation of this topic in the comments section below. Use the Support web for problems you are having using TWiki.

TWiki Access Control

Restricting read and write access to topics and webs, by Users and groups

TWiki Access Control allows you restrict access to single topics and entire webs, by individual user and by user Groups. Access control, combined with TWikiUserAuthentication, lets you easily create and manage an extremely flexible, fine-grained privilege system.

TIP Tip: TWiki:TWiki.TWikiAccessControlSupplement on TWiki.org has additional documentation on access control.

An Important Control Consideration

Your organization will learn that, while fostering an open collaborative environment, soft security (peer review), together with version control (complete audit trail) will take care of any security concern you might have.

Open, free-form editing is the essence of WikiCulture - what makes TWiki different and often more effective than other collaborative environments. For that reason, it is strongly recommended that decisions to restrict read or write access to a web or a topic are made with great care - the more restrictions, the less wiki in the mix. Experience shows that unrestricted write access works very well because:

  • Peer influence is enough to ensure that only relevant content is posted.
  • Peer editing - the ability for anyone to rearrange all content on a page - keeps topics focused.
  • In TWiki, content is transparently preserved under revision control:
    • Edits can easily be rolled back to a previous revision if needed.
    • Users are encouraged to edit and refactor (condense a long topic), since there's a safety net.

As a collaboration guideline:

  • Create broad-based Groups (for more and varied input), and...
  • Avoid creating view-only topics (if you can read it, you should be able to contribute to it).

Permissions settings of the webs on this TWiki site

Preferences Home Main on        
Preferences Home TWiki06x00 on       TWikiAdminGroup
Preferences Home Blog on     TWikiGuest  
Preferences Home Codev on     TWikiGuest  
Preferences Home Plugins on        
Preferences Home Sandbox on        
Preferences Home Support on        
Preferences Home TWiki on        
Preferences Home TWiki01 on       TWikiAdminGroup
Preferences Home TWiki02 on       TWikiAdminGroup
Preferences Home TWiki03 on       TWikiAdminGroup
Preferences Home TWiki04 on       TWikiAdminGroup, CrawfordCurrie
Preferences Home TWiki04x01 on       TWikiAdminGroup
Preferences Home TWiki04x02 on       TWikiAdminGroup
Preferences Home TWiki04x03 on       TWikiAdminGroup
Preferences Home TWiki05x00 on       TWikiAdminGroup
Preferences Home TWiki05x01 on       TWikiAdminGroup
Preferences Home WikiWed on        

See TWikiAccessControl for details

Please Note:

  • A blank in the the above table may mean either the corresponding control is absent or commented out or that it has been set to a null value. The two conditions have dramatically different and possibly opposed semantics.
  • TWikiGuest is the guest account - used by unauthenticated users.
  • The TWiki web must not deny view to TWikiGuest; otherwise, people will not be able to register.

Note: Above table comes from SitePermissions

Authentication vs. Access Control

Authentication: Identifies who a user is based on a login procedure. See TWikiUserAuthentication.

Access control: Restrict access to content based on users and groups once a user is identified.

Users and Groups

Access control is based on the familiar concept of Users and Groups. Users are defined by their WikiNames. They can then be organized in unlimited combinations by inclusion in one or more user Groups. For convenience, Groups can also be included in other Groups.

Managing Users

A user can create an account in TWikiRegistration. The following actions are performed:

  • WikiName and encrypted password are recorded using the password manager if authentication is enabled.
  • A confirmation e-mail is sent to the user.
  • A user profile page with the WikiName of the user is created in the Main web.
  • The user is added to the TWikiUsers topic.

The default visitor name is TWikiGuest. This is the non-authenticated user.

Managing Groups

The following describes the standard TWiki support for groups. Your local TWiki may have an alternate group mapping manager installed. Check with your TWiki administrator if you are in doubt.

Groups are defined by group topics located in the Main web. To create a new group, visit TWikiGroups and enter the name of the new group ending in Group into the "new group" form field. This will create a new group topic with two important settings:

  • Set GROUP = < list of Users and/or Groups >
  • Set ALLOWTOPICCHANGE = < list of Users and/or Groups >

The GROUP setting is a comma-separated list of users and/or other groups. Example:

  • Set GROUP = SomeUser, OtherUser, SomeGroup

The ALLOWTOPICCHANGE setting defines who is allowed to change the group topic; it is a comma delimited list of users and groups. You typically want to restrict that to the members of the group itself, so it should contain the name of the topic. This prevents users not in the group from editing the topic to give themselves or others access. For example, for the MarketingGroup topic write:

  • Set ALLOWTOPICCHANGE = MarketingGroup

ALERT! Note: TWiki has strict formatting rules. Make sure you have a real bullet. (In raw edit it is three or six spaces, an asterisk, and an extra space in front of any access control rule.)

The Super Admin Group

A number of TWiki functions (for example, renaming webs) are only available to administrators. Administrators are simply users who belong to the SuperAdminGroup. This is a standard user group, the name of which is defined by {SuperAdminGroup} setting in configure. The default name of this group is the TWikiAdminGroup. The system administrator may have chosen a different name for this group if your local TWiki uses an alternate group mapping manager but for simplicity we will use the default name TWikiAdminGroup in the rest of this topic.

You can create new administrators simply by adding them to the TWikiAdminGroup topic. For example,

  • Set GROUP = RobertCailliau, TimBernersLee
A member of the Super Admin Group has unrestricted access throughout the TWiki, so only trusted staff should be added to this group.

Restricting Access

You can define who is allowed to read or write to a web or a topic. Note that some plugins may not respect access permissions.

  • Restricting VIEW blocks viewing and searching of content. When you restric VIEW to a topic or web, this also restricts INCLUDE and Formatted SEARCH from showing the content of the topics.
  • Restricting CHANGE blocks creating new topics, changing topics or attaching files.
  • Restricting RENAME prevents renaming of topics within a web.

Note that there is an important distinction between CHANGE access and RENAME access. A user can CHANGE a topic, but thanks to version control their changes cannot be lost (the history of the topic before the change is recorded). However if a topic or web is renamed, that history may be lost. Typically a site will only give RENAME access to administrators and content owners.

Controlling access to a Web

You can define restrictions on who is allowed to view a TWiki web. You can restrict access to certain webs to selected Users and Groups, by:

  • authenticating all webs and restricting selected webs: Topic access in all webs is authenticated, and selected webs have restricted access.
  • authenticating and restricting selected webs only: Provide unrestricted viewing access to open webs, with authentication and restriction only on selected webs.

  • You can define these settings in the WebPreferences topic, preferable towards the end of the topic:
    • Set DENYWEBVIEW = < comma-delimited list of Users and Groups >
    • Set ALLOWWEBVIEW = < comma-delimited list of Users and Groups >
    • Set DENYWEBCHANGE = < comma-delimited list of Users and Groups >
    • Set ALLOWWEBCHANGE = < comma-delimited list of Users and Groups >
    • Set DENYWEBRENAME = < comma-delimited list of Users and Groups >
    • Set ALLOWWEBRENAME = < comma-delimited list of Users and Groups >

For example, set this to restrict a web to be viewable only by the MarketingGroup:

  • Set ALLOWWEBVIEW = Main.MarketingGroup

If your site allows hierarchical webs, then access to sub-webs is determined from the access controls of the parent web, plus the access controls in the sub-web. So, if the parent web has ALLOWWEBVIEW set, this will also apply to the subweb. Also note that you will need to ensure that the parent web's FINALPREFERENCES does not include the access control settings listed above. Otherwise you will not be able override the parent web's access control settings in sub-webs.

Creation and renaming of sub-webs is controlled by the WEBCHANGE setting on the parent web (or ROOTCHANGE for root webs). Renaming is additionally restricted by the setting of WEBRENAME in the web itself.

Note: If you restrict access to the Main, make sure to add the TWikiRegistrationAgent so that users can register. Example:

  • Set ALLOWWEBCHANGE = TWikiAdminGroup, TWikiRegistrationAgent

Note: For Web level access rights Setting any of these settings to an empty value has the same effect as not setting them at all. Please note that the documentation of TWiki 4.0 and earlier versions of TWiki 4.1 did not reflect the actual implementation, e.g. an empty ALLOWWEBVIEW does not prevent anyone from viewing the web, and an an empty DENYWEBVIEW does not allow all to view the web.

Controlling access to a Topic

  • You can define these settings in any topic, preferable towards the end of the topic:
    • Set DENYTOPICVIEW = < comma-delimited list of Users and Groups >
    • Set ALLOWTOPICVIEW = < comma-delimited list of Users and Groups >
    • Set DENYTOPICCHANGE = < comma-delimited list of Users and Groups >
    • Set ALLOWTOPICCHANGE = < comma-delimited list of Users and Groups >
    • Set DENYTOPICRENAME = < comma-delimited list of Users and Groups >
    • Set ALLOWTOPICRENAME = < comma-delimited list of Users and Groups >

For example, set this to restrict a topic to be viewable only by the MarketingExecGroup:

  • Set ALLOWTOPICVIEW = Main.MarketingExecGroup

See "How TWiki evaluates ALLOW/DENY settings" below for more on how ALLOW and DENY interacts.

ALERT! If the same setting is defined multiple times the last one overrides the previous. They are not OR'ed together.

Allowing public access to specific topics in a restricted web

You may want to completely open up access to a specific topic within a restricted web - allowing access by anybody. There is a special group for that - Main.AllUsersGroup. The following setting allows view access to the topic by anybody even if they are not authenticated.

  • Set ALLOWTOPICVIEW = Main.AllUsersGroup

Alternatively, you can grant access only to authenticated users by Main.AllAuthUsersGroup. If an unauthenticated user accesses a topic having the following setting, they are asked to authenticate themself.

  • Set ALLOWTOPICVIEW = Main.AllAuthUsersGroup

Remember when opening up access to specific topics within a restricted web that other topics in the web - for example, the WebLeftBar - may also be accessed when viewing the topics. The message you get when you are denied access should tell you what topic you were not permitted to access.

As mentioned in the following section, meaning of an empty value set to DENYTOPICVIEW, DENYTOPICCHANGE, and DENYTOPICRENAME has been changed in TWiki 6.0. To keep those TWiki topics having empty DENYTOPICOPERAION accessible by everybody, those need to be replaced with

  • Set ALLOWTOPICOPERATION = Main.AllUsersGroup

For that, tools/eliminate_emptydenytopic is provided. After upgrading from pre 6.0 to post 6.0, you need to run it.

Empty values in access control variables

Setting an empty value to an access control variable is the same as not setting at all:


ALERT! Since TWiki 4.0 and prior to TWiki 6.0 setting DENYTOPICVIEW, DENYTOPICCHANGE, or DENYTOPICRENAME to an empty value meant "do not deny anyone regardless of the corresponding ALLOWTOPICX", which is no longer the case. Back then, setting an empty value to DENYTOPICX was the only way to open up a topic to everybody in a restricted web. Now that we have AllUsersGroup and AllAuthUsersGroup, there is no need for that behaviour, which caused a lot of confusion and debate.

Securing File Attachments

By default, TWiki does not secure file attachments. Without making the following changes to the twiki.conf file, it is possible for anyone who has access to the server to gain access to an attachment if they know the attachment's fully qualified path, even though access to the topic associated with the attachment is secured. This is because attachments are referred to directly by Apache, and are not by default delivered via TWiki scripts. This means that the above instructions for controlling to topics do not apply to attachments unless you make the changes as described below.

An effective way to secure attachments is to apply the same access control settings to attachments as those applied to topics. This security enhancement can be accomplished by instructing the webserver to redirect accesses to attachments via the TWiki viewfile script, which honors the TWiki access controls settings to topics. See the notes below for implications.

The preferred method to secure attachments is by editing the twiki.conf file to include:

    ScriptAlias /do          /filesystem/path/to/twiki/bin
    Alias       /pub/TWiki   /filesystem/path/to/twiki/pub/TWiki
    Alias       /pub/Sandbox /filesystem/path/to/twiki/pub/Sandbox
    ScriptAlias /pub         /filesystem/path/to/twiki/bin/viewfile


  • It is recommended to use TWiki:TWiki/ApacheConfigGenerator to generate the Apache config file for your TWiki.
  • You will need to restart your Apache server after this change.
  • Images embedded in topics will load slower since attached images will also be delivered by the viewfile script. The TWiki web and Sandbox web are excluded for performance reasons.
  • The viewfile script sets the mime type based upon file name suffix. Unknown types are served as text/plain which can result in corrupt files.

Controlling who can manage top-level webs

Top level webs are a special case, because they don't have a parent web with a WebPreferences. So there has to be a special control just for the root level.

  • You can define these settings in the Main.TWikiPreferences topic, preferable towards the end of the topic:
    • Set DENYROOTCHANGE = < comma-delimited list of Users and Groups >
    • Set ALLOWROOTCHANGE = < comma-delimited list of Users and Groups >
Note that you do not require ROOTCHANGE access to rename an existing top-level web. You just need WEBCHANGE in the web itself.

How TWiki evaluates ALLOW/DENY settings

When deciding whether to grant access, TWiki evaluates the following rules in order (read from the top of the list; if the logic arrives at PERMITTED or DENIED that applies immediately and no more rules are applied). You need to read the rules bearing in mind that VIEW, CHANGE and RENAME access may be granted/denied separately.

  1. If the user is an administrator
    • access is PERMITTED.
  2. If DENYTOPIC is set to a list of wikinames
    • people in the list will be DENIED.
  3. If DENYTOPIC is set to empty ( i.e. Set DENYTOPIC = )
    • the access control setting is ignored.
      ALERT! Attention: The spec changed in TWiki-6.0; access was permitted in earlier TWiki releases.
  4. If ALLOWTOPIC is set
    1. people in the list are PERMITTED
    2. everyone else is DENIED
  5. If DENYWEB is set to a list of wikinames
    • people in the list are DENIED access
  6. If ALLOWWEB is set to a list of wikinames
    • people in the list will be PERMITTED
    • everyone else will be DENIED
  7. If you got this far, access is PERMITTED

Allowing web creation by user mapping manager

There are cases where DENYROOTCHANGE, ALLOWROOTCHANGE, DENYWEBCHANGE, and ALLOWWEBCHANGE, and DENYWEBCHANGE are not capable enough to implement web creation permission you want. To cope with such cases, when a new web is created, the canCreateWeb($cUID, $web) method of the user mapping manager is called if the method exists. If it returns true, TWiki goes ahead and create the web without checking access control variables. Please read AllowWebCreateByUserMappingManager for more details.

Forbid certain users to do certain actions by configuration

You may have an unruly registered users (e.g. a crawler program) who don't follow the rules while you don't have control over such users. And the web application container in which TWiki is installed may be managed by somebody else and you don't have tight and quick control.

To cope with such situations, certain users can be forbidden certain scripts by configuration. You can set a comma separated list of scripts to $TWiki::cfg{ForbidUserAction}{CanonicalUserName}%. If the list is preceded by !, only the listed scripts are permitted for the user.


$TWiki::cfg{ForbidUserAction} = {
    AggresiveCrawler => 'edit, oops, search',
    ReadOnlyUser     => '!view, viewfile',
    TotallyForbidden => '!nothing',
  • AggresiveCrawler is forbidden edit, oops, and search scripts.
  • ReadOnlyUser is permitted view and viewfile but forbidden the others.
  • TotallyForbidden is forbidden all actions.
    It's not straightforward but there is no script named nothing, which means all scripts don't match "nothing", hence all scripts are forbidden.

User masquerading

There are cases where it's handy to access TWiki on behalf of somebody else retaining a trace of your real identity rather than completely becoming a different user. We call it user masquerading. TWiki provides a framework to implement that. Please read UserMasquerading for more information.

This is an advanced feature and not many TWiki sites are using, but there is a part in the following section mentioning it, it's mentioned here.

Dynamic access control

There are pitfalls and you need to harden your web to avoid unexpected access. Before using this feature, please read this entire section through carefully.

You may want to restrict access dynamically -- based on topic name, a form field value, or some combination of factors. To cope with such situations, the dynamic access control mechanism is provided. If you set DYNAMIC_ACCESS_CONTROL 'on' at WebPreferences of the web, TWiki variables in access control variables mentioned above are expanded.

Example 1 - restriction based on topic name

Let's assume you need to restrict changes only to the CroniesGroup members except with topics whose name ends with Public, which need be changed by anybody. That is achieve by the following settings on WebPrefences.

   * Set ALLOWWEBCHANGE = %IF{"'%CALCULATE{$SUBSTRING(%TOPIC%, -6, 6)}%' = 'Public'" then="%WIKINAME%" else="CroniesGroup"}%

Example 2 - restriction based on form field

Let's assume:

  • a web storing requests on topics whose name starts with ReqEnt
  • Each request topic has a form field "Requestor", which has the wiki name of the requestor
  • Users can view only requests they created
  • The members of the SupportGroup mail group can view all requests
That is achieve by the following settings on WebPreferences.

   * Set ALLOWWEBVIEW = %IF{"'%CALCULATE{$SUBSTRING(%TOPIC%, 1, 6)}%' = 'ReqEnt' and '%FORMFIELD{Requestor}%' != '%WIKINAME%'" then="SupportGroup" else="%WIKINAME%"}%

Specifically the following access control variables are subject to TWiki variable expansion in their values.

DENYROOT* and ALLOWROOT* are not subject to variable expansion. Because there has been no good use cases presented.

Dynamic access control in accessing a different web's topic

Let's assume WebA has the following lines on WebPreferences.

   * Set MEMBERS = JaneSmith, JoeSchmoe
This is not a good way to use dynamic access control but it does restrict access only to those listed in MEMBERS. However, access control doesn't work as expected when WebA.TopicB is accessed from WebC.TopicD by %INCLUDE{WebA.TopicB}% or other variables. This is because %MEMBERS% is defined in WebA and may have a different value in other webs.

You may think the following lines cheat the access control on WebA but actually not.

This is because when a topic (e.g. WebC.TopicD) is accessed from browser and the topic refers to another topic in a different web (e.g. WebA.TopicB) and the different web employs dynamic access control, access to another topic is defined being on the safer side.

Topic level dynamic access control

On a topic, it's possible to use a variable defined on the topic for topic level access restriction. E.g.

   * Set MEMBERS = JaneSmith, JoeSchmoe
[This is not a good way to use dynamic access control

Dynamic access control and user masquerading

Your user mapping handler may be providing the UserMasquerading feature. In that case, you expect dynamic access control to just work when user masquerading is in effect. Otherwise, you cannot test if your dynamic access control configuration is working as expected on your own.

Dynamic access control does work as expected even if user masquerading is in effect. For that, the following things are happening under the hood.

Let's think about Example 2 mentioned above. When you masquerading as SomebodyElse, you need to be able to see SomebodyElse's requests only. In the access control setting, a form field value is compared with %WIKINAME%. While user masquerading is in effect, your wiki name is YourNameOnBehalfOfSomebodyElse. It cannot match the form field value.

To make dynamic access control work under these circumstances, variable expansion for dynamic access control is skewed as follows. Specifically, the following variables are expanded to the value of SomeboyElse's rather than YourNameOnBehalfOfSomebodyElse's.


Avoiding vulnerability

By default, user level preferences are read before web level preferences. This means a user can set a preferences variable at the user level and finalise it. To prevent this sort of attack, you need to harden your web or site by disabling user preferences by e.g. having the following line on lib/LocalSite.cfg

$TWiki::cfg{DemoteUserPreferences}= 1;
and having the following line on your WebPreferences and then finalise DENYUSERPREFEENCES.
Please read TWikiVariables#ControllingUserLevelPrefsOverride for details.

Again by default, predefined variables such as %IF{...}% can be overridden by preferences variables. If user preferences are disabled, ordinary users cannot attack using user preferences, but topic level preferences may cause unexpected consequences. As such, all predefined variables need to be made un-overridable by having the following line on WebPreferences and then finalise OVERRIDABLEPREDEFINEDVARIABLES.

Please read TWikiVariables#PredefinedVariables for details.

Disabling dynamic access control

You may not be comfortable with dynamic access control because it may slow things down. Or you may not want to be bothered by questions raised by users about it. If so, you can disable it by setting DYNAMIC_ACCESS_CONTROL 'off' and then finalizing at the local site level. (cf. TWikiVariables#Setting_Preferences_Variables)

Access control and INCLUDE

ALLOWTOPICVIEW and ALLOWTOPICCHANGE only applies to the topic in which the settings are defined. If a topic A includes another topic B, topic A does not inherit the access rights of the included topic B.

Examples: Topic A includes topic B

  • If the included topic B has ALLOWTOPICCHANGE set to block editing for a user, it does not prevent editing the including topic A.
  • If the included topic B has ALLOWTOPICVIEW set to block view for a user, the user can still view topic A but he cannot see the included topic B. He will see a message No permission to view B

Customizing "access denied" message

When access is denied, a page as follows is displayed:


You may want to customize the passage annotated in the red rectangle. For example, with a web restricting access, you may want to show the link to an access request form.

You can achieve that by setting TOPIC_ACCESS_CONTACT varialbe on WebPreferences. e.g.

   * Set TOPIC_ACCESS_CONTACT = If you need to access this site, please apply [[Main.AccessForm][here]]
Please note that setting it on a topic other than WebPreferences does not take effect. This is a limitation of the current implementation.

Custom user/group notations

You can have custom user/group notations such as USER:userid and LDAPGROUP:group-name and use them for access control. For example:

In a large organization, TWiki may need to depend on user and group data provided by its infrastructure. Custom user/group notations are handy in such situations though it's not trivial to implement. Please read here for details.

Access Control quick recipes

Restrict Access to Whole TWiki Site

In a firewalled TWiki, e.g. an intranet wiki or extranet wiki, you want to allow only invited people to access your TWiki. There are three options:

1. Install TWiki Behind Firewall:

The firewall takes care of giving access to TWiki to authorized people only. This is a typical setup for a company wiki. As for TWiki configuration, no special setup is needed.

2. Extranet TWiki Using Template Login:

All TWiki content (pages and attachments) need to be access controlled. The Template Login allows users to login and logout. Only logged in users can access TWiki content.

Configuration: Follow the default setup, then change these configure settings:

  • Secure attachments as documented. The TWiki:TWiki.ApacheConfigGenerator is useful to get the setting right.
  • Require authentication for all TWiki scripts except backuprestore, configure, login, logon and resetpasswd with the following configure setting:
    $TWiki::cfg{AuthScripts} = 'attach, changes, edit, manage, oops, preview, rdiff, rdiffauth, register, rename, rest, save, search, twiki_cgi, upload, statistics, view, viewauth, viewfile';
  • When you install additional plugins make sure to add scripts they might introduce also to twiki/bin also to the {AuthScripts} configure setting.
    Attention: Some scripts of additional plugins might not be aware of TWiki's template login. Test all new scripts with a non-authenticated user!

3. Extranet TWiki Using Apache Login:

All TWiki content (pages and attachments) need to be access controlled. The Apache Login does not offer a logout; typically the browser needs to be restarted to logout. Only logged in users can access TWiki content.

Configuration: Enable user authentication with ApacheLogin and lock down access to the whole twiki/bin and twiki/pub directories to all but valid users. In the Apache config file for TWiki (twiki.conf or .htaccess), replace the <FilesMatch "(attach|edit|... section with this:

<FilesMatch ".*">
       require valid-user


  • In all three options, content can be restricted selectively with ALLOWWEBVIEW and other access control settings documented above. See also the next quick recipe.
  • In the extranet setup, someone with access to the site needs to register new users. If you still want public users to be able to register automatically follow TWiki:TWiki.RegisterOnViewRestrictedSite.

Authenticate and Restrict Selected Webs Only

Use the following setup to provide unrestricted viewing access to open webs, with authentication only on selected webs. Requires TWikiUserAuthentication to be enabled.

  1. Restrict view access to selected Users and Groups. Set one or both of these variables in its WebPreferences topic:
    • Set DENYWEBVIEW = < list of Users and Groups >
    • Set ALLOWWEBVIEW = < list of Users and Groups >
    • Note: DENYWEBVIEW is evaluated before ALLOWWEBVIEW. Access is denied if the authenticated person is in the DENYWEBVIEW list, or not in the ALLOWWEBVIEW list. Access is granted if DENYWEBVIEW and ALLOWWEBVIEW are not defined.

Hide Control Settings

TIP Tip: To hide access control settings from normal browser viewing, you can put them into the topic preference settings by clicking the link Edit topic preference settings under More topic actions menu. Preferences set in this manner are not visible in the topic text, but take effect nevertheless. Access control settings added as topic preference settings are stored in the topic meta data and they override settings defined in the topic text.

Alternatively, place them in HTML comment markers, but this exposes the access setting during ordinary editing.

   * Set DENYTOPICCHANGE = Main.SomeGroup

Obfuscating Webs

Another way of hiding webs is to keep them hidden by not publishing the URL and by preventing the all webs search option from accessing obfuscated webs. Do so by enabling the NOSEARCHALL variable in WebPreferences:

  • Set NOSEARCHALL = on

This setup can be useful to hide a new web until content its ready for deployment, or to hide view access restricted webs.

ALERT! Note: Obfuscating a web without view access control is very insecure, as anyone who knows the URL can access the web.

Read-only Skin Mode

It is possible to turn the PatternSkin and TopMenuSkin into read-only mode by removing the edit and attach controls (links and buttons). This is mainly useful if you have TWiki application pages or dashboards where you do not want regular users to change content. The read-only skin mode is not a replacement for access control; you can use it in addition to access control. Details at PatternSkinCustomization#ReadOnlySkinMode.

Configuring access control for topics of a certain name in all webs

You may need to restrict access to topics of a certain name in all webs. For example, there might be an add-on refering to a certain topic of all webs. And the add-on does things only administrators are supposed to do. In that case, change to the topic needs to be restricted only to administrators and must not be overridable.

Let's say there is AutomationAddOn which refers to WebAutomation of all webs. And WebAutomation needs to be modifable only by administrators. That can be achieved by the following configuration.

$TWiki::cfg{Access}{Topic}{WebAutomation} = {
    DENYCHANGE => 'Main.AllUsersGroup',


$TWiki::cfg{Access}{Topic}{SpecialTopic} = {
    DENYVIEW  => 'JoeSchmoe',
    ALLOWVIEW => 'FooGroup',

$TWiki::cfg{Access}{Topic}{TOPICNAME} has precedence over DENYTOPIC* and ALLOWTOPIC*. For example, if the configuration for WebAutomation is there as above, there is no way to allow non-adminsitrators to change the WebAutomation topic of any web.

As a way to configure access control, this may look crude. The reason why configured this way is that this can be part of plugin/add-on/contrib's configuration. For example, Config.spec of AutomationAddOn would have the following lines, with which proper access control to WebAutomation topics is implemented without the administrator knowing it.

$TWiki::cfg{Access}{Topic}{WebAutomation} = {
    DENYCHANGE => 'Main.AllUsersGroup',

Related Topics: AdminDocumentationCategory, TWikiUserAuthentication, AllowWebCreateByUserMappingManager, UserMasquerading, CustomUserGroupNotations, TWiki:TWiki.TWikiAccessControlSupplement

-- Contributors: TWiki:Main.PeterThoeny, TWiki:Main.MikeMannix, TWiki:Main.CrawfordCurrie

Comments & Questions about this Distribution Document Topic

Regarding the last warning (Authenticating webs is not very secure), it would be useful to know the why behind this statement. Without the why, it's hard to make an informed decision whether to authenticate webs. Thanks.

-- MartyBacke - 30 May 2002

  • I agree with this. I'm assuming that using apache+ssl+htaccess+viewauth should be secure. What is meant by saying "a way to circumvent the read access restriction"? -- DougAlcorn - 03 Jul 2002
In the section on adding viewauth to the htaccess file, can we get an example of the htaccess file so configured? I find it a bit confusing.

-- RalphBroom - 31 May 2002

  • There is a sample .htaccess.txt file that comes with the 01 Dec 2001 release of TWiki. All you need to do is s/view/viewauth/ as far as I can see. -- DougAlcorn 03 Jul 2002

  • In "Authenticate and Restricting Selected Webs Only" section of this topic, 5) means you have to add three lines in .htaccess :
<Files "viewauth">
       require valid-user
  • The "not very secure" stuff is simple (from my experience) : when a user views a restricted Web, the server keeps his IP address and associates it with his WikiName in remoteusers.txt file. After that if someone can take the same IP address, he can view (but not edit) the restricted Web without authentication. If the first user use a proxy, everyone using the same proxy will be able to see the restricted Web.
-- PhilippeBricout - 04 Jul 2002

I experimented with using cron to delete the remoteusers.txt every so often. While it worked, it was not ideal. Then I went back and turned off the IP logging in TWiki.cfg. This gave the results I wanted, although I can't explain why (and in fact I think it maybe should not have worked). It seems that now viewauth authentication is simply working on a per-session basis (yet, I am not using the 'session' plugin). Your results could vary. -- BobNewell - 30 Nov 2002

-- DanielWeiss - 08 Oct 2002

I have problems with the TWikiUser Authentication. I want that only my registered users can edit/view in the twiki and that they have to authenticate like here with username/password. How does that work?

BobNewell - 30 Oct 2002

See /bin/.htaccess.txt file in your distro how authorisation works - like require valid-user for viewauth above.

(I also fixed signature for BobNewell)

-- PeterMasiar - 01 Dec 2002

The documentation never explicitly mention that read access restrictions do not protect attachments, even if their topics are restricted and secured. See AttachmentsUnprotectedByReadAccessRestriction for more info. This is a pretty serious security flaw ( or a pretty serious misconfiguration on my behalf if I missed something here smile ).

-- StefanLindmark - 16 Dec 2002

In the setup instructions above, "*Copy* the view script to viewauth (or better, create a symbolic link)", using a symbolic link would require a slight change to httpd.conf configuration instructions for the /twiki/bin directory, i.e., +FollowSymLinks.

-- AnthonPang - 31 Dec 2002

Hi Anthon. Version control exists for a reason. If you know exactly what needs changing, can you simply update whatever needs updating? If there's something that's wrong that needs to be updated for the release, now is indeed the time! Thanks.

-- GrantBow - 17 Jan 2003

The various options for authenticating and securing access and editing sure are confusing, especially in text form. I'm mulling over something more tabular like this (neither exhaustive nor correct example!):

Login Required to View Login Required to Edit Then Do This
no no (default installation; do NOT rename htaccess.txt to .htaccess)
no yes rename htaccess.txt to .htaccess. Add a require valid user for the "edit" script
Delete TWikiGuest from .htpasswd if you wish to disallow anonymous edits
yes yes rename htaccess.txt to .htaccess. Add a require valid user for the "view" and "edit" scripts

etc. Comments, thoughts? Perhaps move the options to different topics ("FullyOpen","FullyRestricted", etc.)

-- BruceMcKenzie - 09 Apr 2003

Fixed table above a little - hope correctly wink

-- PeterMasiar - 10 Apr 2003

This table is a good suggestion. This is however a user authentication question, not a access control question. I updated TWikiUserAuthentication accordingly.

-- PeterThoeny - 14 Apr 2003

I am confused: ManagingWebs says, that it's not possible to rename or delete a web through browser.

This page states, that You can define who is allowed to rename, move or delete a topic, or rename a web.

I think, this should rather read "You can define who is allowed to rename, move or delete a topic on individual web level or on topic level."

Likewise the text You can define restrictions of who is allowed to rename a TWiki web. is also misleading as you can only configure who is allowed to rename a topic on individual web level using the variables DENYWEBRENAME and ALLOWWEBRENAME.

What do you think? Cheers

-- DanielKabs - 23 Apr 2003

  • Would anyone be offended if I put "---" bars between everyone's posts? There are some places where I find it difficult to keep track of who said what.
  • OTOH (4 fingers & a thumb?), maybe just fixing the few places where the sig block is not on a new line would do the trick.
-- RickArchibald - 04 Nov 2003

Initially we had horizontal bars but found them too distracting. There is enough visual clue if the signature has an empty line before and after it. See also SignatureNetiquette.

-- PeterThoeny - 05 Nov 2003

I've followed the instructions for "Authenticate and Restricting Selected Webs Only", but when I go to my wiki after restarting my browser, I'm asked to login, no matter which of my webs I go to! I'm not sure why, but the links to bin/view on all webs are linking to bin/viewauth for some reason. I've double checked the preferences in all they webs, and only one web has the ALLOWWEBVIEW set for a certain group. Removing that one condition makes all webs readable. Setting that condition makes all webs require login. Any ideas?

-- DavidGrant - 18 Oct 2004

I remember I had the same problem as David some time ago. But I cannot recall what I did to fix it. Frankly to say, I got rid of many troubles before I finally set up Twiki as I want. Twiki is the most versatile as well as most difficult wiki engine for installation and usage I have ever tried. It should be made easier by any means.

-- ChunhuaLiao - 26 Oct 2004

David, you problem sounds alot like one I ran into but thought it was browser related. Perhaps not. See the discussion and possible fix at SafariBrowserIssues#PatternSkinFix.

-- LynnwoodBrown - 27 Oct 2004

I happen to have exactly the same problem as David. The add-on in my case is, that only webs, which have been already existing (TWiki, Main and Sandbox), are affected by that problem. New webs can be still accessed (except when they are also restricted). I checked the support web and the TWiki documentation for advice but could not find any hint, that would help me. Has anyone any ideas on that problem? I would realy appreciate some help.

-- AndreaLazarescu - 08 Nov 2004

The SuperAdminGroup is misleading. It states:

"The default setting is not to have superusers."

But the default TWiki.cfg that comes with Cairo, and is also in the MAIN branch are:

$doSuperAdminGroup = "1";
$superAdminGroup    = "TWikiAdminGroup";

So, the default IS to have superusers. The only thing that hints that there are no superusers by default is that TWikiAdminGroups only have PeterThoeny as a member.

-- RafaelAlvarez - 24 Nov 2004

VickiBrown, thank you very much for helping to keep the system docs up to date. I changed the link to the support web HowtoHideTextFromView to an InterWiki link because this TWikiAccessControl topic is packaged into twiki releases but the support web is not, becoming a broken link.

-- MattWilkie - 01 Dec 2004

I felt that the comments in regards to the "Authentication and Restricting Selected Webs" is slightly ambiguous, specifically the comment that authenticating webs is not very secure because read access can be circumvented. Does authentication refer only to granting read permissions to the particular web for registered users, or does it include all of the steps in setting the WebPreferences NOSEARCHALL variable and using the .htaccess to control access to the viewauth file?

My interpretation of the current documentation is that if you perform the steps involving the .htaccess file and the NOSEARCHALL variable, the content will be protected from unauthorized read access and from search engine crawlers.

-- SeanLau - 08 Feb 2005

This documentation makes no mention of how FINALPREFERENCES affects precidence, or the relative precidence of WEB and TOPIC settings.

-- SamHasler - 28 Feb 2005

Changed the parts on renaming as they were misleading (see DanielKabs) comment above: renaming of a web is not possible from within TWiki. Instead the variable "ALLOWWEBRENAME" defines a web specific default for topic rename access.

-- FelixKaiser - 03 Mar 2005

Now that we made this clear, wink I have another question: At the top of this document is an explanation of how to set variables for access control: "Make sure you have three space plus * and an extra space ahead of any access control rule if it does not act as you want." On the other hand, WebPreferences says:" A preference is defined as: 6 spaces * Set NAME = value".

What is correct?

-- DanielKabs - 21 Apr 2005

I have added ALLOWTOPICCHANGE and ALLOWTOPICCHANGE and set both to twikiadmingroup. The permissions are working. But I (as a twikiadmingroup member) cannot view the differences between revisions. Any help would be greatly appreciated.

Update: The "| r1.12 | > | r1.11 |" when I mouse over on the ">" it is calling diff, even on a topic that requires authentication. It should be calling rdiffauth. How do I change that?


-- TroyKnabe - 10 May 2005

Regarding the 3 spaces vs 6 spaces question, looking at the code for 20040902, TWiki::Prefs seems to look for /^\t+\*\sSet\s/ (and every 3 spaces of indentation get converted to a \t on storing the topic in TWiki::UI::Save::_save()), whereas TWiki::Access looks for /^\s+\*\sSet\s/.

So in short, web/site preferences are handled differently to per-topic access restrictions (why?), but 3 or 6 spaces (or any multiple of 3) will always work.

Hope I got that right smile

-- AdamSpiers - 17 May 2005

How do I DENYWEBVIEW to TWikiGuest for the /TWiki/ web without setting DENYWEBVIEW for TWikiGuest to the rest of my webs? I've tried setting ALLOWEBVIEW = TWikiGuest in individual webs and DENYWEBVIEW = TWikiGuest in both TWiki/WebPreferences and TWiki/TWikiPreferneces, and I still can't lock out the TWiki web to anoymous access

-- WallaceWinfrey - 19 May 2005

I have an access problem. All webs need authentication, public or not. When I directo to view script, is redirected to viewauth. I'm using Koalaskin and have. I've read the topic about authentication on main topic, done all the stuff and the same problem. Any ideas? Thanks

-- AlfredoRuiz - 23 Jun 2005

TWiki's lack of access control is more and more a problem for me with TWiki at Intel. I am highly encouraged (compelled, forced) to use SharePoint, which uses fairly good, fairly standard, access control on a per item basis, rather than TWiki.

Yes: I want to put highly sensitive stuff in a TWiki (or on SharePoint).

But, for generating content, SharePoint sucks.

I'd appreciate any pointers to wikis that have better access control. I think I remember ZWiki did; I would guess that the wikis build around databases have whatever access control and authentication the database provides.

I'd love to find a good wiki plugin for SharePoint, where every item posted was a separate web item, and hence could have distinct permissions.

-- AndyGlew - 24 Jun 2005

    • frown users dislike that they have to type in their MS Windows password to get to the TWiki. but at least password manager handles that...
    • frown it is awkward to have TWiki stuff that is world readable. The sysadmins need to maintain separate public Apache mappings for each such TWiki. E.g. I asked them to arrange for one particular web to be public, without requiring a password to access - but the sysadmins goofed up on the Apache mappings, and eventually I settled on just requiring everyone to log in.
    • smile but at least, once folks have logged in and they have registered, I can set up ACLs to have some modicum of access control.
      • frown most users do not want to bother with registering with the TWiki site. So the Microsoft Windows domain/login is what TWiki sees... but TWiki is inconsistent about using this in things like ACLs.
      • I have ended up registering most users myself...
If I put DENYVIEW for TWikiGuest it doens't force the user to log on, it only sends the access control 401 message.

In some situations prompting for the login is what is required, but there is no way for the admin or topic creator to set viewauth or require valid-user for a specific topic within the topic, using the browser, using the current access control model. He has to "step outide" and edit the .htaccess file on a topic by topic basis.

Or is there a solution I've missed?

-- AntonAylward - 28 Jun 2005

I'm a little lost here. I've installed the TWiki on my site, following the instructions. But I cannot change the settings because TWikiAdminGroup is set to include only Peter Thoeny, and I can't edit that because I'm not in the Admin Group. Is there some installation step I've missed?

Can't the default for a new installation be to let everyone edit everything, like, you know, in a Wiki?

I also can't register because the server can't send me email because I can't edit the email server settings because I'm not in the admin group...


-- BenjaminRosenbaum - 23 Aug 2005

basically, the default install needs to be a little secure, as we store configuration info in topics. so no, TWiki is a little bit to powerful to allow anyone to edit all topics. you're going to need to edit TWikiAdminGroup.txt outside TWiki

-- SvenDowideit - 23 Aug 2005

Mh, I don't get this. I just installed as fresh TWiki and my Main.TWikiAdminGroup was editable, because Set ALLOWTOPICCHANGE = TWikiAdminGroup was commented out.
What am I missing here?

-- DanielKabs - 23 Aug 2005

That is the idea, the commented out access control should be enabled after authentication is working and admins are registered and in the group. As Sven points out, you need to edit the topic on the shell level if you lock yourself out.

-- PeterThoeny - 24 Aug 2005

Apropos Authenticate and Restricting Selected Webs Only. Using TWikiRelease04Sep2004, I made some experience contrasting what is written above. I'd like to know if I am seeing extraterrestrial artifacts or if I can change the documentation accordingly:

  1. I restricted view access to Main web to authenticated users ( Set DENYWEBVIEW = TWikiGuest in WebPreferences). Although I left NOSEARCHALL untouched (i.e. unset), unauthenticated users can not search Main web across from other webs. So maybe step 2) is not necessary? Hypothesis: Hiding a web from "all web search" enables restricted users to still use all other webs?
  2. I had to disable the $doRememberRemoteUser flag in lib/TWiki.cfg in order to get authentication working properly. Reason: my users access TWiki through proxy server and thus TWiki always sees the same IP address. Also regarding PhilippeBricout's comment, security considerations should make disable the recommended practice in step 3).
  3. view and viewauth are the same file, so why does step 4) instruct me to copy it over? supposition: just to make sure they are?
  4. viewauth (by default) is already in the .htaccess file. To minimize confusion, step 5) should mention that this change applies only if .htaccess has been manipulated beforehand.
  5. I had to add rdiff to the list of authenticated scripts (in bin/.htaccess) to get the diff link (the > between revision numbers in the bottom navigation bar) working.
In case of Authenticate all Webs and Restrict Selected Webs: Should the viewauth script be listed in the .htaccess file, too (step 3)?

I'd like to know: what a difference does it make internally if either viewauth or view (accordingly rdiffauth or rdiff) is listed as authenticated script?

-- DanielKabs - 10 Jan 2006

If you disable $doRememberRemoteUser and are not using session tracking by cookies, then everyone will be a TWikiGuest in view, e.g. the setup you discribe cannot work unless you authenticate the view script (and thus require everyone to login to look at content.)

-- PeterThoeny - 11 Jan 2006

For the reasons I described above, I had to disable $doRememberRemoteUser and you are right, my setup is not yet working 100%: bin/search never returns anything and fails to display LeftBar. Adding search to bin/.htaccess (same as with rdiff in step E. above) fixed this. It works, although view is not yet authenticated.

  • Update: Peter, you are right, I have to include view in the .htaccess file so links from a %TOC% do not get redirected. -- DanielKabs - 23 Jan 2006
I think this setup may be relevant for other users, too. So when it turns out to be set up correctly, I will update the docs here (it's a wiki, isn't it smile ). Any help about "session tracking" and "authenticating scripts" (what difference it makes although normal and auth scripts are the same) is appreciated.

moved your comment about doc updates workflow to CoffeeBreak#How_changes_in_Twiki_propagate

-- DanielKabs - 11 Jan 2006

I've got spammers making user pages on my Wiki. They don't get an entry in .htpasswd, so I assume they are making users with no passwords. I delete the pages as fast as they're being added, but it's a pain. Is there any way to require an email verification before a new user gets created, like we do with mailing lists?

-- PaulTomblin - 01 Feb 2006

This is a support question, not a documentation feedback. Please ask in the Support web.

-- PeterThoeny - 01 Feb 2006

I think I am a fairly experienced guy, but I can't figure out how to securely set this up based on the confusing documentation. Here is what I want to do.

1. An account is required to even browse ANYTHING on the site, including documentation or reference guides.

2. Users can not register for an account themselves; they must contact the Wiki administrator offline to have their account created.

I can't seem to figure this out. This guide talks about ALLOWWEBVIEW and DENYWEBVIEW, but it doesn't give any real-world examples of how to set them up. Simply showing me doesn't tell me anything - what users go where? For example, I removed all access but then the registration form stopped working because the Guest account could not read it.

Has anyone set this up? If so, what are the sample access permissions you used? Thanks in advance.

-- RobertJBrown - 26 Apr 2006

Your desired setup has nothing to do with the TWiki access control setting described here. It is an Apache configuration question. Please ask in the Support web where we will handle this custom setup question.

-- PeterThoeny - 28 Apr 2006

Can anybody here help me, I am interested in TWiki'ing and ofcourse I am new to TWiki, But the problem is - I am unable to customize my TWiki - I mean to say that I had deployed TWiki on Apache - It is not allowing me to customize my own image even. It is just posing me with an "Access Denied"... Please help me to resolve this issue.

-- RadhakrishnaUppaluri - 15 May 2006

Please ask support questions in the Support web (after reading the SupportGuidelines).

-- PeterThoeny - 15 May 2006

Note that the Apache rules for protecting attachments with viewfile have been made safer. Thank you to BenWheeler for spotting this and provinding a better regex.

-- KennethLavrsen - 27 Jul 2006

I think there's an error in the access control description for individual topics. Under "Controlling access to a Topic", it says "You can define these settings in the WebPreferences topic [..]". I think that this is incorrect, because the WebPreferences only consider preferences for the web. Correct in my opinion is "You can define these settings within the individual topic (you want to control access for) [...]". Shall I just change it above?

-- FelixKaiser - 12 Oct 2006

Thanks Felix, I updated the doc. This is a wiki, so please feel free to improve/fix the docs as needed!

-- PeterThoeny - 13 Oct 2006

The documentation on version TWiki-4.1.1, Mon, 05 Feb 2007, build 12770 has removed the options for renaming: ALLOWWEBRENAME and ALLOWTOPICRENAME, yet without these, deleting an attachment -among other actions, is not possible.

-- RafaelCaceres - 15 Feb 2007

This is tracked in Bugs:Item3642

-- PeterThoeny - 15 Feb 2007

Hi all, Can I use different authorization for different Web? Can I use Active directory groups, those already exist under my domain, for accessing Web. Can we set permission like

Set ALLOWTOPICVIEW = domainname\group

or like

<> require group domainname\group </> in .haccess file.

I want to achive that, ThisWeb? is accessed by ThisGroup? only that too belong to winodws/active directory group. I am using SSPI module for authentication. Log on using domain ID/PWD.


-- RahulH - 22 Mar 2007

Please ask support questions in the Support web.

-- PeterThoeny - 24 Mar 2007

How does access control affect INCLUDE? For example, does restricting VIEW for a toipc prevent one from INCLUDEing it? If it doesn't then can't one include a topic to bypass the VIEW restriction? Suggest some documentation in this area...

-- RobertWithrow - 29 Mar 2007

Good point, created Bugs:Item3821. (Access control can't be circumvented in INCLUDE, it works properly.)

-- PeterThoeny - 29 Mar 2007

I'm only two days old. Uh, in TWiki experience, that is. I was trying to figure-out how this "granular access control" stuff works - I wanted to restrict editing on specific pages. With a preponderance of very general documentation, I was left to experimentation (not drugs, that was in the '60s). I hope the following is found useful by other less-than-a-week olds:

At the bottom of a specific page on which I wanted to restrict editing, I added:

   * Set ALLOWTOPICCHANGE =  Main.TWikiAdminGroup
   * Set DENYTOPICCHANGE = Main.NobodyGroup -->

Note that putting this inside an HTML comment hides it from your fabulously formatted page, but the TWiki Gods still see them, and obey your wishes.

Thanks to all who work so hard, so others can drink coffee.

-- TerrillBennett - 13 Jun 2007

Thanks for the feedback, enlightening funny!

For access control, please use only one of ALLOWTOPICCHANGE or DENYTOPICCHANGE, not both. If you want to hide the settings in HTML comments put the comment tags on separate lines.

BTW, please ask support questions in the Support web.

-- PeterThoeny - 14 Jun 2007

Another INCLUDE question: Suppose I have a set of topics that I want to access control identically. Can I INCLUDE the control statements from some other topic, like a topic where I explain the controls and use STARTSECTION...ENDSECTION to delineate them? The use case is to have standardized look-and-feel for controls that include text with contact info. Putting that on each page creates a maintenance nightmare.

-- RobertWithrow - 15 Jun 2007

I meant the above to be a documentation suggestion, as I'm looking at the code to answer the question proper... wink I assume lots of people construct pages out of INCLUDES so the topic of the effect of INCLUDED access controls probably deserves a few words.

-- RobertWithrow - 15 Jun 2007

This topic should also address the situation where there are multiple declarations in a topic. For example, if I have an ALLOWTOPICVIEW for user foo followed by another ALLOWTOPICVIEW for user fee, what happens? Is the first one used? Or the second? Or both?

-- RobertWithrow - 22 Jun 2007

INCLUDE doc tracked in Bugs:Item4289; multiple settings tracked in Bugs:Item4288.

-- PeterThoeny - 23 Jun 2007

A warning should be added to this topic that if users restrict access to the Main web, eg. by setting ALLOWWEBCHANGE = TWikiAdminGroup then the Registration Agent may not be able to create new user topics and registration can fail. This happened to me and it took a while to figure out what the problem was. It was solved by setting ALLOWWEBCHANGE = TWikiAdminGroup, TWikiRegistrationAgent in the Main web.

-- TamsinTweddell - 25 Jun 2007

Tamsin, thanks for mentioning it, I had the same problem a while ago.

The problem with the Restrict Access to Whole TWiki Site recipe for me is, I as an administrator have to assign passwords and users cannot easily change them, which is okay but doesn't look very professional.

Here's a configuration that restricts as much as possible, while still allowing new users to register themselves:

  • Protect all webs, (except perhaps a "Public" web where you can put welcome pages, but including Main and TWiki) using ALLOWWEB... = as described above.
  • Don't forget the TWikiRegistrationAgent in Main as just mentioned
  • Selectively open TWikiRegistration, NewUserTemplate and UserForm for viewing to all users ("DENYTOPICVIEW =" )
  • Send users the direct registration link
Still under evaluation, but seems to work so far.

-- TimRomberg - 12 Jan 2008

I have TWiki on an intranet with mod_auth_sspi handling the authentication. How can I restrict access to only registered users? Adding DENYWEBVIEW = TWikiGuest does not help, since users are already authenticated.

-- ParBohrarper - 15 Jan 2008

Please ask support questions in the Support web.

-- PeterThoeny - 17 Jan 2008


RewriteRule ^/+twiki/+pub/+([^/]+)/+((([^/]+)/+)+)(.+) /twiki/bin/viewfile/$1/$4?filename=$5 [L,PT]


RewriteRule ^/+twiki/+pub/+([^/]+)((/+([^/]+))+)/+(.+) /twiki/bin/viewfile/$1/$2?filename=$5 [L,PT]

as it seems the original is not correct, it ignores subwebs and adds a / too many.

-- KoenMartens - 20 Mar 2008

Is this change reflected in SVN?

-- PeterThoeny - 21 Mar 2008

Hmm, no, i'll put that on my todo.

-- KoenMartens - 31 Mar 2008

I had contributed some module call - TWikiAuthen with http://twiki.org/cgi-bin/view/Codev/SecuringAttachments, this may solve the issue. The module is Apache Module, is invoked through request when some one tries to access the "pub" or may be to some perticular Web's pub. It checks the users access rights to the topic where attachment is added - and accordingly gives the access.

-- SopanShewale - 26 Jun 2008

Sopan: Possibly package this as an add-on in the Plugins web?

-- PeterThoeny - 04 Jul 2008

hi there..

We are using tiwki 2004. Now every time user creates his web page, it add on to a huge .acl file that we already are maintaining. Also if user want to modify the restrictions on a page, they have to contact the admin group. I would like to know if it is possible that we could let the user to manage the access to their own pages(pages that they have created) following below criteria.

1. Authentication v's Access Control

Authentication will still have to be done against the our corporate server.

However, the access control should move to the pages themselves. That is, may be we should just be able to add special access-control markup to the pages when editing them.

May be we can stop using .acl file.

To do this, do we need a newer version of TWiki. I don't know for sure. If we need than, how about migrating from TWIki 01 Sep 2004 to the current stable version available from http://TWiki.org.

I have read that upgrading TWiki is not always easy.

Please let me know what should i do ASAP.

Thanks and Regards

-- SapinAmin - 14 Jul 2008

Please ask support question in the Support web. This section is about the documentation.

-- PeterThoeny - 15 Jul 2008

RewriteRule ^/+twiki/+pub/+([^/]+)((/+([^/]+))+)/+(.+) /twiki/bin/viewfile/$1/$2?filename=$5 [L,PT] Remove the / in $1/$2, as $2 will already have the /.

Also, to restrict access to the entire TWiki site, remove the FilesMatch directive seems better than putting a .* as a match. It saves one useless match per access.

-- OlivierRaginel - 30 Jul 2008

Is it possible to restrict viewership of only parts of a page? Specifically, certain cells in a table? I would like for certain cells to be hidden from certain users.

-- TWikiGuest - 22 Sep 2008

Please ask support questions in the Support web. Also, please register with your real first name and last name, not with a screen name.

-- PeterThoeny - 25 Sep 2008

LocalSite.cfg $TWiki::cfg{AuthScripts}

If you want to use the following authorisation controls, you need to make sure that LocalSite.cfg has


It seems the configure script sets this to a list of default actions which require login and then can't be overridden

-- MatthewSSmith - 2010-09-15

Matthew, thank you for updating the docs directly in wiki spirit. However, the {AuthScripts} configure setting is required for access control if template login is enabled, it has to list all script where users need to be checked if authorized to do the action. I moved your doc update as a comment just above this comment. Please elaborate what kind of issues you had.

-- PeterThoeny - 2010-09-15

I would like to permit access only to the Main Web page and to let the access to all the children topics permitted only to a list of users. I tried by putting on the main page an empty DENYTOPICVIEW but that didn't work. Do you have any suggestion?

-- FabioAffinito - 2011-02-07

Please ask support questions in the Support web. This section is about the documentation of this topic.

-- PeterThoeny - 2011-02-07

When securing attachments, it is not necessary to use mod_rewrite in the Apache configuration. I use:

  Alias /pub/TWiki "/twikidir/pub/TWiki"
  Alias /pub/Sandbox "/twikidir/pub/Sandbox"
  ScriptAlias /pub "/twikidir/bin/viewfile"

-- WillemEngen - 2012-08-13

Thank you Willem! I confirmed this to work properly. I updated the docs and the ApacheConfigGenerator accordingly.

-- PeterThoeny - 2012-08-15

Not knowing where to put my suggestion regarding hardening, I add it here:

By default, user information can be edit by any logged in user. By adding the following line to NewUserTemplate, edit rights can be restricted to the user account:


-- ThomasGutzmann - 2012-08-29

We had that optional setting in the user template in the past and removed it because it goes against the wiki spirit. See TWikiAccessControl#ImportantConsideration.

-- PeterThoeny - 2012-08-29

Hi Peter,

I understand - but living in Germany we have to obey some rules which contradict the wiki spirit when it comes to personal data. "Datenschutz" and so on...

It's ok if personal data are made public as long as the user has sole control over the content. I propose the following:

  • Set ALLOWTOPIC initially only to the user.
  • If the user wants, he can remove the constraint again.

To accomplish this, the following has to be included in NewUserTemplate:

%STARTSECTION{ type="expandvariables" }%

%ENDSECTION{ type="expandvariables" }%

This results in the term "Set ALLOWTOPICCHANGE = NewUser" in the user profile.

Thanks for pointing me to TWikiTemplates#VariableExpansion.



-- ThomasGutzmann - 2012-08-29

Thomas, this is not in line with the TWikiMission - TWiki's mainly focus is company internal collaboration, so personal data is not made public as long as TWiki is used internally. You are welcome to change the user template to your needs.

-- PeterThoeny - 2012-08-29

The ingroup test doesn't seem to be working for me - guest as well as any logged in user is passing the ingroup test - what should I look for to debug this problem?

%IF{"'%USERNAME%' ingroup 'MyGroup'" then="%INCLUDE{HiddenTopic}%"}%

where MyGroup only includes two users

the HiddenTopic topic is set to limit access to only MyGroup members and this is working correctly --- but because my ingroup test is always passing the HiddenTopic topic is always being included and is generates an error when the user isn't really in MyGroup

-- John Hart - 2016-11-01

John, I think this is caused by another issue in your example. The INCLUDE is done regardless of condition because of the inside-out evaluation order of variable expansion. Escape the % in the then="" with $percnt, this will delay the expansion of the include until the condition is met. If you want to followup please ask a support question in the Support forum.

-- Peter Thoeny - 2016-11-01

Please use the Support forum if you have questions about TWiki features. This comment section is about the documentation of this topic.
Edit | Attach | Watch | Print version | History: r140 < r139 < r138 < r137 < r136 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r140 - 2016-11-01 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.