blob: f1e0ca38ad20e353f9ff373c868aa08fa0ec1703 [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
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +020018
Edwin Kempin913eab12011-05-06 08:18:24 +020019[[administrators]]
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080020Administrators
21~~~~~~~~~~~~~~
22
23This is the Gerrit "root" identity.
24
25Users in the 'Administrators' group can perform any action under
26the Admin menu, to any group or project, without further validation
David Pursehouse221d4f62012-06-08 17:38:08 +090027or any other access controls. In most installations only those
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080028users who have direct filesystem and database access would be
29placed into this group.
30
31Membership in the 'Administrators' group does not imply any other
32access rights. Administrators do not automatically get code review
33approval or submit rights in projects. This is a feature designed
Nico Sallembienee6eaf02010-02-01 13:24:49 -080034to permit administrative users to otherwise access Gerrit as any
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080035other normal user would, without needing two different accounts.
36
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +020037
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010038[[anonymous_users]]
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080039Anonymous Users
40~~~~~~~~~~~~~~~
41
42All users are automatically a member of this group. Users who are
43not signed in are a member of only this group, and no others.
44
45Any access rights assigned to this group are inherited by all users.
46
47Administrators and project owners can grant access rights to this
48group in order to permit anonymous users to view project changes,
49without requiring sign in first. Currently it is only worthwhile
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +010050to grant `Read` access to this group as Gerrit requires an account
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080051identity for all other operations.
52
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +020053
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010054[[non-interactive_users]]
55Non-Interactive Users
56~~~~~~~~~~~~~~~~~~~~~
57
58This is an internal user group, members of this group are not expected
Gustaf Lundha28a1d22013-05-08 15:05:12 +010059to perform interactive operations on the Gerrit web front-end.
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010060
61However, sometimes such a user may need a separate thread pool in
62order to prevent it from grabbing threads from the interactive users.
63
64These users live in a second thread pool, which separates operations
65made by the non-interactive users from the ones made by the interactive
66users. This ensures that the interactive users can keep working when
67resources are tight.
68
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +020069
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010070[[project_owners]]
71Project Owners
72~~~~~~~~~~~~~~
73
74Access rights assigned to this group are always evaluated within the
75context of a project to which the access rights apply. These rights
76therefore apply to all the users who are owners of this project.
77
78By assigning access rights to this group on a parent project Gerrit
79administrators can define a set of default access rights for
Fredrik Luthanderea13ca52011-12-29 11:36:48 +010080<<category_owner,project owners>>. Child projects inherit these
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010081access rights where they are resolved to the users that own the child
82project. Having default access rights for
Fredrik Luthanderea13ca52011-12-29 11:36:48 +010083<<category_owner,project owners>> assigned on a parent project may
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010084avoid the need to initially configure access rights for
85newly created child projects.
86
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +020087
Fredrik Luthander8fa3d262011-11-07 17:04:01 +010088[[registered_users]]
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080089Registered Users
90~~~~~~~~~~~~~~~~
91
92All signed-in users are automatically a member of this group (and
Fredrik Luthander54abc352012-01-20 16:18:41 +010093also <<anonymous_users,'Anonymous Users'>>, see above).
Shawn O. Pearce4b122b82009-02-18 18:22:14 -080094
95Any access rights assigned to this group are inherited by all
96users as soon as they sign-in to Gerrit. If OpenID authentication
97is being employed, moving from only 'Anonymous Users' into this
98group is very easy. Caution should be taken when assigning any
99permissions to this group.
100
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800101It is typical to assign `Code-Review -1..+1` to this group,
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800102allowing signed-in users to vote on a change, but not actually
103cause it to become approved or rejected.
104
105Registered users are always permitted to make and publish comments
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100106on any change in any project they have `Read` access to.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800107
108
109Account Groups
110--------------
111
112Account groups contain a list of zero or more user account members,
113added individually by a group owner. Any user account listed as
114a group member is given any access rights granted to the group.
115
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800116Every group has one other group designated as its owner. Users who
117are members of the owner group can:
118
Fredrik Luthander8fa3d262011-11-07 17:04:01 +0100119* Add users and other groups to this group
120* Remove users and other groups from this group
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800121* Change the name of this group
122* Change the description of this group
123* Change the owner of this group, to another group
124
125It is permissible for a group to own itself, allowing the group
126members to directly manage who their peers are.
127
128Newly created groups are automatically created as owning themselves,
129with the creating user as the only member. This permits the group
130creator to add additional members, and change the owner to another
131group if desired.
132
133It is somewhat common to create two groups at the same time,
134for example `Foo` and `Foo-admin`, where the latter group
135`Foo-admin` owns both itself and also group `Foo`. Users who
136are members of `Foo-admin` can thus control the membership of
137`Foo`, without actually having the access rights granted to `Foo`.
138This configuration can help prevent accidental submits when the
139members of `Foo` have submit rights on a project, and the members of
140`Foo-admin` typically do not need to have such rights.
141
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200142
Thanh Ha6eed43f2013-04-11 21:03:55 -0400143[[ldap_groups]]
144LDAP Groups
145-----------
146
147LDAP groups are Account Groups that are maintained inside of your
148LDAP instance. If you are using LDAP to manage your groups they will
149not appear in the Groups list. However you can use them just like
150regular Account Groups by prefixing your group with "ldap/" in the
151Access Control for a project. For example "ldap/foo-project" will
152add the LDAP "foo-project" group to the access list.
153
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800154
155Project Access Control Lists
156----------------------------
157
lincolnfa7bdd32010-04-22 14:23:05 -0300158A system wide access control list affecting all projects is stored in
Shawn O. Pearcea0631822011-06-14 11:18:18 -0700159project "`All-Projects`". This inheritance can be configured
lincolnfa7bdd32010-04-22 14:23:05 -0300160through link:cmd-set-project-parent.html[gerrit set-project-parent].
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800161
162Per-project access control lists are also supported.
163
164Users are permitted to use the maximum range granted to any of their
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800165groups on a label. For example, a user is a member of `Foo Leads`, and
166the following ACLs are granted on a project:
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800167
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100168[options="header"]
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800169|===================================================
170|Group |Reference Name |Label |Range
171|Anonymous Users |refs/heads/* |Code-Review|-1..+1
172|Registered Users|refs/heads/* |Code-Review|-1..+2
173|Foo Leads |refs/heads/* |Code-Review|-2..0
174|===================================================
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800175
176Then the effective range permitted to be used by the user is
177`-2..+2`, as the user is a member of all three groups (see above
178about the system groups) and the maximum range is chosen (so the
179lowest value granted to any group, and the highest value granted
180to any group).
181
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800182Reference-level access control is also possible.
183
184Permissions can be set on a single reference name to match one
185branch (e.g. `refs/heads/master`), or on a reference namespace
Edwin Kempina2bf0832011-09-08 14:23:30 +0200186(e.g. `refs/heads/*`) to match any branch starting with that
187prefix. So a permission with `refs/heads/*` will match
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800188`refs/heads/master` and `refs/heads/experimental`, etc.
189
Shawn O. Pearce6d6d4512010-07-15 11:42:34 -0700190Reference names can also be described with a regular expression
Edwin Kempina2bf0832011-09-08 14:23:30 +0200191by prefixing the reference name with `^`. For example
192`^refs/heads/[a-z]{1,8}` matches all lower case branch names
Shawn O. Pearce6d6d4512010-07-15 11:42:34 -0700193between 1 and 8 characters long. Within a regular expression `.`
194is a wildcard matching any character, but may be escaped as `\.`.
Magnus Bäcke5611832011-02-02 08:57:15 +0100195The link:http://www.brics.dk/automaton/[dk.brics.automaton library]
196is used for evaluation of regular expression access control
197rules. See the library documentation for details on this
198particular regular expression flavor.
Shawn O. Pearce6d6d4512010-07-15 11:42:34 -0700199
200References can have the current user name automatically included,
201creating dynamic access controls that change to match the currently
202logged in user. For example to provide a personal sandbox space
Edwin Kempina2bf0832011-09-08 14:23:30 +0200203to all developers, `refs/heads/sandbox/${username}/*` allowing
Shawn O. Pearce6d6d4512010-07-15 11:42:34 -0700204the user 'joe' to use 'refs/heads/sandbox/joe/foo'.
205
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800206When evaluating a reference-level access right, Gerrit will use
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700207the full set of access rights to determine if the user
208is allowed to perform a given action. For example, if a user is a
209member of `Foo Leads`, they are reviewing a change destined for
210the `refs/heads/qa` branch, and the following ACLs are granted
211on the project:
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800212
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100213[options="header"]
Fredrik Luthander54abc352012-01-20 16:18:41 +0100214|===============================================================
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800215|Group |Reference Name|Label |Range |Exclusive
216|Registered Users |refs/heads/* |Code-Review| -1..+1 |
217|Foo Leads |refs/heads/* |Code-Review| -2..+2 |
218|QA Leads |refs/heads/qa |Code-Review| -2..+2 |
Fredrik Luthander54abc352012-01-20 16:18:41 +0100219|===============================================================
Nico Sallembienee6eaf02010-02-01 13:24:49 -0800220
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700221Then the effective range permitted to be used by the user is
222`-2..+2`, as the user's membership of `Foo Leads` effectively grant
223them access to the entire reference space, thanks to the wildcard.
224
225Gerrit also supports exclusive reference-level access control.
226
227It is possible to configure Gerrit to grant an exclusive ref level
228access control so that only users of a specific group can perform
Fredrik Luthander54abc352012-01-20 16:18:41 +0100229an operation on a project/reference pair. This is done by ticking
230the exclusive flag when setting the permission for the
231`refs/heads/qa` branch.
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700232
233For example, if a user who is a member of `Foo Leads` tries to
234review a change destined for branch `refs/heads/qa` in a project,
235and the following ACLs are granted:
236
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100237[options="header"]
Fredrik Luthander54abc352012-01-20 16:18:41 +0100238|==============================================================
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800239|Group |Reference Name|Label |Range |Exclusive
240|Registered Users|refs/heads/* |Code-Review| -1..+1 |
241|Foo Leads |refs/heads/* |Code-Review| -2..+2 |
242|QA Leads |refs/heads/qa |Code-Review| -2..+2 |X
Fredrik Luthander54abc352012-01-20 16:18:41 +0100243|==============================================================
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700244
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800245Then this user will not have `Code-Review` rights on that change,
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700246since there is an exclusive access right in place for the
247`refs/heads/qa` branch. This allows locking down access for a
248particular branch to a limited set of users, bypassing inherited
249rights and wildcards.
250
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800251In order to grant the ability to `Code-Review` to the members of
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700252`Foo Leads`, in `refs/heads/qa` then the following access rights
253would be needed:
254
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100255[options="header"]
Fredrik Luthander54abc352012-01-20 16:18:41 +0100256|==============================================================
257|Group |Reference Name|Category |Range |Exclusive
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800258|Registered Users|refs/heads/* |Code-Review| -1..+1 |
259|Foo Leads |refs/heads/* |Code-Review| -2..+2 |
260|QA Leads |refs/heads/qa |Code-Review| -2..+2 |X
261|Foo Leads |refs/heads/qa |Code-Review| -2..+2 |
Fredrik Luthander54abc352012-01-20 16:18:41 +0100262|==============================================================
Nico Sallembiena78a37c2010-05-04 11:49:12 -0700263
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200264
Shawn O. Pearcea2299662009-02-25 14:34:40 -0800265OpenID Authentication
266~~~~~~~~~~~~~~~~~~~~~
267
268If the Gerrit instance is configured to use OpenID authentication,
269an account's effective group membership will be restricted to only
270the `Anonymous Users` and `Registered Users` groups, unless *all*
271of its OpenID identities match one or more of the patterns listed
Shawn O. Pearced7c026d2009-08-05 20:11:22 -0700272in the `auth.trustedOpenID` list from `gerrit.config`.
Shawn O. Pearcea2299662009-02-25 14:34:40 -0800273
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200274
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800275All Projects
276~~~~~~~~~~~~
277
Shawn O. Pearcea0631822011-06-14 11:18:18 -0700278Any access right granted to a group within `All-Projects`
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800279is automatically inherited by every other project in the same
280Gerrit instance. These rights can be seen, but not modified,
281in any other project's `Access` administration tab.
282
Fredrik Luthanderd9960882011-11-08 01:42:19 +0100283Only members of the groups with the `Administrate Server` capability
284may edit the access control list for `All-Projects`. By default this
285capability is given to the group `Administrators`, but can be given
286to more groups.
Shawn O. Pearcee2c2a222010-05-11 13:43:45 -0700287
288Ownership of this project cannot be delegated to another group.
289This restriction is by design. Granting ownership to another
290group gives nearly the same level of access as membership in
291`Administrators` does, as group members would be able to alter
Fredrik Luthanderd9960882011-11-08 01:42:19 +0100292permissions for every managed project including global capabilities.
Shawn O. Pearcee2c2a222010-05-11 13:43:45 -0700293
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200294
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800295Per-Project
296~~~~~~~~~~~
297
Fredrik Luthanderda867882011-12-21 18:28:40 +0100298The per-project ACL is evaluated before the global `All-Projects` ACL,
299permitting some limited override capability to project owners. This
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100300behavior is generally only useful on the `Read` category when
301granting 'DENY' within a specific project to deny a group access.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800302
303
Fredrik Luthander98030252012-04-13 11:01:22 +0200304[[references]]
305Special and magic references
306----------------------------
307
308The reference namespaces used in git are generally two, one for branches and
309one for tags:
310
311* +refs/heads/*+
312* +refs/tags/*+
313
314However, every reference under +refs/*+ is really available, and in Gerrit this
315opportunity for giving other refs a special meaning is used. In Gerrit they
316are sometimes used as magic/virtual references that give the push to Gerrit a
317special meaning.
318
319
320[[references_special]]
321Special references
322~~~~~~~~~~~~~~~~~~
323
324The special references have content that's either generated by Gerrit or
325contains important project configuration that Gerrit needs. When making
326changes to these references, Gerrit will take extra precautions to verify the
327contents compatibility at upload time.
328
329
330refs/changes/*
331^^^^^^^^^^^^^^
332
333Under this namespace each uploaded patch set for every change gets a static
334reference in their git. The format is convenient but still intended to scale to
335hundreds of thousands of patch sets. To access a given patch set you will
336need the change number and patch set number.
337
338[verse]
339'refs/changes/'<last two digits of change number>/
340 <change number>/
341 <patch set number>
342
343You can also find these static references linked on the page of each change.
344
345
346refs/meta/config
347^^^^^^^^^^^^^^^^
348
Matt Baker3a40c6d2013-11-26 21:01:17 -0700349This is where the Gerrit configuration of each project resides. This
Fredrik Luthander98030252012-04-13 11:01:22 +0200350branch contains several files of importance: +project.config+, +groups+ and
Matt Baker3a40c6d2013-11-26 21:01:17 -0700351+rules.pl+. Together they control access and behavior during the change
Fredrik Luthander98030252012-04-13 11:01:22 +0200352review process.
353
354
355refs/meta/dashboards/*
356^^^^^^^^^^^^^^^^^^^^^^
357
358There's a dedicated page where you can read more about
359link:user-dashboards.html[User Dashboards].
360
361
362refs/notes/review
363^^^^^^^^^^^^^^^^^
364
365Autogenerated copy of review notes for all changes in the git. Each log entry
366on the refs/notes/review branch also references the patch set on which the
367review is made. This functionality is provided by the review-notes plugin.
368
369
370[[references_magic]]
371Magic references
372~~~~~~~~~~~~~~~~
373
374These are references with added functionality to them compared to a regular
375git push operation.
376
Fredrik Luthander98030252012-04-13 11:01:22 +0200377refs/for/<branch ref>
378^^^^^^^^^^^^^^^^^^^^^
379
380Most prominent is the `refs/for/<branch ref>` reference which is the reference
381upon which we build the code review intercept before submitting a commit to
382the branch it's uploaded to.
383
384Further documentation on how to push can be found on the
385link:user-upload.html#push_create[Upload changes] page.
386
387
388refs/publish/*
389^^^^^^^^^^^^^^
390
391`refs/publish/*` is an alternative name to `refs/for/*` when pushing new changes
392and patch sets.
393
394
395refs/drafts/*
396^^^^^^^^^^^^^
397
398Push to `refs/drafts/*` creates a change like push to `refs/for/*`, except the
399resulting change remains hidden from public review. You then have the option
400of adding individual reviewers before making the change public to all. The
401change page will have a 'Publish' button which allows you to convert individual
402draft patch sets of a change into public patch sets for review.
403
David Ostrovsky07ddca52014-01-21 22:51:47 +0100404To block push permission to `refs/drafts/*` the following permission rule can
405be configured:
406
407====
408 [access "refs/drafts/*"]
409 push = block group Anonymous Users
410====
411
Fredrik Luthander98030252012-04-13 11:01:22 +0200412
Fredrik Luthander5ccf2e42013-05-08 01:06:25 +0200413[[access_categories]]
414Access Categories
415-----------------
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800416
Fredrik Luthander5ccf2e42013-05-08 01:06:25 +0200417Gerrit has several permission categories that can be granted to groups
418within projects, enabling functionality for that group's members.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800419
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200420
Fredrik Luthander69236de2013-05-09 14:50:39 +0200421
Chad Horohoe029c85a2012-06-07 16:10:14 -0400422[[category_abandon]]
423Abandon
Edwin Kempin3ff05112012-07-19 14:43:25 +0200424~~~~~~~
Chad Horohoe029c85a2012-06-07 16:10:14 -0400425
426This category controls whether users are allowed to abandon changes
427to projects in Gerrit. It can give permission to abandon a specific
428change to a given ref.
429
David Pursehousec795eb12013-07-05 14:20:28 +0900430This also grants the permission to restore a change if the user also
431has link:#category_push[push permission] on the change's destination
432ref.
Chad Horohoe35ced0a2012-06-27 19:20:34 -0400433
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200434
Fredrik Luthandere9eeeea2011-12-08 16:45:32 +0100435[[category_create]]
436Create reference
437~~~~~~~~~~~~~~~~
438
439The create reference category controls whether it is possible to
440create new references, branches or tags. This implies that the
441reference must not already exist, it's not a destructive permission
David Pursehouse221d4f62012-06-08 17:38:08 +0900442in that you can't overwrite or remove any previously existing
Fredrik Luthandere9eeeea2011-12-08 16:45:32 +0100443references (and also discard any commits in the process).
444
445It's probably most common to either permit the creation of a single
446branch in many gits (by granting permission on a parent project), or
447to grant this permission to a name pattern of branches.
448
449This permission is often given in conjunction with regular push
450branch permissions, allowing the holder of both to create new branches
451as well as bypass review for new commits on that branch.
452
David Pursehouse221d4f62012-06-08 17:38:08 +0900453To push lightweight (non-annotated) tags, grant
Fredrik Luthandere9eeeea2011-12-08 16:45:32 +0100454`Create Reference` for reference name `refs/tags/*`, as lightweight
455tags are implemented just like branches in Git.
456
457For example, to grant the possibility to create new branches under the
458namespace `foo`, you have to grant this permission on
459`refs/heads/foo/*` for the group that should have it.
460Finally, if you plan to grant each user a personal namespace in
461where they are free to create as many branches as they wish, you
462should grant the create reference permission so it's possible
463to create new branches. This is done by using the special
464`${username}` keyword in the reference pattern, e.g.
465`refs/heads/sandbox/${username}/*`. If you do, it's also recommended
466you grant the users the push force permission to be able to clean up
467stale branches.
468
469
Fredrik Luthander8f430f12011-12-27 13:40:43 +0100470[[category_forge_author]]
471Forge Author
472~~~~~~~~~~~~
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100473
474Normally Gerrit requires the author and the committer identity
475lines in a Git commit object (or tagger line in an annotated tag) to
476match one of the registered email addresses of the uploading user.
Fredrik Luthander8f430f12011-12-27 13:40:43 +0100477This permission allows users to bypass parts of that validation, which
478may be necessary when mirroring changes from an upstream project.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100479
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100480Permits the use of an unverified author line in commit objects.
481This can be useful when applying patches received by email from
4823rd parties, when cherry-picking changes written by others across
483branches, or when amending someone else's commit to fix up a minor
484problem before submitting.
Fredrik Luthander8f430f12011-12-27 13:40:43 +0100485
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100486By default this is granted to `Registered Users` in all projects,
487but a site administrator may disable it if verified authorship
488is required.
489
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100490
Fredrik Luthander8f430f12011-12-27 13:40:43 +0100491[[category_forge_committer]]
492Forge Committer
493~~~~~~~~~~~~~~~
494
495Normally Gerrit requires the author and the committer identity
496lines in a Git commit object (or tagger line in an annotated tag) to
497match one of the registered email addresses of the uploading user.
498This permission allows users to bypass parts of that validation, which
499may be necessary when mirroring changes from an upstream project.
500
501Allows the use of an unverified committer line in commit objects, or an
502unverified tagger line in annotated tag objects. Typically this is only
503required when mirroring commits from an upstream project repository.
504
505
506[[category_forge_server]]
507Forge Server
508~~~~~~~~~~~~
509
510Normally Gerrit requires the author and the committer identity
511lines in a Git commit object (or tagger line in an annotated tag) to
512match one of the registered email addresses of the uploading user.
513This permission allows users to bypass parts of that validation, which
514may be necessary when mirroring changes from an upstream project.
515
516Allows the use of the server's own name and email on the committer
517line of a new commit object. This should only be necessary when force
518pushing a commit history which has been rewritten by 'git filter-branch'
519and that contains merge commits previously created by this Gerrit Code
520Review server.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100521
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100522
523[[category_owner]]
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100524Owner
525~~~~~
526
527The `Owner` category controls which groups can modify the project's
528configuration. Users who are members of an owner group can:
529
530* Change the project description
Fredrik Luthander9c949382014-03-22 09:19:45 -0700531* Create a branch via the ssh command link:cmd-create-branch.html['create-branch']
532* Create/delete a branch through the web UI
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100533* Grant/revoke any access rights, including `Owner`
534
535Note that project owners implicitly have branch creation or deletion
536through the web UI, but not through SSH. To get SSH branch access
537project owners must grant an access right to a group they are a
538member of, just like for any other user.
539
540Ownership over a particular branch subspace may be delegated by
541entering a branch pattern. To delegate control over all branches
542that begin with `qa/` to the QA group, add `Owner` category
Fredrik Luthandera8b9d212012-10-10 16:05:59 +0200543for reference `refs/heads/qa/*`. Members of the QA group can
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100544further refine access, but only for references that begin with
Fredrik Luthander8fa3d262011-11-07 17:04:01 +0100545`refs/heads/qa/`. See <<project_owners,project owners>> to find
546out more about this role.
547
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100548
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100549[[category_push]]
550Push
551~~~~
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100552
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100553This category controls how users are allowed to upload new commits
554to projects in Gerrit. It can either give permission to push
555directly into a branch, bypassing any code review process
556that would otherwise be used. Or it may give permission to upload
557new changes for code review, this depends on which namespace the
558permission is granted to.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100559
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100560
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100561[[category_push_direct]]
562Direct Push
563^^^^^^^^^^^
564
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100565Any existing branch can be fast-forwarded to a new commit.
Robin Rosenberg524a3032012-10-14 14:24:36 +0200566Creation of new branches is controlled by the
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100567link:access-control.html#category_create['Create Reference']
568category. Deletion of existing branches is rejected. This is the
569safest mode as commits cannot be discarded.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100570
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100571* Force option
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100572+
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100573Allows an existing branch to be deleted. Since a force push is
574effectively a delete immediately followed by a create, but performed
575atomically on the server and logged, this option also permits forced
576push updates to branches. Enabling this option allows existing commits
577to be discarded from a project history.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100578
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100579The push category is primarily useful for projects that only want to
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100580take advantage of Gerrit's access control features and do not need
581its code review functionality. Projects that need to require code
582reviews should not grant this category.
583
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100584
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100585[[category_push_review]]
586Upload To Code Review
587^^^^^^^^^^^^^^^^^^^^^
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100588
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100589The `Push` access right granted on the namespace
590`refs/for/refs/heads/BRANCH` permits the user to upload a non-merge
591commit to the project's `refs/for/BRANCH` namespace, creating a new
592change for code review.
593
594A user must be able to clone or fetch the project in order to create
595a new commit on their local system, so in practice they must also
596have the `Read` access granted to upload a change.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100597
598For an open source, public Gerrit installation, it is common to
Fredrik Luthanderea13ca52011-12-29 11:36:48 +0100599grant `Read` and `Push` for `refs/for/refs/heads/*`
600to `Registered Users` in the `All-Projects` ACL. For more
601private installations, its common to simply grant `Read` and
602`Push` for `refs/for/refs/heads/*` to all users of a project.
603
604* Force option
605+
606The force option has no function when granted to a branch in the
607`refs/for/refs/heads/*` namespace.
608
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100609
Fredrik Luthanderbf568572012-01-18 11:17:00 +0100610[[category_push_merge]]
Edwin Kempinaef5d6e2012-01-24 09:04:54 +0100611Push Merge Commits
Yuxuan 'fishy' Wang84065aa2013-08-29 15:10:24 -0700612~~~~~~~~~~~~~~~~~~
Fredrik Luthanderbf568572012-01-18 11:17:00 +0100613
Magnus Bäck282c1022012-04-18 15:39:17 -0400614The `Push Merge Commit` access right permits the user to upload merge
Gustaf Lundha28a1d22013-05-08 15:05:12 +0100615commits. It's an add-on to the <<category_push,Push>> access right, and
Magnus Bäck282c1022012-04-18 15:39:17 -0400616so it won't be sufficient with only `Push Merge Commit` granted for a
617push to happen. Some projects wish to restrict merges to being created
618by Gerrit. By granting `Push` without `Push Merge Commit`, the only
Edwin Kempinaef5d6e2012-01-24 09:04:54 +0100619merges that enter the system will be those created by Gerrit.
Fredrik Luthanderbf568572012-01-18 11:17:00 +0100620
Jonathan Niederdaf8bd42013-10-01 15:06:14 -0700621The reference name connected to a `Push Merge Commit` entry must always
622be prefixed with `refs/for/`, for example `refs/for/refs/heads/BRANCH`.
623This applies even for an entry that complements a `Push` entry for
624`refs/heads/BRANCH` that allows direct pushes of non-merge commits, and
625the intention of the `Push Merge Commit` entry is to allow direct pushes
626of merge commits.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100627
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200628
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100629[[category_push_annotated]]
630Push Annotated Tag
631~~~~~~~~~~~~~~~~~~
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100632
David Pursehouse690cebe2012-12-12 19:22:45 +0900633This category permits users to push an annotated tag object into the
634project's repository. Typically this would be done with a command line
635such as:
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100636
637====
638 git push ssh://USER@HOST:PORT/PROJECT tag v1.0
639====
640
David Pursehouse690cebe2012-12-12 19:22:45 +0900641Or:
642
643====
644 git push https://HOST/PROJECT tag v1.0
645====
646
David Pursehouseb429ce12012-12-12 11:04:40 +0900647Tags must be annotated (created with `git tag -a`), should exist in
648the `refs/tags/` namespace, and should be new.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100649
650This category is intended to be used to publish tags when a project
651reaches a stable release point worth remembering in history.
652
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100653It allows for a new annotated (unsigned) tag to be created. The
654tagger email address must be verified for the current user.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100655
656To push tags created by users other than the current user (such
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100657as tags mirrored from an upstream project), `Forge Committer Identity`
658must be also granted in addition to `Push Annotated Tag`.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100659
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100660To push lightweight (non annotated) tags, grant
661<<category_create,`Create Reference`>> for reference name
662`refs/tags/*`, as lightweight tags are implemented just like
663branches in Git.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100664
Fredrik Luthanderd7749862012-01-20 07:29:43 +0100665To delete or overwrite an existing tag, grant `Push` with the force
666option enabled for reference name `refs/tags/*`, as deleting a tag
667requires the same permission as deleting a branch.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100668
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100669
David Pursehouseb429ce12012-12-12 11:04:40 +0900670[[category_push_signed]]
671Push Signed Tag
672~~~~~~~~~~~~~~~
673
David Pursehouse690cebe2012-12-12 19:22:45 +0900674This category permits users to push a PGP signed tag object into the
675project's repository. Typically this would be done with a command
676line such as:
David Pursehouseb429ce12012-12-12 11:04:40 +0900677
678====
679 git push ssh://USER@HOST:PORT/PROJECT tag v1.0
680====
681
David Pursehouse690cebe2012-12-12 19:22:45 +0900682Or:
683
684====
685 git push https://HOST/PROJECT tag v1.0
686====
687
David Pursehouseb429ce12012-12-12 11:04:40 +0900688Tags must be signed (created with `git tag -s`), should exist in the
689`refs/tags/` namespace, and should be new.
690
691
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100692[[category_read]]
693Read
694~~~~
695
696The `Read` category controls visibility to the project's
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100697changes, comments, code diffs, and Git access over SSH or HTTP.
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100698A user must have this access granted in order to see a project, its
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100699changes, or any of its data.
700
701This category has a special behavior, where the per-project ACL is
702evaluated before the global all projects ACL. If the per-project
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100703ACL has granted `Read` with 'DENY', and does not otherwise grant
704`Read` with 'ALLOW', then a `Read` in the all projects ACL
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100705is ignored. This behavior is useful to hide a handful of projects
706on an otherwise public server.
707
708For an open source, public Gerrit installation it is common to grant
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100709`Read` to `Anonymous Users` in the `All-Projects` ACL, enabling
710casual browsing of any project's changes, as well as fetching any
711project's repository over SSH or HTTP. New projects can be
712temporarily hidden from public view by granting `Read` with 'DENY'
713to `Anonymous Users` and granting `Read` to the project owner's
714group within the per-project ACL.
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100715
716For a private Gerrit installation using a trusted HTTP authentication
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100717source, granting `Read` to `Registered Users` may be more
Fredrik Luthanderdb7679a2011-11-03 08:52:56 +0100718typical, enabling read access only to those users who have been
719able to authenticate through the HTTP access controls. This may
720be suitable in a corporate deployment if the HTTP access control
721is already restricted to the correct set of users.
722
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100723
Edwin Kempinfd330fc2012-05-09 21:09:55 +0200724[[category_rebase]]
725Rebase
726~~~~~~
727
728This category permits users to rebase changes via the web UI by pushing
729the `Rebase Change` button.
730
731The change owner and submitters can always rebase changes in the web UI
732(even without having the `Rebase` access right assigned).
733
734Users without this access right who are able to upload new patch sets
735can still do the rebase locally and upload the rebased commit as a new
736patch set.
737
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200738
Chad Horohoec626f3c2012-09-13 11:04:20 -0700739[[category_remove_reviewer]]
740Remove Reviewer
741~~~~~~~~~~~~~~~
742
743This category permits users to remove other users from the list of
744reviewers on a change.
745
746The change owner, project owner and site administrator can always
747remove reviewers (even without having the `Remove Reviewer` access
748right assigned).
749
750Users without this access right can only remove themselves from the
751reviewer list on a change.
752
Edwin Kempinfd330fc2012-05-09 21:09:55 +0200753
Fredrik Luthander5ccf2e42013-05-08 01:06:25 +0200754[[category_review_labels]]
755Review Labels
756~~~~~~~~~~~~~
757
758For every configured label `My-Name` in the project, there is a
759corresponding permission `label-My-Name` with a range corresponding to
Shawn Pearce9d783122013-06-11 18:18:03 -0700760the defined values. There is also a corresponding `labelAs-My-Name`
761permission that enables editing another user's label.
Fredrik Luthander5ccf2e42013-05-08 01:06:25 +0200762
763Gerrit comes pre-configured with a default 'Code-Review' label that can
764be granted to groups within projects, enabling functionality for that
765group's members. link:config-labels.html[Custom labels] may also be
766defined globally or on a per-project basis.
767
768
Fredrik Luthander5e1b51b2012-01-20 13:06:06 +0100769[[category_submit]]
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800770Submit
771~~~~~~
772
773This category permits users to push the `Submit Patch Set n` button
774on the web UI.
775
776Submitting a change causes it to be merged into the destination
777branch as soon as possible, making it a permanent part of the
778project's history.
779
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800780In order to submit, all labels (such as `Verified` and `Code-Review`,
781above) must enable submit, and also must not block it. See above for
782details on each label.
Shawn O. Pearce4b122b82009-02-18 18:22:14 -0800783
Edwin Kempinbfa06212013-04-04 16:06:39 +0200784To link:user-upload.html#auto_merge[immediately submit a change on push]
785the caller needs to have the Submit permission on `refs/for/<ref>`
786(e.g. on `refs/for/refs/heads/master`).
787
Fredrik Luthanderbc75ef72012-01-26 15:57:08 +0100788
David Pursehouse5ae73002012-11-01 15:22:26 +0900789[[category_view_drafts]]
790View Drafts
791~~~~~~~~~~~
792
793This category permits users to view draft changes uploaded by other
794users.
795
796The change owner and any explicitly added reviewers can always see
797draft changes (even without having the `View Drafts` access right
798assigned).
799
800
David Pursehousebe7f4582012-12-12 11:21:29 +0900801[[category_publish_drafts]]
802Publish Drafts
803~~~~~~~~~~~~~~
804
805This category permits users to publish draft changes uploaded by other
806users.
807
808The change owner can always publish draft changes (even without having
809the `Publish Drafts` access right assigned).
810
811
812[[category_delete_drafts]]
813Delete Drafts
814~~~~~~~~~~~~~
815
816This category permits users to delete draft changes uploaded by other
817users.
818
819The change owner can always delete draft changes (even without having
820the `Delete Drafts` access right assigned).
821
822
David Pursehouse59aee362012-11-15 17:25:17 +0900823[[category_edit_topic_name]]
824Edit Topic Name
825~~~~~~~~~~~~~~~
826
827This category permits users to edit the topic name of a change that
828is uploaded for review.
829
830The change owner, branch owners, project owners, and site administrators
831can always edit the topic name (even without having the `Edit Topic Name`
832access right assigned).
833
Edwin Kempin1f77b532013-11-08 07:16:31 +0100834Whether the topic can be edited on closed changes can be controlled
835by the 'Force Edit' flag. If this flag is not set the topic can only be
836edited on open changes.
837
David Pursehouse59aee362012-11-15 17:25:17 +0900838
Fredrik Luthanderbc75ef72012-01-26 15:57:08 +0100839Examples of typical roles in a project
840--------------------------------------
841
842Below follows a set of typical roles on a server and which access
843rights these roles typically should be granted. You may see them as
David Pursehouse221d4f62012-06-08 17:38:08 +0900844general guidelines for a typical way to set up your project on a
Fredrik Luthanderbc75ef72012-01-26 15:57:08 +0100845brand new Gerrit instance.
846
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200847
Fredrik Luthanderbc75ef72012-01-26 15:57:08 +0100848[[examples_contributor]]
849Contributor
850~~~~~~~~~~~
851
852This is the typical user on a public server. They are able to read
853your project and upload new changes to it. They are able to give
854feedback on other changes as well, but are unable to block or approve
855any changes.
856
857Suggested access rights to grant:
858
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800859* xref:category_read[`Read`] on 'refs/heads/\*' and 'refs/tags/*'
860* xref:category_push[`Push`] to 'refs/for/refs/heads/*'
861* link:config-labels.html#label_Code-Review[`Code-Review`] with range '-1' to '+1' for 'refs/heads/*'
Fredrik Luthanderbc75ef72012-01-26 15:57:08 +0100862
863
Fredrik Luthander654161c2012-01-31 14:42:36 +0100864[[examples_developer]]
865Developer
866~~~~~~~~~
867
868This is the typical core developer on a public server. They are able
869to read the project, upload changes to a branch. They are allowed to
870push merge commits to merge branches together. Also, they are allowed
871to forge author identity, thus handling commits belonging to others
872than themselves, effectively allowing them to transfer commits
873between different branches.
874
875They are furthermore able to code review and verify commits, and
876eventually submit them. If you have an automated CI system that
877builds all uploaded patch sets you might want to skip the
878verification rights for the developer and let the CI system do that
879exclusively.
880
881Suggested access rights to grant:
882
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800883* xref:category_read[`Read`] on 'refs/heads/\*' and 'refs/tags/*'
884* xref:category_push[`Push`] to 'refs/for/refs/heads/*'
885* xref:category_push_merge[`Push merge commit`] to 'refs/for/refs/heads/*'
886* xref:category_forge_author[`Forge Author Identity`] to 'refs/heads/*'
887* link:config-labels.html#label_Code-Review[`Label: Code-Review`] with range '-2' to '+2' for 'refs/heads/*'
Peter Jönsson3bfcae72013-07-17 22:06:32 +0200888* link:config-labels.html#label_Verified[`Label: Verified`] with range '-1' to '+1' for 'refs/heads/*'
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800889* xref:category_submit[`Submit`]
Fredrik Luthander654161c2012-01-31 14:42:36 +0100890
891If the project is small or the developers are seasoned it might make
892sense to give them the freedom to push commits directly to a branch.
893
894Optional access rights to grant:
895
896* <<category_push,`Push`>> to 'refs/heads/*'
897* <<category_push_merge,`Push merge commit`>> to 'refs/heads/*'
898
899
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100900[[examples_cisystem]]
901CI system
902~~~~~~~~~
903
Gustaf Lundha28a1d22013-05-08 15:05:12 +0100904A typical Continuous Integration system should be able to download new changes
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100905to build and then leave a verdict somehow.
906
907As an example, the popular
908link:https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger[gerrit-trigger plugin]
909for Jenkins/Hudson can set labels at:
910
911* The start of a build
912* A successful build
913* An unstable build (tests fails)
914* A failed build
915
Peter Jönsson3bfcae72013-07-17 22:06:32 +0200916Usually the range chosen for this verdict is the `Verified` label. Depending on
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100917the size of your project and discipline of involved developers you might want
Peter Jönsson3bfcae72013-07-17 22:06:32 +0200918to limit access right to the +1 `Verified` label to the CI system only. That
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100919way it's guaranteed that submitted commits always get built and pass tests
920successfully.
921
922If the build doesn't complete successfully the CI system can set the
Peter Jönsson3bfcae72013-07-17 22:06:32 +0200923`Verified` label to -1. However that means that a failed build will block
924submit of the change even if someone else sets `Verified` +1. Depending on the
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100925project and how much the CI system can be trusted for accurate results, a
926blocking label might not be feasible. A recommended alternative is to set the
927label `Code-review` to -1 instead, as it isn't a blocking label but still
David Pursehouse221d4f62012-06-08 17:38:08 +0900928shows a red label in the Gerrit UI. Optionally, to enable the possibility to
929deliver different results (build error vs unstable for instance), it's also
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100930possible to set `Code-review` +1 as well.
931
Edwin Kempina2e13cf2012-03-30 09:02:36 +0200932If pushing new changes is granted, it's possible to automate cherry-pick of
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100933submitted changes for upload to other branches under certain conditions. This
934is probably not the first step of what a project wants to automate however,
935and so the push right can be found under the optional section.
936
937Suggested access rights to grant, that won't block changes:
938
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800939* xref:category_read[`Read`] on 'refs/heads/\*' and 'refs/tags/*'
940* link:config-labels.html#label_Code-Review[`Label: Code-Review`] with range '-1' to '0' for 'refs/heads/*'
Peter Jönsson3bfcae72013-07-17 22:06:32 +0200941* link:config-labels.html#label_Verified[`Label: Verified`] with range '0' to '+1' for 'refs/heads/*'
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100942
943Optional access rights to grant:
944
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800945* link:config-labels.html#label_Code-Review[`Label: Code-Review`] with range '-1' to '+1' for 'refs/heads/*'
946* xref:category_push[`Push`] to 'refs/for/refs/heads/*'
Fredrik Luthanderf2105be2012-01-27 12:44:05 +0100947
948
Fredrik Luthanderfe720022012-03-22 17:29:39 +0100949[[examples_integrator]]
950Integrator
951~~~~~~~~~~
952
953Integrators are like developers but with some additional rights granted due
954to their administrative role in a project. They can upload or push any commit
955with any committer email (not just their own) and they can also create new
956tags and branches.
957
958Suggested access rights to grant:
959
960* <<examples_developer,Developer rights>>
961* <<category_push,`Push`>> to 'refs/heads/*'
962* <<category_push_merge,`Push merge commit`>> to 'refs/heads/*'
Fredrik Luthander404a2852012-10-10 08:51:22 +0200963* <<category_forge_committer,`Forge Committer Identity`>> to 'refs/for/refs/heads/*'
Fredrik Luthanderfe720022012-03-22 17:29:39 +0100964* <<category_create,`Create Reference`>> to 'refs/heads/*'
965* <<category_push_annotated,`Push Annotated Tag`>> to 'refs/tags/*'
966
967
Fredrik Luthander9c645362012-03-22 18:10:42 +0100968[[examples_project-owner]]
969Project owner
970~~~~~~~~~~~~~
971
972The project owner is almost like an integrator but with additional destructive
973power in the form of being able to delete branches. Optionally these users
974also have the power to configure access rights in gits assigned to them.
975
976[WARNING]
Gustaf Lundha28a1d22013-05-08 15:05:12 +0100977These users should be really knowledgeable about git, for instance knowing why
Fredrik Luthander9c645362012-03-22 18:10:42 +0100978tags never should be removed from a server. This role is granted potentially
979destructive access rights and cleaning up after such a mishap could be time
980consuming!
981
982Suggested access rights to grant:
983
984* <<examples_integrator,Integrator rights>>
985* <<category_push,`Push`>> with the force option to 'refs/heads/\*' and 'refs/tags/*'
986
987Optional access right to grant:
988
989* <<category_owner,`Owner`>> in the gits they mostly work with.
990
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +0200991
Fredrik Luthander5a8e7d82012-03-22 17:29:39 +0100992[[examples_administrator]]
993Administrator
994~~~~~~~~~~~~~
995
996The administrator role is the most powerful role known in the Gerrit universe.
Fredrik Luthanderb8eaa082014-03-17 01:02:22 +0100997This role may grant itself (or others) any access right. By default the
Fredrik Luthander5a8e7d82012-03-22 17:29:39 +0100998<<administrators,`Administrators` group>> is the group that has this role.
999
1000Mandatory access rights:
1001
1002* <<capability_administrateServer,The `Administrate Server` capability>>
1003
1004Suggested access rights to grant:
1005
Fredrik Luthanderb8eaa082014-03-17 01:02:22 +01001006* <<examples_project-owner,`Project owner rights`>>
1007* Any <<global_capabilities,`capabilities`>> needed by the administrator
Fredrik Luthander5a8e7d82012-03-22 17:29:39 +01001008
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +02001009
Sasa Zivkovd589f462013-02-12 14:27:09 +01001010Enforcing site wide access policies
1011-----------------------------------
1012
1013By granting the <<category_owner,`Owner`>> access right on the `refs/*` to a
1014group, Gerrit administrators can delegate the responsibility of maintaining
1015access rights for that project to that group.
1016
1017In a corporate deployment it is often necessary to enforce some access
1018policies. An example could be that no-one can update or delete a tag, not even
1019the project owners. The 'ALLOW' and 'DENY' rules are not enough for this
1020purpose as project owners can grant themselves any access right they wish and,
1021thus, effectively override any inherited access rights from the
1022"`All-Projects`" or some other common parent project.
1023
1024What is needed is a mechanism to block a permission in a parent project so
1025that even project owners cannot allow a blocked permission in their child
1026project. Still, project owners should retain the possibility to manage all
1027non-blocked rules as they wish. This gives best of both worlds:
1028
1029* Gerrit administrators can concentrate on enforcing site wide policies
1030 and providing a meaningful set of default access permissions
1031* Project owners can manage access rights of their projects without a danger
1032 of violating a site wide policy
1033
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +02001034
Edwin Kempin60ab8532013-03-27 14:33:46 +01001035[[block]]
Sasa Zivkovd589f462013-02-12 14:27:09 +01001036'BLOCK' access rule
1037~~~~~~~~~~~~~~~~~~~
1038
1039The 'BLOCK' rule blocks a permission globally. An inherited 'BLOCK' rule cannot
Sasa Zivkovcff084b2013-01-15 18:52:32 +01001040be overridden in the inheriting project. Any 'ALLOW' rule, from a different
1041access section or from an inheriting project, which conflicts with an
1042inherited 'BLOCK' rule will not be honored. Searching for 'BLOCK' rules, in
Sasa Zivkovd589f462013-02-12 14:27:09 +01001043the chain of parent projects, ignores the Exclusive flag that is normally
1044applied to access sections.
1045
1046A 'BLOCK' rule that blocks the 'push' permission blocks any type of push,
1047force or not. A blocking force push rule blocks only force pushes, but
1048allows non-forced pushes if an 'ALLOW' rule would have permitted it.
1049
1050It is also possible to block label ranges. To block a group 'X' from voting
1051'-2' and '+2', but keep their existing voting permissions for the '-1..+1'
1052range intact we would define:
1053
1054====
1055 [access "refs/heads/*"]
1056 label-Code-Review = block -2..+2 group X
1057====
1058
1059The interpretation of the 'min..max' range in case of a blocking rule is: block
1060every vote from '-INFINITE..min' and 'max..INFINITE'. For the example above it
1061means that the range '-1..+1' is not affected by this block.
1062
Sasa Zivkovcff084b2013-01-15 18:52:32 +01001063'BLOCK' and 'ALLOW' rules in the same access section
1064~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1065
1066When an access section of a project contains a 'BLOCK' and an 'ALLOW' rule for
1067the same permission then this 'ALLOW' rule overrides the 'BLOCK' rule:
1068
1069====
1070 [access "refs/heads/*"]
1071 push = block group X
1072 push = group Y
1073====
1074
1075In this case a user which is a member of the group 'Y' will still be allowed to
1076push to 'refs/heads/*' even if it is a member of the group 'X'.
1077
1078NOTE: An 'ALLOW' rule overrides a 'BLOCK' rule only when both of them are
1079inside the same access section of the same project. An 'ALLOW' rule in a
1080different access section of the same project or in any access section in an
1081inheriting project cannot override a 'BLOCK' rule.
1082
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +02001083
Sasa Zivkovd589f462013-02-12 14:27:09 +01001084Examples
1085~~~~~~~~
1086
1087The following examples show some possible use cases for the 'BLOCK' rules.
1088
1089Make sure no one can update or delete a tag
1090^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1091
1092This requirement is quite common in a corporate deployment where
1093reproducibility of a build must be guaranteed. To achieve that we block 'push'
1094permission for the <<anonymous_users,'Anonymous Users'>> in "`All-Projects`":
1095
1096====
1097 [access "refs/tags/*"]
1098 push = block group Anonymous Users
1099====
1100
1101By blocking the <<anonymous_users,'Anonymous Users'>> we effectively block
1102everyone as everyone is a member of that group. Note that the permission to
1103create a tag is still necessary. Assuming that only <<category_owner,project
1104owners>> are allowed to create tags, we would extend the example above:
1105
1106====
1107 [access "refs/tags/*"]
1108 push = block group Anonymous Users
1109 create = group Project Owners
1110 pushTag = group Project Owners
1111====
Fredrik Luthander9c645362012-03-22 18:10:42 +01001112
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +02001113
Sasa Zivkovcff084b2013-01-15 18:52:32 +01001114Let only a dedicated group vote in a special category
1115^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1116
1117Assume there is a more restrictive process for submitting changes in stable
1118release branches which is manifested as a new voting category
1119'Release-Process'. Assume we want to make sure that only a 'Release Engineers'
1120group can vote in this category and that even project owners cannot approve
1121this category. We have to block everyone except the 'Release Engineers' to vote
1122in this category and, of course, allow 'Release Engineers' to vote in that
1123category. In the "`All-Projects`" we define the following rules:
1124
1125====
1126 [access "refs/heads/stable*"]
Gustaf Lundha28a1d22013-05-08 15:05:12 +01001127 label-Release-Process = block -1..+1 group Anonymous Users
1128 label-Release-Process = -1..+1 group Release Engineers
Sasa Zivkovcff084b2013-01-15 18:52:32 +01001129====
1130
David Pursehouse8becc2a2013-04-23 18:51:04 +09001131[[global_capabilities]]
1132Global Capabilities
Fredrik Luthander80ebf9d2012-02-13 09:32:43 +01001133-------------------
1134
David Pursehouse8becc2a2013-04-23 18:51:04 +09001135The global capabilities control actions that the administrators of
Fredrik Luthander80ebf9d2012-02-13 09:32:43 +01001136the server can perform which usually affect the entire
1137server in some way. The administrators may delegate these
1138capabilities to trusted groups of users.
1139
1140Delegation of capabilities allows groups to be granted a subset of
1141administrative capabilities without being given complete
1142administrative control of the server. This makes it possible to
1143keep fewer users in the administrators group, even while spreading
1144much of the server administration burden out to more users.
1145
David Pursehouse8becc2a2013-04-23 18:51:04 +09001146Global capabilities are assigned to groups in the access rights settings
1147of the root project ("`All-Projects`").
1148
Fredrik Luthander80ebf9d2012-02-13 09:32:43 +01001149Below you find a list of capabilities available:
1150
1151
David Pursehouse11c4c5f2013-06-09 08:07:23 +09001152[[capability_accessDatabase]]
1153Access Database
1154~~~~~~~~~~~~~~~
1155
1156Allow users to access the database using the `gsql` command.
1157
1158
Fredrik Luthander426885f2012-02-13 09:56:57 +01001159[[capability_administrateServer]]
1160Administrate Server
1161~~~~~~~~~~~~~~~~~~~
1162
1163This is in effect the owner and administrator role of the Gerrit
1164instance. Any members of a group granted this capability will be
1165able to grant any access right to any group. They will also have all
1166capabilities granted to them automatically.
1167
1168
Fredrik Luthanderb02afca2012-02-13 09:59:48 +01001169[[capability_createAccount]]
1170Create Account
1171~~~~~~~~~~~~~~
1172
Fredrik Luthander79d38152012-03-13 09:52:22 +01001173Allow link:cmd-create-account.html[account creation over the ssh prompt].
Fredrik Luthanderb02afca2012-02-13 09:59:48 +01001174This capability allows the granted group members to create non-interactive
1175service accounts. These service accounts are generally used for automation
1176and made to be members of the
1177link:access-control.html#non-interactive_users['Non-Interactive users'] group.
1178
1179
Fredrik Luthander79d38152012-03-13 09:52:22 +01001180[[capability_createGroup]]
1181Create Group
1182~~~~~~~~~~~~
1183
1184Allow group creation. Groups are used to grant users access to different
1185actions in projects. This capability allows the granted group members to
1186either link:cmd-create-group.html[create new groups via ssh] or via the web UI.
1187
1188
1189[[capability_createProject]]
1190Create Project
1191~~~~~~~~~~~~~~
1192
1193Allow project creation. This capability allows the granted group to
1194either link:cmd-create-project.html[create new git projects via ssh]
1195or via the web UI.
1196
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +02001197
Sasa Zivkov812f4892012-06-21 16:25:21 +02001198[[capability_emailReviewers]]
1199Email Reviewers
1200~~~~~~~~~~~~~~~
1201
1202Allow or deny sending email to change reviewers and watchers. This can be used
1203to deny build bots from emailing reviewers and people who watch the change.
1204Instead, only the authors of the change and those who starred it will be
1205emailed. The allow rules are evaluated before deny rules, however the default
1206is to allow emailing, if no explicit rule is matched.
Fredrik Luthander79d38152012-03-13 09:52:22 +01001207
Fredrik Luthandera8aa9c52013-05-09 14:50:39 +02001208
Fredrik Luthander74ad0d02012-03-13 13:06:30 +01001209[[capability_flushCaches]]
1210Flush Caches
1211~~~~~~~~~~~~
1212
Fredrik Luthander48603002012-03-21 18:17:17 +01001213Allow the flushing of Gerrit's caches. This capability allows the granted
Fredrik Luthander74ad0d02012-03-13 13:06:30 +01001214group to link:cmd-flush-caches.html[flush some or all Gerrit caches via ssh].
1215
1216[NOTE]
1217This capability doesn't imply permissions to the show-caches command. For that
1218you need the <<capability_viewCaches,view caches capability>>.
1219
1220
David Pursehousecbd22ac2013-06-09 08:03:14 +09001221[[capability_generateHttpPassword]]
1222Generate HTTP Password
1223~~~~~~~~~~~~~~~~~~~~~~
1224
1225Allow the user to generate HTTP passwords for other users. Typically this would
1226be assigned to a non-interactive users group.
1227
1228
Fredrik Luthander46843022012-03-13 16:11:02 +01001229[[capability_kill]]
1230Kill Task
1231~~~~~~~~~
1232
1233Allow the operation of the link:cmd-kill.html[kill command over ssh]. The
1234kill command ends tasks that currently occupy the Gerrit server, usually
1235a replication task or a user initiated task such as an upload-pack or
Gustaf Lundha28a1d22013-05-08 15:05:12 +01001236receive-pack.
Fredrik Luthander46843022012-03-13 16:11:02 +01001237
1238
1239[[capability_priority]]
1240Priority
1241~~~~~~~~
1242
1243This capability allows users to use
1244link:config-gerrit.html#sshd.batchThreads[the thread pool reserved] for
1245link:access-control.html#non-interactive_users['Non-Interactive Users'].
1246It's a binary value in that granted users either have access to the thread
1247pool, or they don't.
1248
1249There are three modes for this capability and they're listed by rising
1250priority:
1251
1252No capability configured.::
1253The user isn't a member of a group with any priority capability granted. By
1254default the user is then in the 'INTERACTIVE' thread pool.
1255
1256'BATCH'::
1257If there's a thread pool configured for 'Non-Interactive Users' and a user is
1258granted the priority capability with the 'BATCH' mode selected, the user ends
1259up in the separate batch user thread pool. This is true unless the user is
1260also granted the below 'INTERACTIVE' option.
1261
1262'INTERACTIVE'::
1263If a user is granted the priority capability with the 'INTERACTIVE' option,
1264regardless if they also have the 'BATCH' option or not, they are in the
1265'INTERACTIVE' thread pool.
1266
1267
Fredrik Luthander80ebf9d2012-02-13 09:32:43 +01001268[[capability_queryLimit]]
1269Query Limit
1270~~~~~~~~~~~
1271
1272Allow site administrators to configure the query limit for users to
1273be above the default hard-coded value of 500. Administrators can add
David Pursehouseb5d99aaf2013-08-09 11:02:48 +09001274a global block to `All-Projects` with group(s) that should have different
1275limits.
Fredrik Luthander80ebf9d2012-02-13 09:32:43 +01001276
1277When applying a query limit to a user the largest value granted by
1278any of their groups is used.
1279
1280This limit applies not only to the link:cmd-query.html[`gerrit query`]
1281command, but also to the web UI results pagination size.
1282
1283
Shawn Pearcebb027b02013-06-10 14:35:39 -07001284[[capability_runAs]]
1285Run As
1286~~~~~~
1287
Shawn Pearcef3ffd082013-06-12 11:21:35 -07001288Allow users to impersonate any other user with the `X-Gerrit-RunAs`
1289HTTP header on REST API calls, or the link:cmd-suexec.html[suexec]
1290SSH command.
1291
1292When impersonating an administrator the Administrate Server capability
1293is not honored. This security feature tries to prevent a role with
1294Run As capability from modifying the access controls in All-Projects,
1295however modification may still be possible if the impersonated user
1296has permission to push or submit changes on `refs/meta/config`. Run
1297As also blocks using most capabilities including Create User, Run
1298Garbage Collection, etc., unless the capability is also explicitly
1299granted to a group the administrator is a member of.
1300
1301Administrators do not automatically inherit this capability; it must
1302be explicitly granted.
Shawn Pearcebb027b02013-06-10 14:35:39 -07001303
1304
Edwin Kempin619169b2012-02-09 15:47:52 +01001305[[capability_runGC]]
1306Run Garbage Collection
1307~~~~~~~~~~~~~~~~~~~~~~
1308
1309Allow users to run the Git garbage collection for the repositories of
1310all projects.
1311
1312
Ed Bartoshd168b812013-04-13 20:15:58 +03001313[[capability_streamEvents]]
1314Stream Events
1315~~~~~~~~~~~~~
1316
1317Allow performing streaming of Gerrit events. This capability
1318allows the granted group to
1319link:cmd-stream-events.html[stream Gerrit events via ssh].
1320
1321
Fredrik Luthander9c7da662012-03-13 17:49:27 +01001322[[capability_viewCaches]]
1323View Caches
1324~~~~~~~~~~~
1325
Fredrik Luthander48603002012-03-21 18:17:17 +01001326Allow querying for status of Gerrit's internal caches. This capability allows
Fredrik Luthander9c7da662012-03-13 17:49:27 +01001327the granted group to
1328link:cmd-show-caches.html[look at some or all Gerrit caches via ssh].
1329
1330
Fredrik Luthander48603002012-03-21 18:17:17 +01001331[[capability_viewConnections]]
1332View Connections
1333~~~~~~~~~~~~~~~~
1334
1335Allow querying for status of Gerrit's current client connections. This
1336capability allows the granted group to
1337link:cmd-show-connections.html[look at Gerrit's current connections via ssh].
1338
1339
1340[[capability_viewQueue]]
1341View Queue
1342~~~~~~~~~~
1343
1344Allow querying for status of Gerrit's internal task queue. This capability
1345allows the granted group to
1346link:cmd-show-queue.html[look at the Gerrit task queue via ssh].
1347
1348
Shawn O. Pearce5500e692009-05-28 15:55:01 -07001349GERRIT
1350------
1351Part of link:index.html[Gerrit Code Review]