blob: 3cb7c7bdde0d78040c01824d23bb3f565a791b8c [file] [log] [blame]
Shawn O. Pearcee31d02c2009-12-08 12:21:37 -08001Gerrit Code Review - Access Controls
2====================================
Shawn O. Pearce4b122b82009-02-18 18:22:14 -08003
4Access controls in Gerrit are group based. Every user account is a
5member of one or more groups, and access and privileges are granted
Matt Fischer620255a2011-03-22 14:28:23 -05006to those groups. Access rights cannot be granted to individual
7users.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -08008
9
10System Groups
11-------------
12
Edwin Kempind2605ed2010-10-11 08:02:24 +020013Gerrit comes with 4 system groups, with special access privileges
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080014and membership management. The identity of these groups is set
15in the `system_config` table within the database, so the groups
16can be renamed after installation if desired.
17
Edwin Kempin913eab12011-05-06 08:18:24 +020018[[administrators]]
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080019Administrators
20~~~~~~~~~~~~~~
21
22This is the Gerrit "root" identity.
23
24Users in the 'Administrators' group can perform any action under
25the Admin menu, to any group or project, without further validation
David Pursehouse221d4f62012-06-08 17:38:08 +090026or any other access controls. In most installations only those
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080027users who have direct filesystem and database access would be
28placed into this group.
29
30Membership in the 'Administrators' group does not imply any other
31access rights. Administrators do not automatically get code review
32approval or submit rights in projects. This is a feature designed
Nico Sallembienee6eaf02010-02-01 13:24:49 -080033to permit administrative users to otherwise access Gerrit as any
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080034other normal user would, without needing two different accounts.
35
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010036[[anonymous_users]]
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080037Anonymous Users
38~~~~~~~~~~~~~~~
39
40All users are automatically a member of this group. Users who are
41not signed in are a member of only this group, and no others.
42
43Any access rights assigned to this group are inherited by all users.
44
45Administrators and project owners can grant access rights to this
46group in order to permit anonymous users to view project changes,
47without requiring sign in first. Currently it is only worthwhile
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +010048to grant `Read` access to this group as Gerrit requires an account
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080049identity for all other operations.
50
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010051[[non-interactive_users]]
52Non-Interactive Users
53~~~~~~~~~~~~~~~~~~~~~
54
55This is an internal user group, members of this group are not expected
56to perform interactive operations on the Gerrit web frontend.
57
58However, sometimes such a user may need a separate thread pool in
59order to prevent it from grabbing threads from the interactive users.
60
61These users live in a second thread pool, which separates operations
62made by the non-interactive users from the ones made by the interactive
63users. This ensures that the interactive users can keep working when
64resources are tight.
65
66[[project_owners]]
67Project Owners
68~~~~~~~~~~~~~~
69
70Access rights assigned to this group are always evaluated within the
71context of a project to which the access rights apply. These rights
72therefore apply to all the users who are owners of this project.
73
74By assigning access rights to this group on a parent project Gerrit
75administrators can define a set of default access rights for
Fredrik Luthanderea13ca52011-12-29 11:36:48 +010076<<category_owner,project owners>>. Child projects inherit these
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010077access rights where they are resolved to the users that own the child
78project. Having default access rights for
Fredrik Luthanderea13ca52011-12-29 11:36:48 +010079<<category_owner,project owners>> assigned on a parent project may
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010080avoid the need to initially configure access rights for
81newly created child projects.
82
83[[registered_users]]
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080084Registered Users
85~~~~~~~~~~~~~~~~
86
87All signed-in users are automatically a member of this group (and
Fredrik Luthander54abc352012-01-20 16:18:41 +010088also <<anonymous_users,'Anonymous Users'>>, see above).
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080089
90Any access rights assigned to this group are inherited by all
91users as soon as they sign-in to Gerrit. If OpenID authentication
92is being employed, moving from only 'Anonymous Users' into this
93group is very easy. Caution should be taken when assigning any
94permissions to this group.
95
96It is typical to assign `Code Review -1..+1` to this group,
97allowing signed-in users to vote on a change, but not actually
98cause it to become approved or rejected.
99
100Registered users are always permitted to make and publish comments
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100101on any change in any project they have `Read` access to.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800102
103
104Account Groups
105--------------
106
107Account groups contain a list of zero or more user account members,
108added individually by a group owner. Any user account listed as
109a group member is given any access rights granted to the group.
110
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800111Every group has one other group designated as its owner. Users who
112are members of the owner group can:
113
Fredrik Luthander8fa3d262011-11-07 17:04:01 +0100114* Add users and other groups to this group
115* Remove users and other groups from this group
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800116* Change the name of this group
117* Change the description of this group
118* Change the owner of this group, to another group
119
120It is permissible for a group to own itself, allowing the group
121members to directly manage who their peers are.
122
123Newly created groups are automatically created as owning themselves,
124with the creating user as the only member. This permits the group
125creator to add additional members, and change the owner to another
126group if desired.
127
128It is somewhat common to create two groups at the same time,
129for example `Foo` and `Foo-admin`, where the latter group
130`Foo-admin` owns both itself and also group `Foo`. Users who
131are members of `Foo-admin` can thus control the membership of
132`Foo`, without actually having the access rights granted to `Foo`.
133This configuration can help prevent accidental submits when the
134members of `Foo` have submit rights on a project, and the members of
135`Foo-admin` typically do not need to have such rights.
136
137
138Project Access Control Lists
139----------------------------
140
lincolnfa7bdd32010-04-22 14:23:05 -0300141A system wide access control list affecting all projects is stored in
Shawn O. Pearcea0631822011-06-14 11:18:18 -0700142project "`All-Projects`". This inheritance can be configured
lincolnfa7bdd32010-04-22 14:23:05 -0300143through link:cmd-set-project-parent.html[gerrit set-project-parent].
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800144
145Per-project access control lists are also supported.
146
147Users are permitted to use the maximum range granted to any of their
148groups in an approval category. For example, a user is a member of
149`Foo Leads`, and the following ACLs are granted on a project:
150
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100151[options="header"]
152|=================================================
153|Group |Reference Name |Category|Range
154|Anonymous Users |refs/heads/*|Code Review|-1..+1
155|Registered Users|refs/heads/*|Code Review|-1..+2
156|Foo Leads |refs/heads/*|Code Review|-2..0
157|=================================================
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800158
159Then the effective range permitted to be used by the user is
160`-2..+2`, as the user is a member of all three groups (see above
161about the system groups) and the maximum range is chosen (so the
162lowest value granted to any group, and the highest value granted
163to any group).
164
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800165Reference-level access control is also possible.
166
167Permissions can be set on a single reference name to match one
168branch (e.g. `refs/heads/master`), or on a reference namespace
Edwin Kempina2bf0832011-09-08 14:23:30 +0200169(e.g. `refs/heads/*`) to match any branch starting with that
170prefix. So a permission with `refs/heads/*` will match
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800171`refs/heads/master` and `refs/heads/experimental`, etc.
172
Shawn O. Pearce6d6d4512010-07-15 11:42:34 -0700173Reference names can also be described with a regular expression
Edwin Kempina2bf0832011-09-08 14:23:30 +0200174by prefixing the reference name with `^`. For example
175`^refs/heads/[a-z]{1,8}` matches all lower case branch names
Shawn O. Pearce6d6d4512010-07-15 11:42:34 -0700176between 1 and 8 characters long. Within a regular expression `.`
177is a wildcard matching any character, but may be escaped as `\.`.
Magnus Bäcke5611832011-02-02 08:57:15 +0100178The link:http://www.brics.dk/automaton/[dk.brics.automaton library]
179is used for evaluation of regular expression access control
180rules. See the library documentation for details on this
181particular regular expression flavor.
Shawn O. Pearce6d6d4512010-07-15 11:42:34 -0700182
183References can have the current user name automatically included,
184creating dynamic access controls that change to match the currently
185logged in user. For example to provide a personal sandbox space
Edwin Kempina2bf0832011-09-08 14:23:30 +0200186to all developers, `refs/heads/sandbox/${username}/*` allowing
Shawn O. Pearce6d6d4512010-07-15 11:42:34 -0700187the user 'joe' to use 'refs/heads/sandbox/joe/foo'.
188
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800189When evaluating a reference-level access right, Gerrit will use
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700190the full set of access rights to determine if the user
191is allowed to perform a given action. For example, if a user is a
192member of `Foo Leads`, they are reviewing a change destined for
193the `refs/heads/qa` branch, and the following ACLs are granted
194on the project:
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800195
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100196[options="header"]
Fredrik Luthander54abc352012-01-20 16:18:41 +0100197|===============================================================
198|Group |Reference Name|Category |Range |Exclusive
199|Registered Users |refs/heads/* |Code Review| -1..+1 |
200|Foo Leads |refs/heads/* |Code Review| -2..+2 |
201|QA Leads |refs/heads/qa |Code Review| -2..+2 |
202|===============================================================
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800203
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700204Then the effective range permitted to be used by the user is
205`-2..+2`, as the user's membership of `Foo Leads` effectively grant
206them access to the entire reference space, thanks to the wildcard.
207
208Gerrit also supports exclusive reference-level access control.
209
210It is possible to configure Gerrit to grant an exclusive ref level
211access control so that only users of a specific group can perform
Fredrik Luthander54abc352012-01-20 16:18:41 +0100212an operation on a project/reference pair. This is done by ticking
213the exclusive flag when setting the permission for the
214`refs/heads/qa` branch.
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700215
216For example, if a user who is a member of `Foo Leads` tries to
217review a change destined for branch `refs/heads/qa` in a project,
218and the following ACLs are granted:
219
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100220[options="header"]
Fredrik Luthander54abc352012-01-20 16:18:41 +0100221|==============================================================
222|Group |Reference Name|Category |Range |Exclusive
223|Registered Users|refs/heads/* |Code Review| -1..+1 |
224|Foo Leads |refs/heads/* |Code Review| -2..+2 |
225|QA Leads |refs/heads/qa |Code Review| -2..+2 |X
226|==============================================================
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700227
228Then this user will not have `Code Review` rights on that change,
229since there is an exclusive access right in place for the
230`refs/heads/qa` branch. This allows locking down access for a
231particular branch to a limited set of users, bypassing inherited
232rights and wildcards.
233
234In order to grant the ability to `Code Review` to the members of
235`Foo Leads`, in `refs/heads/qa` then the following access rights
236would be needed:
237
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100238[options="header"]
Fredrik Luthander54abc352012-01-20 16:18:41 +0100239|==============================================================
240|Group |Reference Name|Category |Range |Exclusive
241|Registered Users|refs/heads/* |Code Review| -1..+1 |
242|Foo Leads |refs/heads/* |Code Review| -2..+2 |
243|QA Leads |refs/heads/qa |Code Review| -2..+2 |X
244|Foo Leads |refs/heads/qa |Code Review| -2..+2 |
245|==============================================================
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700246
Shawn O. Pearcea2299662009-02-25 14:34:40 -0800247OpenID Authentication
248~~~~~~~~~~~~~~~~~~~~~
249
250If the Gerrit instance is configured to use OpenID authentication,
251an account's effective group membership will be restricted to only
252the `Anonymous Users` and `Registered Users` groups, unless *all*
253of its OpenID identities match one or more of the patterns listed
Shawn O. Pearced7c026d2009-08-05 20:11:22 -0700254in the `auth.trustedOpenID` list from `gerrit.config`.
Shawn O. Pearcea2299662009-02-25 14:34:40 -0800255
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800256All Projects
257~~~~~~~~~~~~
258
Shawn O. Pearcea0631822011-06-14 11:18:18 -0700259Any access right granted to a group within `All-Projects`
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800260is automatically inherited by every other project in the same
261Gerrit instance. These rights can be seen, but not modified,
262in any other project's `Access` administration tab.
263
Fredrik Luthanderd9960882011-11-08 01:42:19 +0100264Only members of the groups with the `Administrate Server` capability
265may edit the access control list for `All-Projects`. By default this
266capability is given to the group `Administrators`, but can be given
267to more groups.
Shawn O. Pearcee2c2a222010-05-11 13:43:45 -0700268
269Ownership of this project cannot be delegated to another group.
270This restriction is by design. Granting ownership to another
271group gives nearly the same level of access as membership in
272`Administrators` does, as group members would be able to alter
Fredrik Luthanderd9960882011-11-08 01:42:19 +0100273permissions for every managed project including global capabilities.
Shawn O. Pearcee2c2a222010-05-11 13:43:45 -0700274
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800275Per-Project
276~~~~~~~~~~~
277
Fredrik Luthanderda867882011-12-21 18:28:40 +0100278The per-project ACL is evaluated before the global `All-Projects` ACL,
279permitting some limited override capability to project owners. This
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100280behavior is generally only useful on the `Read` category when
281granting 'DENY' within a specific project to deny a group access.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800282
283
Fredrik Luthander1898adb2011-11-10 00:15:09 +0100284[[access_category]]
285Access Categories
286-----------------
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800287
288Gerrit comes pre-configured with several default categories that
289can be granted to groups within projects, enabling functionality
290for that group's members.
291
Fredrik Luthander71267062011-12-21 18:38:45 +0100292With the release of the Gerrit 2.2.x series, the web GUI for ACL
293configuration was rewritten from scratch. Use this
294<<conversion_table,table>> to better understand the access rights
295conversions from the Gerrit 2.1.x to the Gerrit 2.2.x series.
296
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800297
Fredrik Luthander1898adb2011-11-10 00:15:09 +0100298[[category_label-Verified]]
299Label: Verified
300~~~~~~~~~~~~~~~
301
302The verified category is one of two default categories that is
303configured upon the creation of a Gerrit instance. It may have
304any meaning the project desires. It was originally invented by
305the Android Open Source Project to mean
306'compiles, passes basic unit tests'.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800307
308The range of values is:
309
310* -1 Fails
311+
312Tried to compile, but got a compile error, or tried to run tests,
Fredrik Luthander1898adb2011-11-10 00:15:09 +0100313but one or more tests did not pass. This value is valid
314across all patch sets in the same change, i.e. the reviewer must
315actively change his/her review to something else before the change
316is submittable.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800317+
318*Any -1 blocks submit.*
319
320* 0 No score
321+
322Didn't try to perform the verification tasks.
323
324* +1 Verified
325+
326Compiled (and ran tests) successfully.
327+
328*Any +1 enables submit.*
329
Fredrik Luthander1898adb2011-11-10 00:15:09 +0100330For a change to be submittable, the change must have a `+1 Verified`
331in this category from at least one authorized user, and no `-1 Fails`
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800332from an authorized user. Thus, `-1 Fails` can block a submit,
333while `+1 Verified` enables a submit.
334
335If a Gerrit installation does not wish to use this category in any
336project, it can be deleted from the database:
337
338====
339 DELETE FROM approval_categories WHERE category_id = 'VRIF';
340 DELETE FROM approval_category_values WHERE category_id = 'VRIF';
341====
342
343If a Gerrit installation wants to modify the description text
344associated with these category values, the text can be updated
Edwin Kempina2bf0832011-09-08 14:23:30 +0200345in the `name` column of the `category_id = 'VRIF'` rows in the
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800346`approval_category_values` table.
347
348Additional values could also be added to this category, to allow it
349to behave more like `Code Review` (below). Insert -2 and +2 value
350rows into the `approval_category_values` with `category_id` set to
351`VRIF` to get the same behavior.
352
353[NOTE]
354A restart is required after making database changes.
355See <<restart_changes,below>>.
356
Fredrik Luthanderb8686382011-12-08 16:56:03 +0100357[[category_label-Code-Review]]
358Label: Code Review
359~~~~~~~~~~~~~~~~~~
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800360
Fredrik Luthanderb8686382011-12-08 16:56:03 +0100361The code review category is the second of two default categories that
362is configured upon the creation of a Gerrit instance. It may have
363any meaning the project desires. It was originally invented by the
364Android Open Source Project to mean 'I read the code and it seems
365reasonably correct'.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800366
367The range of values is:
368
369* -2 Do not submit
370+
371The code is so horribly incorrect/buggy/broken that it must not be
Fredrik Luthanderb8686382011-12-08 16:56:03 +0100372submitted to this project, or to this branch. This value is valid
373across all patch sets in the same change, i.e. the reviewer must
374actively change his/her review to something else before the change
375is submittable.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800376+
377*Any -2 blocks submit.*
378
379* -1 I would prefer that you didn't submit this
380+
381The code doesn't look right, or could be done differently, but
382the reviewer is willing to live with it as-is if another reviewer
383accepts it, perhaps because it is better than what is currently in
384the project. Often this is also used by contributors who don't like
385the change, but also aren't responsible for the project long-term
386and thus don't have final say on change submission.
387+
388Does not block submit.
389
390* 0 No score
391+
392Didn't try to perform the code review task, or glanced over it but
393don't have an informed opinion yet.
394
395* +1 Looks good to me, but someone else must approve
396+
397The code looks right to this reviewer, but the reviewer doesn't
398have access to the `+2` value for this category. Often this is
399used by contributors to a project who were able to review the change
400and like what it is doing, but don't have final approval over what
401gets submitted.
402
403* +2 Looks good to me, approved
404+
405Basically the same as `+1`, but for those who have final say over
406how the project will develop.
407+
408*Any +2 enables submit.*
409
Fredrik Luthanderb8686382011-12-08 16:56:03 +0100410For a change to be submittable, the latest patch set must have a
411`+2 Looks good to me, approved` in this category from at least one
412authorized user, and no `-2 Do not submit` from an authorized user.
413Thus `-2` on any patch set can block a submit, while `+2` on the
414latest patch set can enable it.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800415
416If a Gerrit installation does not wish to use this category in any
417project, it can be deleted from the database:
418
419====
420 DELETE FROM approval_categories WHERE category_id = 'CRVW';
421 DELETE FROM approval_category_values WHERE category_id = 'CRVW';
422====
423
424If a Gerrit installation wants to modify the description text
425associated with these category values, the text can be updated
Edwin Kempina2bf0832011-09-08 14:23:30 +0200426in the `name` column of the `category_id = 'CRVW'` rows in the
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800427`approval_category_values` table.
428
429Additional values could be inserted into `approval_category_values`
430to further extend the negative and positive range, but there is
431likely little value in doing so as this only expands the middle
432region. This category is a `MaxWithBlock` type, which means that
433the lowest negative value if present blocks a submit, while the
434highest positive value is required to enable submit.
435
Shawn O. Pearce2d524492010-02-22 07:28:14 -0800436[[function_MaxNoBlock]]
Shane Mc Cormack66376d02010-01-29 19:12:58 +0000437There is also a `MaxNoBlock` category which still requires the
438highest positive value to submit, but the lowest negative value will
439not block the change, and does not carry over between patch sets.
440This level is mostly useful for automated code-reviews that may
441have false-negatives that shouldn't block the change.
442
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800443[NOTE]
444A restart is required after making database changes.
445See <<restart_changes,below>>.
446
Chad Horohoe029c85a2012-06-07 16:10:14 -0400447[[category_abandon]]
448Abandon
Edwin Kempin3ff05112012-07-19 14:43:25 +0200449~~~~~~~
Chad Horohoe029c85a2012-06-07 16:10:14 -0400450
451This category controls whether users are allowed to abandon changes
452to projects in Gerrit. It can give permission to abandon a specific
453change to a given ref.
454
Chad Horohoe35ced0a2012-06-27 19:20:34 -0400455This also grants the permission to restore a change if the change
456can be uploaded.
457
Fredrik Luthandere9eeeea2011-12-08 16:45:32 +0100458[[category_create]]
459Create reference
460~~~~~~~~~~~~~~~~
461
462The create reference category controls whether it is possible to
463create new references, branches or tags. This implies that the
464reference must not already exist, it's not a destructive permission
David Pursehouse221d4f62012-06-08 17:38:08 +0900465in that you can't overwrite or remove any previously existing
Fredrik Luthandere9eeeea2011-12-08 16:45:32 +0100466references (and also discard any commits in the process).
467
468It's probably most common to either permit the creation of a single
469branch in many gits (by granting permission on a parent project), or
470to grant this permission to a name pattern of branches.
471
472This permission is often given in conjunction with regular push
473branch permissions, allowing the holder of both to create new branches
474as well as bypass review for new commits on that branch.
475
David Pursehouse221d4f62012-06-08 17:38:08 +0900476To push lightweight (non-annotated) tags, grant
Fredrik Luthandere9eeeea2011-12-08 16:45:32 +0100477`Create Reference` for reference name `refs/tags/*`, as lightweight
478tags are implemented just like branches in Git.
479
480For example, to grant the possibility to create new branches under the
481namespace `foo`, you have to grant this permission on
482`refs/heads/foo/*` for the group that should have it.
483Finally, if you plan to grant each user a personal namespace in
484where they are free to create as many branches as they wish, you
485should grant the create reference permission so it's possible
486to create new branches. This is done by using the special
487`${username}` keyword in the reference pattern, e.g.
488`refs/heads/sandbox/${username}/*`. If you do, it's also recommended
489you grant the users the push force permission to be able to clean up
490stale branches.
491
492
Fredrik Luthander8f430f12011-12-27 13:40:43 +0100493[[category_forge_author]]
494Forge Author
495~~~~~~~~~~~~
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100496
497Normally Gerrit requires the author and the committer identity
498lines in a Git commit object (or tagger line in an annotated tag) to
499match one of the registered email addresses of the uploading user.
Fredrik Luthander8f430f12011-12-27 13:40:43 +0100500This permission allows users to bypass parts of that validation, which
501may be necessary when mirroring changes from an upstream project.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100502
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100503Permits the use of an unverified author line in commit objects.
504This can be useful when applying patches received by email from
5053rd parties, when cherry-picking changes written by others across
506branches, or when amending someone else's commit to fix up a minor
507problem before submitting.
Fredrik Luthander8f430f12011-12-27 13:40:43 +0100508
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100509By default this is granted to `Registered Users` in all projects,
510but a site administrator may disable it if verified authorship
511is required.
512
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100513
Fredrik Luthander8f430f12011-12-27 13:40:43 +0100514[[category_forge_committer]]
515Forge Committer
516~~~~~~~~~~~~~~~
517
518Normally Gerrit requires the author and the committer identity
519lines in a Git commit object (or tagger line in an annotated tag) to
520match one of the registered email addresses of the uploading user.
521This permission allows users to bypass parts of that validation, which
522may be necessary when mirroring changes from an upstream project.
523
524Allows the use of an unverified committer line in commit objects, or an
525unverified tagger line in annotated tag objects. Typically this is only
526required when mirroring commits from an upstream project repository.
527
528
529[[category_forge_server]]
530Forge Server
531~~~~~~~~~~~~
532
533Normally Gerrit requires the author and the committer identity
534lines in a Git commit object (or tagger line in an annotated tag) to
535match one of the registered email addresses of the uploading user.
536This permission allows users to bypass parts of that validation, which
537may be necessary when mirroring changes from an upstream project.
538
539Allows the use of the server's own name and email on the committer
540line of a new commit object. This should only be necessary when force
541pushing a commit history which has been rewritten by 'git filter-branch'
542and that contains merge commits previously created by this Gerrit Code
543Review server.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100544
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100545
546[[category_owner]]
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100547Owner
548~~~~~
549
550The `Owner` category controls which groups can modify the project's
551configuration. Users who are members of an owner group can:
552
553* Change the project description
554* Create/delete a branch through the web UI (not SSH)
555* Grant/revoke any access rights, including `Owner`
556
557Note that project owners implicitly have branch creation or deletion
558through the web UI, but not through SSH. To get SSH branch access
559project owners must grant an access right to a group they are a
560member of, just like for any other user.
561
562Ownership over a particular branch subspace may be delegated by
563entering a branch pattern. To delegate control over all branches
564that begin with `qa/` to the QA group, add `Owner` category
Fredrik Luthandera8b9d212012-10-10 16:05:59 +0200565for reference `refs/heads/qa/*`. Members of the QA group can
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100566further refine access, but only for references that begin with
Fredrik Luthander8fa3d262011-11-07 17:04:01 +0100567`refs/heads/qa/`. See <<project_owners,project owners>> to find
568out more about this role.
569
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100570
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100571[[category_push]]
572Push
573~~~~
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100574
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100575This category controls how users are allowed to upload new commits
576to projects in Gerrit. It can either give permission to push
577directly into a branch, bypassing any code review process
578that would otherwise be used. Or it may give permission to upload
579new changes for code review, this depends on which namespace the
580permission is granted to.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100581
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100582
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100583[[category_push_direct]]
584Direct Push
585^^^^^^^^^^^
586
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100587Any existing branch can be fast-forwarded to a new commit.
Robin Rosenberg524a3032012-10-14 14:24:36 +0200588Creation of new branches is controlled by the
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100589link:access-control.html#category_create['Create Reference']
590category. Deletion of existing branches is rejected. This is the
591safest mode as commits cannot be discarded.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100592
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100593* Force option
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100594+
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100595Allows an existing branch to be deleted. Since a force push is
596effectively a delete immediately followed by a create, but performed
597atomically on the server and logged, this option also permits forced
598push updates to branches. Enabling this option allows existing commits
599to be discarded from a project history.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100600
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100601The push category is primarily useful for projects that only want to
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100602take advantage of Gerrit's access control features and do not need
603its code review functionality. Projects that need to require code
604reviews should not grant this category.
605
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100606
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100607[[category_push_review]]
608Upload To Code Review
609^^^^^^^^^^^^^^^^^^^^^
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100610
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100611The `Push` access right granted on the namespace
612`refs/for/refs/heads/BRANCH` permits the user to upload a non-merge
613commit to the project's `refs/for/BRANCH` namespace, creating a new
614change for code review.
615
616A user must be able to clone or fetch the project in order to create
617a new commit on their local system, so in practice they must also
618have the `Read` access granted to upload a change.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100619
620For an open source, public Gerrit installation, it is common to
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100621grant `Read` and `Push` for `refs/for/refs/heads/*`
622to `Registered Users` in the `All-Projects` ACL. For more
623private installations, its common to simply grant `Read` and
624`Push` for `refs/for/refs/heads/*` to all users of a project.
625
626* Force option
627+
628The force option has no function when granted to a branch in the
629`refs/for/refs/heads/*` namespace.
630
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100631
Fredrik Luthanderbf568572012-01-18 11:17:00 +0100632[[category_push_merge]]
Edwin Kempinaef5d6e2012-01-24 09:04:54 +0100633Push Merge Commits
Fredrik Luthanderbf568572012-01-18 11:17:00 +0100634~~~~~~~~~~~~~~~~~~~~
635
Magnus Bäck282c1022012-04-18 15:39:17 -0400636The `Push Merge Commit` access right permits the user to upload merge
637commits. It's an addon to the <<category_push,Push>> access right, and
638so it won't be sufficient with only `Push Merge Commit` granted for a
639push to happen. Some projects wish to restrict merges to being created
640by Gerrit. By granting `Push` without `Push Merge Commit`, the only
Edwin Kempinaef5d6e2012-01-24 09:04:54 +0100641merges that enter the system will be those created by Gerrit.
Fredrik Luthanderbf568572012-01-18 11:17:00 +0100642
Magnus Bäck282c1022012-04-18 15:39:17 -0400643The reference name connected to a `Push Merge Commit` entry must always
644be prefixed with `refs/for/`, for example `refs/for/refs/heads/BRANCH`.
645This applies even for an entry that complements a `Push` entry for
646`refs/heads/BRANCH` that allows direct pushes of non-merge commits, and
647the intention of the `Push Merge Commit` entry is to allow direct pushes
648of merge commits.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100649
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100650[[category_push_annotated]]
651Push Annotated Tag
652~~~~~~~~~~~~~~~~~~
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100653
David Pursehouse690cebe2012-12-12 19:22:45 +0900654This category permits users to push an annotated tag object into the
655project's repository. Typically this would be done with a command line
656such as:
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100657
658====
659 git push ssh://USER@HOST:PORT/PROJECT tag v1.0
660====
661
David Pursehouse690cebe2012-12-12 19:22:45 +0900662Or:
663
664====
665 git push https://HOST/PROJECT tag v1.0
666====
667
David Pursehouseb429ce12012-12-12 11:04:40 +0900668Tags must be annotated (created with `git tag -a`), should exist in
669the `refs/tags/` namespace, and should be new.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100670
671This category is intended to be used to publish tags when a project
672reaches a stable release point worth remembering in history.
673
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100674It allows for a new annotated (unsigned) tag to be created. The
675tagger email address must be verified for the current user.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100676
677To push tags created by users other than the current user (such
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100678as tags mirrored from an upstream project), `Forge Committer Identity`
679must be also granted in addition to `Push Annotated Tag`.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100680
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100681To push lightweight (non annotated) tags, grant
682<<category_create,`Create Reference`>> for reference name
683`refs/tags/*`, as lightweight tags are implemented just like
684branches in Git.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100685
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100686To delete or overwrite an existing tag, grant `Push` with the force
687option enabled for reference name `refs/tags/*`, as deleting a tag
688requires the same permission as deleting a branch.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100689
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100690
David Pursehouseb429ce12012-12-12 11:04:40 +0900691[[category_push_signed]]
692Push Signed Tag
693~~~~~~~~~~~~~~~
694
David Pursehouse690cebe2012-12-12 19:22:45 +0900695This category permits users to push a PGP signed tag object into the
696project's repository. Typically this would be done with a command
697line such as:
David Pursehouseb429ce12012-12-12 11:04:40 +0900698
699====
700 git push ssh://USER@HOST:PORT/PROJECT tag v1.0
701====
702
David Pursehouse690cebe2012-12-12 19:22:45 +0900703Or:
704
705====
706 git push https://HOST/PROJECT tag v1.0
707====
708
David Pursehouseb429ce12012-12-12 11:04:40 +0900709Tags must be signed (created with `git tag -s`), should exist in the
710`refs/tags/` namespace, and should be new.
711
712
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100713[[category_read]]
714Read
715~~~~
716
717The `Read` category controls visibility to the project's
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100718changes, comments, code diffs, and Git access over SSH or HTTP.
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100719A user must have this access granted in order to see a project, its
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100720changes, or any of its data.
721
722This category has a special behavior, where the per-project ACL is
723evaluated before the global all projects ACL. If the per-project
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100724ACL has granted `Read` with 'DENY', and does not otherwise grant
725`Read` with 'ALLOW', then a `Read` in the all projects ACL
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100726is ignored. This behavior is useful to hide a handful of projects
727on an otherwise public server.
728
729For an open source, public Gerrit installation it is common to grant
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100730`Read` to `Anonymous Users` in the `All-Projects` ACL, enabling
731casual browsing of any project's changes, as well as fetching any
732project's repository over SSH or HTTP. New projects can be
733temporarily hidden from public view by granting `Read` with 'DENY'
734to `Anonymous Users` and granting `Read` to the project owner's
735group within the per-project ACL.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100736
737For a private Gerrit installation using a trusted HTTP authentication
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100738source, granting `Read` to `Registered Users` may be more
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100739typical, enabling read access only to those users who have been
740able to authenticate through the HTTP access controls. This may
741be suitable in a corporate deployment if the HTTP access control
742is already restricted to the correct set of users.
743
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100744
Edwin Kempinfd330fc2012-05-09 21:09:55 +0200745[[category_rebase]]
746Rebase
747~~~~~~
748
749This category permits users to rebase changes via the web UI by pushing
750the `Rebase Change` button.
751
752The change owner and submitters can always rebase changes in the web UI
753(even without having the `Rebase` access right assigned).
754
755Users without this access right who are able to upload new patch sets
756can still do the rebase locally and upload the rebased commit as a new
757patch set.
758
Chad Horohoec626f3c2012-09-13 11:04:20 -0700759[[category_remove_reviewer]]
760Remove Reviewer
761~~~~~~~~~~~~~~~
762
763This category permits users to remove other users from the list of
764reviewers on a change.
765
766The change owner, project owner and site administrator can always
767remove reviewers (even without having the `Remove Reviewer` access
768right assigned).
769
770Users without this access right can only remove themselves from the
771reviewer list on a change.
772
Edwin Kempinfd330fc2012-05-09 21:09:55 +0200773
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100774[[category_submit]]
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800775Submit
776~~~~~~
777
778This category permits users to push the `Submit Patch Set n` button
779on the web UI.
780
781Submitting a change causes it to be merged into the destination
782branch as soon as possible, making it a permanent part of the
783project's history.
784
785In order to submit, all approval categories (such as `Verified` and
786`Code Review`, above) must enable submit, and also must not block it.
787See above for details on each category.
788
Fredrik Luthanderbc75ef72012-01-26 15:57:08 +0100789
David Pursehouse5ae73002012-11-01 15:22:26 +0900790[[category_view_drafts]]
791View Drafts
792~~~~~~~~~~~
793
794This category permits users to view draft changes uploaded by other
795users.
796
797The change owner and any explicitly added reviewers can always see
798draft changes (even without having the `View Drafts` access right
799assigned).
800
801
David Pursehousebe7f4582012-12-12 11:21:29 +0900802[[category_publish_drafts]]
803Publish Drafts
804~~~~~~~~~~~~~~
805
806This category permits users to publish draft changes uploaded by other
807users.
808
809The change owner can always publish draft changes (even without having
810the `Publish Drafts` access right assigned).
811
812
813[[category_delete_drafts]]
814Delete Drafts
815~~~~~~~~~~~~~
816
817This category permits users to delete draft changes uploaded by other
818users.
819
820The change owner can always delete draft changes (even without having
821the `Delete Drafts` access right assigned).
822
823
David Pursehouse59aee362012-11-15 17:25:17 +0900824[[category_edit_topic_name]]
825Edit Topic Name
826~~~~~~~~~~~~~~~
827
828This category permits users to edit the topic name of a change that
829is uploaded for review.
830
831The change owner, branch owners, project owners, and site administrators
832can always edit the topic name (even without having the `Edit Topic Name`
833access right assigned).
834
835
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800836[[category_makeoneup]]
837Your Category Here
838~~~~~~~~~~~~~~~~~~
839
840Gerrit administrators can also make up their own categories.
841
Fredrik Luthander54abc352012-01-20 16:18:41 +0100842See above for descriptions of how <<category_verified,`Verified`>>
843and <<category_review,`Code Review`>> work, and insert your own
844category with `function_name = 'MaxWithBlock'` to get the same
845behavior over your own range of values, in any category you desire.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800846
847Ensure `category_id` is unique within your `approval_categories`
848table. The default values `VRIF` and `CVRF` used for the categories
849described above are simply that, defaults, and have no special
Fredrik Luthander54abc352012-01-20 16:18:41 +0100850meaning to Gerrit.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800851
852The `position` column of `approval_categories` controls which column
853of the 'Approvals' table the category appears in, providing some
854layout control to the administrator.
855
856All `MaxWithBlock` categories must have at least one positive value
857in the `approval_category_values` table, or else submit will never
858be enabled.
859
860To permit blocking submits, ensure a negative value is defined for
861your new category. If you do not wish to have a blocking submit
862level for your category, do not define values less than 0.
863
864Keep in mind that category definitions are currently global to
865the entire Gerrit instance, and affect all projects hosted on it.
866Any change to a category definition affects everyone.
867
868For example, to define a new 3-valued category that behaves exactly
869like `Verified`, but has different names/labels:
870
871====
872 INSERT INTO approval_categories
873 (name
874 ,position
875 ,function_name
876 ,category_id)
877 VALUES
878 ('Copyright Check'
879 ,3
Edwin Kempina164c2d2012-01-10 13:59:46 +0100880 ,'MaxWithBlock'
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800881 ,'copy');
882
883 INSERT INTO approval_category_values
884 (category_id,value,name)
885 VALUES
886 ('copy', -1, 'Do not have copyright');
887
888 INSERT INTO approval_category_values
889 (category_id,value,name)
890 VALUES
891 ('copy', 0, 'No score');
892
893 INSERT INTO approval_category_values
894 (category_id,value,name)
895 VALUES
896 ('copy', 1, 'Copyright clear');
897====
898
899The new column will appear at the end of the table (in position 3),
900and `-1 Do not have copyright` will block submit, while `+1 Copyright
901clear` is required to enable submit.
902
Chris Harris63c7cdd2012-11-23 12:17:36 -0500903link:config-gerrit.html#commentlink[Comment link] processing is applied to the
904text description of the approval categories (the `name` column). This can be
905used to display HTML links in the approval category value descriptions.
906
Edwin Kempin7dcd1052012-03-22 16:04:13 +0100907[[restart_changes]]
908[NOTE]
909Restart the Gerrit web application and reload all browsers after
910making any database changes to approval categories. Browsers are
911sent the list of known categories when they first visit the site,
912and don't notice changes until the page is closed and opened again,
913or is reloaded.
914
Fredrik Luthander71267062011-12-21 18:38:45 +0100915
Fredrik Luthanderbc75ef72012-01-26 15:57:08 +0100916Examples of typical roles in a project
917--------------------------------------
918
919Below follows a set of typical roles on a server and which access
920rights these roles typically should be granted. You may see them as
David Pursehouse221d4f62012-06-08 17:38:08 +0900921general guidelines for a typical way to set up your project on a
Fredrik Luthanderbc75ef72012-01-26 15:57:08 +0100922brand new Gerrit instance.
923
924[[examples_contributor]]
925Contributor
926~~~~~~~~~~~
927
928This is the typical user on a public server. They are able to read
929your project and upload new changes to it. They are able to give
930feedback on other changes as well, but are unable to block or approve
931any changes.
932
933Suggested access rights to grant:
934
935* <<category_read,`Read`>> on 'refs/heads/\*' and 'refs/tags/*'
Fredrik Luthander404a2852012-10-10 08:51:22 +0200936* <<category_push,`Push`>> to 'refs/for/refs/heads/*'
937* <<category_label-Code-Review,`Code review`>> with range '-1' to '+1' for 'refs/heads/*'
Fredrik Luthanderbc75ef72012-01-26 15:57:08 +0100938
939
Fredrik Luthander654161c2012-01-31 14:42:36 +0100940[[examples_developer]]
941Developer
942~~~~~~~~~
943
944This is the typical core developer on a public server. They are able
945to read the project, upload changes to a branch. They are allowed to
946push merge commits to merge branches together. Also, they are allowed
947to forge author identity, thus handling commits belonging to others
948than themselves, effectively allowing them to transfer commits
949between different branches.
950
951They are furthermore able to code review and verify commits, and
952eventually submit them. If you have an automated CI system that
953builds all uploaded patch sets you might want to skip the
954verification rights for the developer and let the CI system do that
955exclusively.
956
957Suggested access rights to grant:
958
959* <<category_read,`Read`>> on 'refs/heads/\*' and 'refs/tags/*'
Fredrik Luthander404a2852012-10-10 08:51:22 +0200960* <<category_push,`Push`>> to 'refs/for/refs/heads/*'
961* <<category_push_merge,`Push merge commit`>> to 'refs/for/refs/heads/*'
962* <<category_forge_author,`Forge Author Identity`>> to 'refs/heads/*'
963* <<category_label-Code-Review,`Label: Code review`>> with range '-2' to '+2' for 'refs/heads/*'
964* <<category_label-Verified,`Label: Verify`>> with range '-1' to '+1' for 'refs/heads/*'
Fredrik Luthander654161c2012-01-31 14:42:36 +0100965* <<category_submit,`Submit`>>
966
967If the project is small or the developers are seasoned it might make
968sense to give them the freedom to push commits directly to a branch.
969
970Optional access rights to grant:
971
972* <<category_push,`Push`>> to 'refs/heads/*'
973* <<category_push_merge,`Push merge commit`>> to 'refs/heads/*'
974
975
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100976[[examples_cisystem]]
977CI system
978~~~~~~~~~
979
980A typical Continous Integration system should be able to download new changes
981to build and then leave a verdict somehow.
982
983As an example, the popular
984link:https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger[gerrit-trigger plugin]
985for Jenkins/Hudson can set labels at:
986
987* The start of a build
988* A successful build
989* An unstable build (tests fails)
990* A failed build
991
992Usually the range chosen for this verdict is the verify label. Depending on
993the size of your project and discipline of involved developers you might want
994to limit access right to the +1 `Verify` label to the CI system only. That
995way it's guaranteed that submitted commits always get built and pass tests
996successfully.
997
998If the build doesn't complete successfully the CI system can set the
999`Verify` label to -1. However that means that a failed build will block
1000submit of the change even if someone else sets `Verify` +1. Depending on the
1001project and how much the CI system can be trusted for accurate results, a
1002blocking label might not be feasible. A recommended alternative is to set the
1003label `Code-review` to -1 instead, as it isn't a blocking label but still
David Pursehouse221d4f62012-06-08 17:38:08 +09001004shows a red label in the Gerrit UI. Optionally, to enable the possibility to
1005deliver different results (build error vs unstable for instance), it's also
Fredrik Luthanderf2105be2012-01-27 12:44:05 +01001006possible to set `Code-review` +1 as well.
1007
Edwin Kempina2e13cf2012-03-30 09:02:36 +02001008If pushing new changes is granted, it's possible to automate cherry-pick of
Fredrik Luthanderf2105be2012-01-27 12:44:05 +01001009submitted changes for upload to other branches under certain conditions. This
1010is probably not the first step of what a project wants to automate however,
1011and so the push right can be found under the optional section.
1012
1013Suggested access rights to grant, that won't block changes:
1014
1015* <<category_read,`Read`>> on 'refs/heads/\*' and 'refs/tags/*'
Fredrik Luthander404a2852012-10-10 08:51:22 +02001016* <<category_label-Code-Review,`Label: Code review`>> with range '-1' to '0' for 'refs/heads/*'
1017* <<category_label-Verified,`Label: Verify`>> with range '0' to '+1' for 'refs/heads/*'
Fredrik Luthanderf2105be2012-01-27 12:44:05 +01001018
1019Optional access rights to grant:
1020
Fredrik Luthander404a2852012-10-10 08:51:22 +02001021* <<category_label-Code-Review,`Label: Code review`>> with range '-1' to '+1' for 'refs/heads/*'
1022* <<category_push,`Push`>> to 'refs/for/refs/heads/*'
Fredrik Luthanderf2105be2012-01-27 12:44:05 +01001023
1024
Fredrik Luthanderfe720022012-03-22 17:29:39 +01001025[[examples_integrator]]
1026Integrator
1027~~~~~~~~~~
1028
1029Integrators are like developers but with some additional rights granted due
1030to their administrative role in a project. They can upload or push any commit
1031with any committer email (not just their own) and they can also create new
1032tags and branches.
1033
1034Suggested access rights to grant:
1035
1036* <<examples_developer,Developer rights>>
1037* <<category_push,`Push`>> to 'refs/heads/*'
1038* <<category_push_merge,`Push merge commit`>> to 'refs/heads/*'
Fredrik Luthander404a2852012-10-10 08:51:22 +02001039* <<category_forge_committer,`Forge Committer Identity`>> to 'refs/for/refs/heads/*'
Fredrik Luthanderfe720022012-03-22 17:29:39 +01001040* <<category_create,`Create Reference`>> to 'refs/heads/*'
1041* <<category_push_annotated,`Push Annotated Tag`>> to 'refs/tags/*'
1042
1043
Fredrik Luthander9c645362012-03-22 18:10:42 +01001044[[examples_project-owner]]
1045Project owner
1046~~~~~~~~~~~~~
1047
1048The project owner is almost like an integrator but with additional destructive
1049power in the form of being able to delete branches. Optionally these users
1050also have the power to configure access rights in gits assigned to them.
1051
1052[WARNING]
1053These users should be really knowledgable about git, for instance knowing why
1054tags never should be removed from a server. This role is granted potentially
1055destructive access rights and cleaning up after such a mishap could be time
1056consuming!
1057
1058Suggested access rights to grant:
1059
1060* <<examples_integrator,Integrator rights>>
1061* <<category_push,`Push`>> with the force option to 'refs/heads/\*' and 'refs/tags/*'
1062
1063Optional access right to grant:
1064
1065* <<category_owner,`Owner`>> in the gits they mostly work with.
1066
Fredrik Luthander5a8e7d82012-03-22 17:29:39 +01001067[[examples_administrator]]
1068Administrator
1069~~~~~~~~~~~~~
1070
1071The administrator role is the most powerful role known in the Gerrit universe.
1072This role may grant itself (or others) any access right, and it already has
1073all capabilities granted as well. By default the
1074<<administrators,`Administrators` group>> is the group that has this role.
1075
1076Mandatory access rights:
1077
1078* <<capability_administrateServer,The `Administrate Server` capability>>
1079
1080Suggested access rights to grant:
1081
1082* <<examples_project-owner,Project owner rights>>
1083
Sasa Zivkovd589f462013-02-12 14:27:09 +01001084Enforcing site wide access policies
1085-----------------------------------
1086
1087By granting the <<category_owner,`Owner`>> access right on the `refs/*` to a
1088group, Gerrit administrators can delegate the responsibility of maintaining
1089access rights for that project to that group.
1090
1091In a corporate deployment it is often necessary to enforce some access
1092policies. An example could be that no-one can update or delete a tag, not even
1093the project owners. The 'ALLOW' and 'DENY' rules are not enough for this
1094purpose as project owners can grant themselves any access right they wish and,
1095thus, effectively override any inherited access rights from the
1096"`All-Projects`" or some other common parent project.
1097
1098What is needed is a mechanism to block a permission in a parent project so
1099that even project owners cannot allow a blocked permission in their child
1100project. Still, project owners should retain the possibility to manage all
1101non-blocked rules as they wish. This gives best of both worlds:
1102
1103* Gerrit administrators can concentrate on enforcing site wide policies
1104 and providing a meaningful set of default access permissions
1105* Project owners can manage access rights of their projects without a danger
1106 of violating a site wide policy
1107
1108'BLOCK' access rule
1109~~~~~~~~~~~~~~~~~~~
1110
1111The 'BLOCK' rule blocks a permission globally. An inherited 'BLOCK' rule cannot
1112be overridden in the inheriting project. Any 'ALLOW' rule which conflicts with
1113an inherited 'BLOCK' rule will not be honored. Searching for 'BLOCK' rules, in
1114the chain of parent projects, ignores the Exclusive flag that is normally
1115applied to access sections.
1116
1117A 'BLOCK' rule that blocks the 'push' permission blocks any type of push,
1118force or not. A blocking force push rule blocks only force pushes, but
1119allows non-forced pushes if an 'ALLOW' rule would have permitted it.
1120
1121It is also possible to block label ranges. To block a group 'X' from voting
1122'-2' and '+2', but keep their existing voting permissions for the '-1..+1'
1123range intact we would define:
1124
1125====
1126 [access "refs/heads/*"]
1127 label-Code-Review = block -2..+2 group X
1128====
1129
1130The interpretation of the 'min..max' range in case of a blocking rule is: block
1131every vote from '-INFINITE..min' and 'max..INFINITE'. For the example above it
1132means that the range '-1..+1' is not affected by this block.
1133
1134Examples
1135~~~~~~~~
1136
1137The following examples show some possible use cases for the 'BLOCK' rules.
1138
1139Make sure no one can update or delete a tag
1140^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1141
1142This requirement is quite common in a corporate deployment where
1143reproducibility of a build must be guaranteed. To achieve that we block 'push'
1144permission for the <<anonymous_users,'Anonymous Users'>> in "`All-Projects`":
1145
1146====
1147 [access "refs/tags/*"]
1148 push = block group Anonymous Users
1149====
1150
1151By blocking the <<anonymous_users,'Anonymous Users'>> we effectively block
1152everyone as everyone is a member of that group. Note that the permission to
1153create a tag is still necessary. Assuming that only <<category_owner,project
1154owners>> are allowed to create tags, we would extend the example above:
1155
1156====
1157 [access "refs/tags/*"]
1158 push = block group Anonymous Users
1159 create = group Project Owners
1160 pushTag = group Project Owners
1161====
Fredrik Luthander9c645362012-03-22 18:10:42 +01001162
Fredrik Luthander71267062011-12-21 18:38:45 +01001163[[conversion_table]]
1164Conversion table from 2.1.x series to 2.2.x series
1165--------------------------------------------------
1166
1167[options="header"]
1168|=================================================================================
1169|Gerrit 2.1.x |Gerrit 2.2.x
Fredrik Luthanderb7bd7e42012-01-23 16:01:37 +01001170|Code review |<<category_label-Code-Review,Label: Code review>>
1171|Verify |<<category_label-Verified,Label: Verify>>
1172|Forge Identity +1 |Forge <<category_forge_author,author>> identity
1173|Forge Identity +2 |Forge <<category_forge_committer,committer>> & <<category_forge_author,author>> identity
1174|Forge Identity +3 |Forge <<category_forge_server,server>> & <<category_forge_committer,committer>> & <<category_forge_author,author>> identity
1175|Owner |<<category_owner,Owner>>
1176|Push branch +1 |<<category_push_direct,Push>>
1177|Push branch +2 |<<category_create,Create reference>> & <<category_push_direct,Push>>
1178|Push branch +3 |<<category_push_direct,Push>> (with force) & <<category_create,Create reference>>
Fredrik Luthander71267062011-12-21 18:38:45 +01001179|Push tag +1 & Push Branch +2 |No support to limit to push signed tag
Fredrik Luthanderb7bd7e42012-01-23 16:01:37 +01001180|Push tag +2 & Push Branch +2 |<<category_push_annotated,Push annotated tag>>
1181|Push Branch +2 (refs/tags/*) |<<category_create,Create reference>> (refs/tags/...)
1182|Push Branch +3 (refs/tags/*) |<<category_push_direct,Push>> (with force on refs/tags/...)
1183|Read +1 |<<category_read,Read>>
1184|Read +2 |<<category_read,Read>> & <<category_push_review,Push>> (refs/for/refs/...)
Edwin Kempinaef5d6e2012-01-24 09:04:54 +01001185|Read +3 |<<category_read,Read>> & <<category_push_review,Push>> (refs/for/refs/...) & <<category_push_merge,Push Merge Commit>>
Fredrik Luthanderb7bd7e42012-01-23 16:01:37 +01001186|Submit |<<category_submit,Submit>>
Fredrik Luthander71267062011-12-21 18:38:45 +01001187|=================================================================================
1188
Fredrik Luthanderb7bd7e42012-01-23 16:01:37 +01001189
Fredrik Luthander71267062011-12-21 18:38:45 +01001190[NOTE]
1191In Gerrit 2.2.x, the way to set permissions for upload has changed entirely.
1192To upload a change for review is no longer a separate permission type,
1193instead you grant ordinary push permissions to the actual
1194recieving reference. In practice this means that you set push permissions
1195on `refs/for/refs/heads/<branch>` rather than permissions to upload changes
1196on `refs/heads/<branch>`.
1197
Fredrik Luthander80ebf9d2012-02-13 09:32:43 +01001198
1199System capabilities
1200-------------------
1201
1202The system capabilities control actions that the administrators of
1203the server can perform which usually affect the entire
1204server in some way. The administrators may delegate these
1205capabilities to trusted groups of users.
1206
1207Delegation of capabilities allows groups to be granted a subset of
1208administrative capabilities without being given complete
1209administrative control of the server. This makes it possible to
1210keep fewer users in the administrators group, even while spreading
1211much of the server administration burden out to more users.
1212
1213Below you find a list of capabilities available:
1214
1215
Fredrik Luthander426885f2012-02-13 09:56:57 +01001216[[capability_administrateServer]]
1217Administrate Server
1218~~~~~~~~~~~~~~~~~~~
1219
1220This is in effect the owner and administrator role of the Gerrit
1221instance. Any members of a group granted this capability will be
1222able to grant any access right to any group. They will also have all
1223capabilities granted to them automatically.
1224
1225
Fredrik Luthanderb02afca2012-02-13 09:59:48 +01001226[[capability_createAccount]]
1227Create Account
1228~~~~~~~~~~~~~~
1229
Fredrik Luthander79d38152012-03-13 09:52:22 +01001230Allow link:cmd-create-account.html[account creation over the ssh prompt].
Fredrik Luthanderb02afca2012-02-13 09:59:48 +01001231This capability allows the granted group members to create non-interactive
1232service accounts. These service accounts are generally used for automation
1233and made to be members of the
1234link:access-control.html#non-interactive_users['Non-Interactive users'] group.
1235
1236
Fredrik Luthander79d38152012-03-13 09:52:22 +01001237[[capability_createGroup]]
1238Create Group
1239~~~~~~~~~~~~
1240
1241Allow group creation. Groups are used to grant users access to different
1242actions in projects. This capability allows the granted group members to
1243either link:cmd-create-group.html[create new groups via ssh] or via the web UI.
1244
1245
1246[[capability_createProject]]
1247Create Project
1248~~~~~~~~~~~~~~
1249
1250Allow project creation. This capability allows the granted group to
1251either link:cmd-create-project.html[create new git projects via ssh]
1252or via the web UI.
1253
Sasa Zivkov812f4892012-06-21 16:25:21 +02001254[[capability_emailReviewers]]
1255Email Reviewers
1256~~~~~~~~~~~~~~~
1257
1258Allow or deny sending email to change reviewers and watchers. This can be used
1259to deny build bots from emailing reviewers and people who watch the change.
1260Instead, only the authors of the change and those who starred it will be
1261emailed. The allow rules are evaluated before deny rules, however the default
1262is to allow emailing, if no explicit rule is matched.
Fredrik Luthander79d38152012-03-13 09:52:22 +01001263
Fredrik Luthander74ad0d02012-03-13 13:06:30 +01001264[[capability_flushCaches]]
1265Flush Caches
1266~~~~~~~~~~~~
1267
Fredrik Luthander48603002012-03-21 18:17:17 +01001268Allow the flushing of Gerrit's caches. This capability allows the granted
Fredrik Luthander74ad0d02012-03-13 13:06:30 +01001269group to link:cmd-flush-caches.html[flush some or all Gerrit caches via ssh].
1270
1271[NOTE]
1272This capability doesn't imply permissions to the show-caches command. For that
1273you need the <<capability_viewCaches,view caches capability>>.
1274
1275
Fredrik Luthander46843022012-03-13 16:11:02 +01001276[[capability_kill]]
1277Kill Task
1278~~~~~~~~~
1279
1280Allow the operation of the link:cmd-kill.html[kill command over ssh]. The
1281kill command ends tasks that currently occupy the Gerrit server, usually
1282a replication task or a user initiated task such as an upload-pack or
1283recieve-pack.
1284
1285
1286[[capability_priority]]
1287Priority
1288~~~~~~~~
1289
1290This capability allows users to use
1291link:config-gerrit.html#sshd.batchThreads[the thread pool reserved] for
1292link:access-control.html#non-interactive_users['Non-Interactive Users'].
1293It's a binary value in that granted users either have access to the thread
1294pool, or they don't.
1295
1296There are three modes for this capability and they're listed by rising
1297priority:
1298
1299No capability configured.::
1300The user isn't a member of a group with any priority capability granted. By
1301default the user is then in the 'INTERACTIVE' thread pool.
1302
1303'BATCH'::
1304If there's a thread pool configured for 'Non-Interactive Users' and a user is
1305granted the priority capability with the 'BATCH' mode selected, the user ends
1306up in the separate batch user thread pool. This is true unless the user is
1307also granted the below 'INTERACTIVE' option.
1308
1309'INTERACTIVE'::
1310If a user is granted the priority capability with the 'INTERACTIVE' option,
1311regardless if they also have the 'BATCH' option or not, they are in the
1312'INTERACTIVE' thread pool.
1313
1314
Fredrik Luthander80ebf9d2012-02-13 09:32:43 +01001315[[capability_queryLimit]]
1316Query Limit
1317~~~~~~~~~~~
1318
1319Allow site administrators to configure the query limit for users to
1320be above the default hard-coded value of 500. Administrators can add
1321a global block to `All-Projects` with group(s) that
1322should have different limits:
1323
1324When applying a query limit to a user the largest value granted by
1325any of their groups is used.
1326
1327This limit applies not only to the link:cmd-query.html[`gerrit query`]
1328command, but also to the web UI results pagination size.
1329
1330
Chad Horohoeabd6d4e2013-02-14 16:27:34 -05001331[[capability_accessDatabase]]
1332Access Database
1333~~~~~~~~~~~~~~~
1334
1335Allow users to access the database using the `gsql` command.
1336
1337
Fredrik Luthander9c7da662012-03-13 17:49:27 +01001338[[capability_startReplication]]
1339Start Replication
1340~~~~~~~~~~~~~~~~~
1341
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -07001342Allow access to execute `replication start` command, if the
1343replication plugin is installed on the server.
Fredrik Luthander9c7da662012-03-13 17:49:27 +01001344
1345
1346[[capability_viewCaches]]
1347View Caches
1348~~~~~~~~~~~
1349
Fredrik Luthander48603002012-03-21 18:17:17 +01001350Allow querying for status of Gerrit's internal caches. This capability allows
Fredrik Luthander9c7da662012-03-13 17:49:27 +01001351the granted group to
1352link:cmd-show-caches.html[look at some or all Gerrit caches via ssh].
1353
1354
Fredrik Luthander48603002012-03-21 18:17:17 +01001355[[capability_viewConnections]]
1356View Connections
1357~~~~~~~~~~~~~~~~
1358
1359Allow querying for status of Gerrit's current client connections. This
1360capability allows the granted group to
1361link:cmd-show-connections.html[look at Gerrit's current connections via ssh].
1362
1363
1364[[capability_viewQueue]]
1365View Queue
1366~~~~~~~~~~
1367
1368Allow querying for status of Gerrit's internal task queue. This capability
1369allows the granted group to
1370link:cmd-show-queue.html[look at the Gerrit task queue via ssh].
1371
1372
Shawn O. Pearce5500e692009-05-28 15:55:01 -07001373GERRIT
1374------
1375Part of link:index.html[Gerrit Code Review]