Wiki source code of Access Rights

Version 22.2 by Vincent Massol on 2013/11/05

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 [[Rights can be managed>>platform:Features.RightsManagement]] or configured to work on different scopes or layers. Permissions set at a wiki wide level will be overridden by permissions set at a space level which in turn are overridden by permissions set at a page level.
6
7 You can give a user access to edit pages in only one space by denying them access to the entire wiki then explicitly granting them access to edit in the given space.
8
9 When multiple permissions are set at the same level, deny permissions always overridde the other ones. Denying **view** access implicitly denies **edit** access also.
10
11 {{warning}}
12 If a user is not able to edit a page despite being explicitly granted permission, double check that a group which the user is a member of isn't denied access to that page.
13 {{/warning}}
14
15 Based on those simple rules and a few types of activities which can be permitted or disallowed, complex permissions constructs can be built.
16
17 = Permission Types =
18
19 * **view** : This gives the user the ability to view a document or load it using the API.
20 * **comment** : This gives the user the ability to add a comment.
21 * **edit** : This gives the user the ability to edit the page and all of its objects.
22 * **delete** : This gives the user the ability to put the page into the recycle bin.
23
24 == Special permissions ==
25
26 * **admin** : This permission is special because it can only be granted on a space or an entire wiki. Admin status is "undeniable" in that an admin of a wiki cannot have their admin status denied for a space. Technically speaking, admin grants a user view, comment, edit, and delete permission with the added ability to permanently delete a page from the recycle bin.
27
28 * **programming** : This is the holy grail of permission. A programmer is allowed to execute arbitrary java code in the wiki and can thus gain control of the system user which the wiki is running under. Obviously this permission should be treated with respect. Any page which was last saved by a programmer is blessed with the power to run dangerous scripts so to minimize security concerns, programmers should be encouraged to register additional user names for the day to day changes which do not require such power. Because it effects the entire wiki (or wiki farm), programming permission can only be set on ##XWiki.XWikiPerferences## and in a multi-wiki environment (farm), it can only be set for users of the main wiki. Note that having programming rights imply having the admin rights.
29
30 * **register** : This permission is usually only granted or revoked for the guest pseudo-user (XWiki.XWikiGuest) and gives the guest the power to register on the wiki. This permission can only be set on ##XWiki.XWikiPreferences## and is available in the administration interface.
31
32 * **subwikicreation** (since 5.2 M2) : This permission allow the user to create subwikis. It can only be set on ##XWiki.XWikiPerferences## and it can only be set for users of the main wiki.
33
34 = Wiki Access Configuration =
35
36 The first thing you will want to do is configure a policy access for your wiki. Depending on what you intend to use your wiki for, you have several options:
37
38 * [[Open Wiki>>#HOpenWiki]]: anyone can edit pages (including non registered users)
39 * [[Public Wiki>>#HPublicWiki]]: only registered users can edit pages but registration is open to anyone. This is the default configuration of the default wiki (the wiki provided as a XAR on the [[download page>>xwiki:Main.Download]]).
40 * [[Public Wiki with confirmed registration>>#HPublicWikiwithconfirmedregistration]]: like ordinary public wiki but newly registered users must enter a token which is emailed to them.
41
42 Also, a common use case in your wiki access configuration can be to [[prevent regular users to create new spaces>>#HPreventregularusersfromcreatingnewspaces]].
43
44 == Open Wiki ==
45
46 You can configure your wiki to be open, so that everyone can edit and comment without registering or logging in. To do this simply add a user called ##XWiki.XWikiGuest## and grant him the permissions you want to be granted to guests.
47
48 {{warning}}
49 There is currently no way to hand each guest a temporary account based on their IP address so an open wiki on the public internet may not be a good decision.
50 {{/warning}}
51
52 == Public Wiki ==
53
54 Nothing to do. This is the default configuration.
55
56 === Requiring guests to fill out a CAPTCHA in order to comment (Since: [[XWiki Enterprise 2.3M1>>xwiki:ReleaseNotes.ReleaseNotesXWikiEnterprise23M1]]) ===
57
58 It is nice to allow guests to comment on a page, often the most helpful people are unwilling to go to the bother of registration and it creates a more open atmosphere. Unfortunately comments can contain links which can be used as a vector for search engine spam. To keep your site open while preventing automated commenting, you can require guests to fill out a captcha before commenting. The captcha will not be displayed or even loaded until they click on the comment window to type their message so you don't need to worry about guests' idle surfing causing the [[captcha module>>extensions:Extension.Captcha Module]] to use too much of your server's CPU power.
59
60 You can require guests to fill out a captcha for posting comments on a wiki or space level. You can require it on the wiki level but remove that requirement for a single space, or you can require it only for one or more spaces but not the entire wiki.
61 To turn on comment captcha requirement, go to wiki or space administration, click on the "Rights" section and notice the checkbox toward the bottom labeled "Require unregistered users to solve a captcha when posting a comment on a page". Check that box and guests will be required to solve a captcha to comment.
62
63 {{info}}
64 This setting does not allow guests to comment, it only denies them permission to comment without a captcha on pages where they already had it. To allow commenting, you will have to check the normal "allow comment" checkbox for unregistered users.
65 {{/info}}
66
67 Example:
68 {{image reference="CaptchaComment.png"/}}
69
70 == Public Wiki with confirmed registration ==
71
72 To require users to register with a valid email address, you can require them to confirm their registration. To do this, open the administration interface for the wiki and navigate to the registration section:
73
74 * "Use email verification" sends an email to the email address that the user registered with. Be sure the [[SMTP server>>platform:AdminGuide.Configuration#HConfiguringtheSMTPserver]] is configured correctly
75 * "Check Active fields for user authentication" will prevent the user from logging in until they have entered the token which is sent in the email
76 * "Validation e-Mail Content" is the content which will be placed in the email
77
78 === Options ===
79
80 ; Email address confirmation
81 : Set "Check Active fields for user authentication" and "Use email verification" to "YES". Changes to "Validation e-Mail Content" are optional but must still contain the link to activate the account.
82 ; Friendly welcome message
83 : Set only "Use email verification" to "YES" and change "Validation e-Mail Content" so that it doesn't mention verification since it's not needed.
84 ; Registration subject to admin approval
85 : Set "Check Active fields for user authentication" and "Use email verification" to "YES" and change "Validation e-Mail Content" so that it explains that the registration is subject to approval and most importantly, remove the validation link. An admin can then change the "active" setting in the object editor on the user's document (the editor for the admin is located at: //{{{http://127.0.0.1:8080/xwiki/bin/edit/XWiki/Admin?editor=object}}}//)
86
87 {{info}}
88 To require the user to provide an email address when registering, see the registration page configuration, part of the [[Administration Application>>extensions:Extension.Administration Application]].
89 {{/info}}
90
91 == Prevent regular users from creating new spaces ==
92
93 You can restrict the creation of new spaces to users with administrative privileges by following these steps:
94
95 * In the global rights, deny write access to the ##XWikiAllGroup## group and the ##XWikiGuest## user and allow edit access to the ##XWikiAdminGroup## group
96 * In each space rights, allow write access to the ##XWikiAllGroup## group
97
98 = An overview of permissions =
99
100 Here is a full listing of all the rights available in XWiki Enterprise and their default setting:
101
102 * //**Right name:** brief description of the right//
103 ** //Availability: at what level can you set this right?//
104 *** //Page: this right can be set at the page level//
105 *** //Space: this right can be set at the space level//
106 *** //Wiki: this right can be set at the wiki level//
107 ** //Default status: is the right allowed or denied when the checkbox is left blank?//
108 *** //**ALLOWED**: this means that users **CAN** perform the given action if no other right is set//
109 *** //**DENIED**: this means that users **CANNOT** perform the given action if no other right is set//
110 ** //Priority order: which setting wins over another if an user has 2 different settings?//
111 ** //Checking order: at what level is the right checked first?//
112 * **View:** whether users can see the page
113 ** Availability:
114 *** Page
115 *** Space
116 *** Wiki
117 ** Default status: **ALLOWED**
118 ** Priority order: deny > allow > no setting
119 ** Checking order: page > space > wiki
120 * **Comment:** whether users can add a comment to the page
121 ** Availability:
122 *** Page
123 *** Space
124 *** Wiki
125 ** Default status: **ALLOWED**
126 ** Priority order: deny > allow > no setting
127 ** Checking order: page > space > wiki
128 * **Edit:** whether users can edit and save modifications to the page
129 ** Availability:
130 *** Page
131 *** Space
132 *** Wiki
133 ** Default status: **ALLOWED**
134 ** Priority order: deny > allow > no setting
135 ** Checking order: page > space > wiki
136 * **Delete:** whether users can delete the page
137 ** Availability:
138 *** Page
139 *** Space
140 *** Wiki
141 ** Default status: **DENIED** (unless you're the document creator)
142 ** Priority order: deny > allow > no setting
143 ** Checking order: page > space > wiki
144 * **Admin:** whether users can manage administration settings for the space / wiki
145 ** Availability:
146 *** Space (Automatically includes the view, comment, edit, delete rights)
147 *** Wiki (Automatically includes the view, comment, edit, delete, register, program rights)
148 ** Default status: **DENIED**
149 ** Priority order: allow > deny > no setting
150 ** Checking order: wiki > space
151 * **Register:** whether users can create new user accounts
152 ** Availability:
153 *** Wiki
154 ** Default status: **ALLOWED**
155 ** Priority order: allow > deny > no setting
156 ** Checking order: wiki
157 * **Program:** whether protected APIs & Groovy code available in wiki pages last saved by this user
158 ** Availability:
159 *** Wiki
160 ** Default status: **DENIED**
161 ** Priority order: allow > deny > no setting
162 ** Checking order: wiki
163 * **Subwiki Creation:** whether users can create subwikis
164 ** Availability:
165 *** Wiki
166 ** Default status: **DENIED**
167 ** Priority order: allow > deny > no setting
168 ** Checking order: wiki
169
170 = Note on permission inheritance =
171
172 When a permission is explicitly set for a given group or user at a certain scope (page, space or wiki) then other groups and users must also have the right explicitly set as well, at this scope or a scope upstream.
173
174 For example, when you decide to explicitly allow the view right for "GroupA" on a given space, users that are not members of "GroupA" must have the view right explicitly set either on the given space or on the whole wiki to be able to view the space as well.
175
176 = Further Reading =
177
178 * Permissions management can easily be done using the [[rights management interface>>platform:Features.RightsManagement]]
179 * The "administration interface" is documented in the [[Administration Application>>extensions:Extension.Administration Application]]
180 * You can of course get more information about permission management from {{scm path="xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiRightServiceImpl.java"}}the code itself{{/scm}}.

Get Connected