DokuWiki

It's better when it's simple

User Tools

Site Tools


acl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
acl [2011-01-06 02:15]
ach old revision restored
acl [2015-04-14 17:36] (current)
82.71.191.141
Line 1: Line 1:
 ====== Access Control Lists (ACL) ====== ====== Access Control Lists (ACL) ======
 +[[DokuWiki]]---like most wikis---is very open by default. Everyone is allowed to create, edit and delete pages. However ​sometimes it makes sense to restrict access to certain or all pages. This is when //Access Control List// (ACL) comes into play. This page should give you an overview of how ACLs work in DokuWiki and how they are configured.
  
-[[DokuWiki]] -- like most wikis --- is very open by default. Everyone is allowed to create, edit and delete pages. However sometimes it makes sense to restrict access to certain or all pages. This is when //Access Control Lists// (ACL) come to play. This page should give you an overview of how ACLs work in DokuWiki and how they are configured. 
  
-:!: **WARNING:​** DokuWiki'​s ACL feature has now been included for some time and should be pretty stable. However, if you are concerned about the risk of unauthorized users accessing information in your wiki, you should never put it on a computer accessible from the Internet...+===== Configuration ​and Setup ===== 
  
- ===== Configuration and Setup ===== +ACLs can be enabled in the [[installer]] and an initial ACL policy is set there as well. To manually enable ACLs, switch on the [[config:​useacl]] option and create a copy of the example files ''conf/acl.auth.php.dist'​'​ and ''conf/users.auth.php.dist'​'.​ Rename the files to ''conf/acl.auth.php'​'​ and ''conf/users.auth.php'​'​ respectively. 
- +==== See also =====
-ACLs can be enabled in the [[installer]] and an initial ACL policy is set there as well. To manually enable ACLs, switch on the [[config:​useacl]] option and copy the example files ''​conf/​acl.auth.php.dist''​ and ''​conf/​users.auth.php.dist''​ to ''​conf/​acl.auth.php''​ and ''​conf/​users.auth.php''​ respectively. +
- +
-==== See also ====+
  
 There are a few more config options and features that relate to authentication,​ user registration and ACL setup. Please check their respective wiki pages to get more information:​ There are a few more config options and features that relate to authentication,​ user registration and ACL setup. Please check their respective wiki pages to get more information:​
  
-  * Config option [[config:​useacl]] ​-- enable ACL usage +  * Config option [[config:​useacl]] - enable ACL usage 
-  * Config option [[config:​superuser]] ​-- setup superusers with ACL granting rights +  * Config option [[config:​superuser]] - setup superusers with ACL granting rights 
-  * Config option [[config:​disableactions]] ​-- allows you to disable open registration +  * Config option [[config:​disableactions]] - allows you to disable open registration 
-  * Config option [[config:​defaultgroup]] ​-- the default group to which new users are added +  * Config option [[config:​defaultgroup]] - the default group to which new users are added 
-  * [[plugin:​usermanager|User Manager]] ​-- managing users +  * [[plugin:​usermanager|User Manager]] - managing users 
-  * [[auth|Authentication Backends]] ​-- identify users from different data sources+  * [[auth|Authentication Backends]] - identify users from different data sources
   * [[faq:​regdisable|FAQ:​ How to disable open user registration]]   * [[faq:​regdisable|FAQ:​ How to disable open user registration]]
 +
 +:!: **WARNING:​** DokuWiki'​s ACL feature has been included for some time and should be pretty stable. However, if you are concerned about the risk of unauthorized users accessing information in your wiki, you should never put it on a computer accessible from the Internet.
  
  
Line 30: Line 29:
 When DokuWiki checks which rights it should give to a user, it uses all rules matching the user's name or the groups he or she is in. The rule that provides a user's permission is chosen according to the following process: When DokuWiki checks which rights it should give to a user, it uses all rules matching the user's name or the groups he or she is in. The rule that provides a user's permission is chosen according to the following process:
  
-  * Rules which match closer to the namespace:​page are preferred over rules which match further away -- we call this "​specific matching"​.+  * Rules which match closer to the namespace:​page are preferred over rules which match further away---we call this "​specific matching"​.
   * When more than one rule matches at the same level, the rule giving the highest access level is preferred.   * When more than one rule matches at the same level, the rule giving the highest access level is preferred.
  
Line 65: Line 64:
   - User //bigboss// is given full rights.   - User //bigboss// is given full rights.
   - Now the access for the ''​devel''​ namespace is restricted. Nobody is allowed to do anything.   - Now the access for the ''​devel''​ namespace is restricted. Nobody is allowed to do anything.
-  - Well not nobody really -- we give members of the //devel// group full rights here. +  - Well not nobody really---we give members of the //devel// group full rights here. 
-  - And of course //bigboss// is allowed, too -- and he's the only one who can delete uploaded files.+  - And of course //bigboss// is allowed, tooand he's the only one who can delete uploaded files.
   - And the //​marketing//​ team may read everything in the ''​devel''​ namespace, but read only.   - And the //​marketing//​ team may read everything in the ''​devel''​ namespace, but read only.
-  - However the devel guys don't want their boss to see the ''​funstuff''​ page -- remember exact pagematches override namespace permissions.+  - However the devel guys don't want their boss to see the ''​funstuff''​ page---remember exact pagematches override namespace permissions.
   - And finally the //​marketing//​ guys are allowed to edit the ''​devel:​marketing''​ page as well.   - And finally the //​marketing//​ guys are allowed to edit the ''​devel:​marketing''​ page as well.
-  - Then the permissions for the namespace ''​marketing''​ are set. All members of the //​marketing//​ group are allowed to upload there - other users will be matched by line 1 so they can still create and edit. //bigboss// inherits his rights from line 2 so he can upload and delete files. +  - Then the permissions for the namespace ''​marketing''​ are set. All members of the //​marketing//​ group are allowed to upload there---other users will be matched by line 1 so they can still create and edit. //bigboss// inherits his rights from line 2 so he can upload and delete files. 
-  - The last line finally restricts the start page to readonly for everyone. ​ Only superusers will be able to ever edit that page.+  - The last line finally restricts the start page to readonly for everyone. Only superusers will be able to ever edit that page.
  
 Let's have a look at a second example to better understand **specific matching**: Let's have a look at a second example to better understand **specific matching**:
Line 82: Line 81:
     * three rules match, #1, #2, #4     * three rules match, #1, #2, #4
     * rule #4 is closest, it matches at the namespace level so it takes precedence over the other three     * rule #4 is closest, it matches at the namespace level so it takes precedence over the other three
-    * abby's permissions level is 0+    * abby's permissions level is ''​None''​
   - bob, a regular user   - bob, a regular user
     * four rules match, #1, #2, #4, #6     * four rules match, #1, #2, #4, #6
     * rule #6 wins as its an exact match     * rule #6 wins as its an exact match
-    * bob's permission level is 16+    * bob's permission level is ''​Delete''​
   - bob forgets to login and tries to access his page   - bob forgets to login and tries to access his page
     * two rules match, #1 & #4     * two rules match, #1 & #4
     * rule #4 is closer, it wins     * rule #4 is closer, it wins
-    * bob's permission level while not logged in is 0+    * bob's permission level while not logged in is ''​None''​
   - charlie, a staff member   - charlie, a staff member
-    * five rules match, #1 - #5+    * five rules match, #1--#5
     * two rules match at namespace level, #5 gives charlie the higher permission so it wins     * two rules match at namespace level, #5 gives charlie the higher permission so it wins
-    * charlie'​s permission level is 16 +    * charlie'​s permission level is ''​Delete''​
- +
-Note rule #5, which appears to duplicate rule #3.  Without it, staff members wouldn't be able to access the private namespace as rule #4 would keep them out.+
  
 +Note rule #5, which appears to duplicate rule #3. Without it, staff members wouldn'​t be able to access the private namespace as rule #4 would keep them out.
  
 ===== Background Info ===== ===== Background Info =====
Line 112: Line 110:
  
 ^ Name   ^ Level ^ applies to        ^ Permission ​                              ^ DokuWiki constant ^ ^ Name   ^ Level ^ applies to        ^ Permission ​                              ^ DokuWiki constant ^
-| none   ​| ​ 0    | pages, namespaces | no permission -- complete lock out       ​| AUTH_NONE ​        |+| none   ​| ​ 0    | pages, namespaces | no permission---complete lock out        | AUTH_NONE ​        |
 | read   ​| ​ 1    | pages, namespaces | read permission ​                         | AUTH_READ ​        | | read   ​| ​ 1    | pages, namespaces | read permission ​                         | AUTH_READ ​        |
 | edit   ​| ​ 2    | pages, namespaces | existing pages may be edited ​            | AUTH_EDIT ​        | | edit   ​| ​ 2    | pages, namespaces | existing pages may be edited ​            | AUTH_EDIT ​        |
Line 135: Line 133:
 </​file>​ </​file>​
  
-Please notethat **order does not matter** in the file. The file is parsed as whole, then a perfect match for the current page/user combo is searched for. When a match is found further matching is aborted. If no match is found, group permissions for the current page are checked. If no match is found the check continues in the next higher namespace.+Please note that **order does not matter** in the file. The file is parsed as whole, then a perfect match for the current page/user combo is searched for. When a match is found further matching is aborted. If no match is found, group permissions for the current page are checked. If no match is found the check continues in the next higher namespace.
  
 :!: **Note:** To configure users or groups with special chars (like whitespaces) you need to URL escape them. This only applies to specialchars in the lower 128 byte range. The ACL file uses UTF-8 encoding so any multibytechars can be written as is. :!: **Note:** To configure users or groups with special chars (like whitespaces) you need to URL escape them. This only applies to specialchars in the lower 128 byte range. The ACL file uses UTF-8 encoding so any multibytechars can be written as is.
  
-:!: **Note:** When using $conf['​authtype'​] = '​ad';​ and groups names with spaces needing to be written in the acl.auth.php with a "​%5f"​ replacing the spaces instead of "​%20"​. ​ This is because Group names with spaces are first converted into underscores "​_"​ which are "​%5f"​.+:!: **Note:** When using $conf['​authtype'​] = '​ad';​ and groups names with spaces needing to be written in the acl.auth.php with a "​%5f"​ replacing the spaces instead of "​%20"​. This is because Group names with spaces are first converted into underscores "​_"​ which are "​%5f"​.
  
 :!: **Note:** The delete permission affects media files only. Pages can be deleted (and restored) by everyone with at least edit permission. Someone who has upload permissions but no delete permissions can not overwrite existing media files anymore. :!: **Note:** The delete permission affects media files only. Pages can be deleted (and restored) by everyone with at least edit permission. Someone who has upload permissions but no delete permissions can not overwrite existing media files anymore.
 +
 ==== User Wildcards ==== ==== User Wildcards ====
  
-It is possible to use user wildcards in the ACLs. This can be useful for Wikis with many registered users, if you want to give each user a personal namespace where only he/she has write access, and you don't want to edit the ACLs for each user. To accomplish that **%USER%** is replaced by the username of the currently logged in user. \\ In the following example a logged in user gains full access (upload/​delete) permissions for the user's namespace ''​users:<​username>:​*''​ and revoke all access from other namespaces located in ''​users:​*''​ \\ +It is possible to use user and group wildcards in the ACLs. This can be useful for Wikis with many registered users, if you want to give each user or group a personal namespace where only he/she has write access, and you don't want to edit the ACLs for each of them. To accomplish that **''​%USER%''​** is replaced by the username of the currently logged in user and **''​%GROUP%''​** by all the groups of this user. 
-In this case logged in user has access to own namespace only and have not access to users namespaces (even view names of namespaces) of other users. ​+ 
 +In the following example a logged-in user gains full access (upload/​delete) permissions for the user's namespace ''​user:<​username>:​*''​ and revoke all access from other namespaces located in ''​user:​*''​.\\ In this case logged-in user has access to own namespace only and have not access to users namespaces (even view names of namespaces) of other users. ​
  
 <​file>​ <​file>​
 # #
 # Grant full access to logged in user's namespace # Grant full access to logged in user's namespace
-users:​%USER%:​* ​         %USER% ​ AUTH_DELETE+user:​%USER%:​* ​         %USER% ​ AUTH_DELETE
 # #
-# Allow to browse own namespace via INDEX +# Allow to browse own namespace via the index 
-users:                  %USER% ​ AUTH_READ+user:                  %USER% ​ AUTH_READ
 # #
-# Allow read only access to start page located in <​users> ​namespace  +# Allow read only access to start page located in "​user" ​namespace  
-users:​start ​            ​%USER% ​ AUTH_READ+user:​start ​            ​%USER% ​ AUTH_READ
 # #
-# Disable all access to user's home namespaces not owned by logged in user (include view namespaces via INDEX)  +# Disable all access to user's home namespaces not owned by logged in user  
-users:*                 ​@user ​  ​AUTH_NONE+(include view namespaces via the index)  
 +user:*                 ​@user ​  ​AUTH_NONE 
 +
 +# Allow members of '​group'​ to edit pages in the '​group'​ namespace. 
 +# be careful, if you have a user namespace, all members of the default group  
 +# will gain access to it 
 +%GROUP%:​* ​              ​%GROUP% AUTH_EDIT
 </​file>​ </​file>​
  
-:!: **Note:​** ​current ​version 2009-12-25c "​Lemming"​ has some caveat. If you add, update or remove ACL from GUI admin interface then DokuWiKi ​engine ​will replace %USER% in the second field of ACL to %25USER%25 ​that is [[http://​bugs.splitbrain.org/​index.php?​do=details&​task_id=1955|bug FS#1955]]. To avoid itchange permissions manually only (file: ''​conf/​acl.auth.php''​) or correct them manually after each operations with ACL from GUI because ​mask %25USER%25 does not work as expected, only %USER% should be used in the ''​conf/​acl.auth.php''​. ​ +:!: **Note:** version 2009-12-25c "​Lemming"​ has some caveat. If you add, update or remove ACL entries ​from the admin interface then DokuWiKi will replace %USER% in the second field of the ACL to ''​%25USER%25''​ (this is [[http://​bugs.dokuwiki.org/​index.php?​do=details&​task_id=1955|bug FS#1955]]). To avoid this, change permissions manually only (by editing: ''​conf/​acl.auth.php''​) or correct them manually after each operation in the admin interface ​because ​''​%25USER%25'' ​does not work as expected, only ''​%USER%'' ​should be used in the ''​conf/​acl.auth.php''​. ​This bug is fixed in newer versions.
- +
-:!: **Note:** The wildcard was recently changed from @ to % -- if you are upgrading from an older version you need to adjust your ACL setup accordingly.+
  
 +:!: **Note:** The wildcard changed from @ to % in December 2008 -- if you are upgrading from an older version you need to adjust your ACL setup accordingly.
acl.1294276544.txt.gz · Last modified: 2011-01-06 02:15 by ach