| Marian Harbach | ebeb154 | 2019-12-13 10:42:46 +0100 | [diff] [blame] | 1 | :linkattrs: |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 2 | = Gerrit Code Review - Access Controls |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 3 | |
| 4 | Access controls in Gerrit are group based. Every user account is a |
| 5 | member of one or more groups, and access and privileges are granted |
| Matt Fischer | 620255a | 2011-03-22 14:28:23 -0500 | [diff] [blame] | 6 | to those groups. Access rights cannot be granted to individual |
| 7 | users. |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 8 | |
| Jeff Gaston | ca20ec6 | 2018-10-16 12:42:35 -0400 | [diff] [blame] | 9 | To view/edit the access controls for a specific project, first |
| 10 | navigate to the projects page: for example, |
| Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 11 | https://gerrit-review.googlesource.com/admin/repos/[role=external,window=_blank]. Then click on |
| Jeff Gaston | ca20ec6 | 2018-10-16 12:42:35 -0400 | [diff] [blame] | 12 | the individual project, and then click Access. This will bring you |
| 13 | to a url that looks like |
| Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 14 | https://gerrit-review.googlesource.com/admin/repos/gerrit,access[role=external,window=_blank] |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 15 | |
| Edwin Kempin | 4bf0196 | 2014-04-16 16:47:10 +0200 | [diff] [blame] | 16 | [[system_groups]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 17 | == System Groups |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 18 | |
| Anita Kuno | 178f64b | 2014-04-22 18:52:28 -0400 | [diff] [blame] | 19 | Gerrit comes with the following system groups: |
| Khai Do | 4245e6f | 2013-10-11 18:14:31 +0200 | [diff] [blame] | 20 | |
| Khai Do | 4245e6f | 2013-10-11 18:14:31 +0200 | [diff] [blame] | 21 | * Anonymous Users |
| 22 | * Change Owner |
| Khai Do | 4245e6f | 2013-10-11 18:14:31 +0200 | [diff] [blame] | 23 | * Project Owners |
| 24 | * Registered Users |
| 25 | |
| 26 | The system groups are assigned special access and membership management |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 27 | privileges. |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 28 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 29 | |
| Fredrik Luthander | 8fa3d26 | 2011-11-07 17:04:01 +0100 | [diff] [blame] | 30 | [[anonymous_users]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 31 | === Anonymous Users |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 32 | |
| 33 | All users are automatically a member of this group. Users who are |
| 34 | not signed in are a member of only this group, and no others. |
| 35 | |
| 36 | Any access rights assigned to this group are inherited by all users. |
| 37 | |
| 38 | Administrators and project owners can grant access rights to this |
| 39 | group in order to permit anonymous users to view project changes, |
| 40 | without requiring sign in first. Currently it is only worthwhile |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 41 | to grant `Read` access to this group as Gerrit requires an account |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 42 | identity for all other operations. |
| 43 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 44 | |
| Fredrik Luthander | 8fa3d26 | 2011-11-07 17:04:01 +0100 | [diff] [blame] | 45 | [[project_owners]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 46 | === Project Owners |
| Fredrik Luthander | 8fa3d26 | 2011-11-07 17:04:01 +0100 | [diff] [blame] | 47 | |
| 48 | Access rights assigned to this group are always evaluated within the |
| 49 | context of a project to which the access rights apply. These rights |
| 50 | therefore apply to all the users who are owners of this project. |
| 51 | |
| 52 | By assigning access rights to this group on a parent project Gerrit |
| 53 | administrators can define a set of default access rights for |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 54 | <<category_owner,project owners>>. Child projects inherit these |
| Fredrik Luthander | 8fa3d26 | 2011-11-07 17:04:01 +0100 | [diff] [blame] | 55 | access rights where they are resolved to the users that own the child |
| 56 | project. Having default access rights for |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 57 | <<category_owner,project owners>> assigned on a parent project may |
| Fredrik Luthander | 8fa3d26 | 2011-11-07 17:04:01 +0100 | [diff] [blame] | 58 | avoid the need to initially configure access rights for |
| 59 | newly created child projects. |
| 60 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 61 | |
| Khai Do | 4245e6f | 2013-10-11 18:14:31 +0200 | [diff] [blame] | 62 | [[change_owner]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 63 | === Change Owner |
| Khai Do | 4245e6f | 2013-10-11 18:14:31 +0200 | [diff] [blame] | 64 | |
| 65 | Access rights assigned to this group are always evaluated within the |
| 66 | context of a change to which the access rights apply. These rights |
| 67 | therefore apply to the user who is the owner of this change. |
| 68 | |
| 69 | It is typical to assign a label to this group, allowing the change |
| 70 | owner to vote on his change, but not actually cause it to become |
| 71 | approved or rejected. |
| 72 | |
| Fredrik Luthander | 8fa3d26 | 2011-11-07 17:04:01 +0100 | [diff] [blame] | 73 | [[registered_users]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 74 | === Registered Users |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 75 | |
| 76 | All signed-in users are automatically a member of this group (and |
| Fredrik Luthander | 54abc35 | 2012-01-20 16:18:41 +0100 | [diff] [blame] | 77 | also <<anonymous_users,'Anonymous Users'>>, see above). |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 78 | |
| 79 | Any access rights assigned to this group are inherited by all |
| 80 | users as soon as they sign-in to Gerrit. If OpenID authentication |
| 81 | is being employed, moving from only 'Anonymous Users' into this |
| 82 | group is very easy. Caution should be taken when assigning any |
| 83 | permissions to this group. |
| 84 | |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 85 | It is typical to assign `Code-Review -1..+1` to this group, |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 86 | allowing signed-in users to vote on a change, but not actually |
| 87 | cause it to become approved or rejected. |
| 88 | |
| 89 | Registered users are always permitted to make and publish comments |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 90 | on any change in any project they have `Read` access to. |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 91 | |
| 92 | |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 93 | == Predefined Groups |
| 94 | |
| 95 | Predefined groups differs from system groups by the fact that they |
| Youssef Elghareeb | 655023f | 2020-11-11 13:09:33 +0100 | [diff] [blame] | 96 | exist in NoteDb under refs/meta/group-names (like normal groups) but predefined |
| 97 | groups are created on Gerrit site initialization and unique UUIDs are assigned |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 98 | to those groups. These UUIDs are different on different Gerrit sites. |
| 99 | |
| 100 | Gerrit comes with two predefined groups: |
| 101 | |
| 102 | * Administrators |
| Patrick Hiesel | e587c40 | 2020-08-07 16:11:29 +0200 | [diff] [blame] | 103 | * Service Users |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 104 | |
| 105 | |
| 106 | [[administrators]] |
| 107 | === Administrators |
| 108 | |
| Edwin Kempin | 1728742 | 2016-04-07 08:44:39 +0200 | [diff] [blame] | 109 | This is a predefined group, created on Gerrit site initialization, that |
| 110 | has the capability link:access-control.html#capability_administrateServer[ |
| 111 | 'Administrate Server'] assigned. |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 112 | |
| Edwin Kempin | 1728742 | 2016-04-07 08:44:39 +0200 | [diff] [blame] | 113 | It is a normal Gerrit group without magic. This means if you remove |
| 114 | the 'Administrate Server' capability from it, its members are no longer |
| 115 | Gerrit administrators, despite the group name. The group may also be |
| 116 | renamed. |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 117 | |
| Antoine Musso | c81f668 | 2020-12-22 12:01:53 +0100 | [diff] [blame] | 118 | anchor:non-interactive_users[] |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 119 | |
| Antoine Musso | c81f668 | 2020-12-22 12:01:53 +0100 | [diff] [blame] | 120 | [[service_users]] |
| Patrick Hiesel | e587c40 | 2020-08-07 16:11:29 +0200 | [diff] [blame] | 121 | === Service Users |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 122 | |
| 123 | This is the Gerrit "batch" identity. The capabilities |
| 124 | link:access-control.html#capability_priority['Priority BATCH'] and |
| 125 | link:access-control.html#capability_streamEvents['Stream Events'] |
| 126 | are assigned to this predefined group on Gerrit site creation. |
| 127 | |
| 128 | The members of this group are not expected to perform interactive |
| 129 | operations on the Gerrit web front-end. |
| 130 | |
| 131 | However, sometimes such a user may need a separate thread pool in |
| 132 | order to prevent it from grabbing threads from the interactive users. |
| 133 | |
| 134 | These users live in a second thread pool, which separates operations |
| Patrick Hiesel | e587c40 | 2020-08-07 16:11:29 +0200 | [diff] [blame] | 135 | made by the service users from the ones made by the interactive |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 136 | users. This ensures that the interactive users can keep working when |
| 137 | resources are tight. |
| 138 | |
| Antoine Musso | c81f668 | 2020-12-22 12:01:53 +0100 | [diff] [blame] | 139 | Before Gerrit 3.3, the 'Service Users' group was named 'Non-Interactive Users'. |
| Jonathan Nieder | 2b2d62b | 2014-05-07 19:40:58 -0700 | [diff] [blame] | 140 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 141 | == Account Groups |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 142 | |
| 143 | Account groups contain a list of zero or more user account members, |
| 144 | added individually by a group owner. Any user account listed as |
| 145 | a group member is given any access rights granted to the group. |
| 146 | |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 147 | Every group has one other group designated as its owner. Users who |
| 148 | are members of the owner group can: |
| 149 | |
| Fredrik Luthander | 8fa3d26 | 2011-11-07 17:04:01 +0100 | [diff] [blame] | 150 | * Add users and other groups to this group |
| 151 | * Remove users and other groups from this group |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 152 | * Change the name of this group |
| 153 | * Change the description of this group |
| 154 | * Change the owner of this group, to another group |
| 155 | |
| 156 | It is permissible for a group to own itself, allowing the group |
| 157 | members to directly manage who their peers are. |
| 158 | |
| 159 | Newly created groups are automatically created as owning themselves, |
| 160 | with the creating user as the only member. This permits the group |
| 161 | creator to add additional members, and change the owner to another |
| 162 | group if desired. |
| 163 | |
| 164 | It is somewhat common to create two groups at the same time, |
| 165 | for example `Foo` and `Foo-admin`, where the latter group |
| 166 | `Foo-admin` owns both itself and also group `Foo`. Users who |
| 167 | are members of `Foo-admin` can thus control the membership of |
| 168 | `Foo`, without actually having the access rights granted to `Foo`. |
| 169 | This configuration can help prevent accidental submits when the |
| 170 | members of `Foo` have submit rights on a project, and the members of |
| 171 | `Foo-admin` typically do not need to have such rights. |
| 172 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 173 | |
| Thanh Ha | 6eed43f | 2013-04-11 21:03:55 -0400 | [diff] [blame] | 174 | [[ldap_groups]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 175 | == LDAP Groups |
| Thanh Ha | 6eed43f | 2013-04-11 21:03:55 -0400 | [diff] [blame] | 176 | |
| 177 | LDAP groups are Account Groups that are maintained inside of your |
| 178 | LDAP instance. If you are using LDAP to manage your groups they will |
| 179 | not appear in the Groups list. However you can use them just like |
| 180 | regular Account Groups by prefixing your group with "ldap/" in the |
| 181 | Access Control for a project. For example "ldap/foo-project" will |
| 182 | add the LDAP "foo-project" group to the access list. |
| 183 | |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 184 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 185 | == Project Access Control Lists |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 186 | |
| lincoln | fa7bdd3 | 2010-04-22 14:23:05 -0300 | [diff] [blame] | 187 | A system wide access control list affecting all projects is stored in |
| Shawn O. Pearce | a063182 | 2011-06-14 11:18:18 -0700 | [diff] [blame] | 188 | project "`All-Projects`". This inheritance can be configured |
| lincoln | fa7bdd3 | 2010-04-22 14:23:05 -0300 | [diff] [blame] | 189 | through link:cmd-set-project-parent.html[gerrit set-project-parent]. |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 190 | |
| Gal Paikin | e871aaa | 2020-06-26 14:05:53 +0300 | [diff] [blame] | 191 | When projects are set as parent projects, the child projects inherit |
| 192 | all of the parent's access rights. "`All-Projects`" is treated as a |
| 193 | parent of all projects. |
| 194 | |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 195 | Per-project access control lists are also supported. |
| 196 | |
| 197 | Users are permitted to use the maximum range granted to any of their |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 198 | groups on a label. For example, a user is a member of `Foo Leads`, and |
| 199 | the following ACLs are granted on a project: |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 200 | |
| Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 201 | [options="header"] |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 202 | |=================================================== |
| 203 | |Group |Reference Name |Label |Range |
| 204 | |Anonymous Users |refs/heads/* |Code-Review|-1..+1 |
| 205 | |Registered Users|refs/heads/* |Code-Review|-1..+2 |
| 206 | |Foo Leads |refs/heads/* |Code-Review|-2..0 |
| 207 | |=================================================== |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 208 | |
| 209 | Then the effective range permitted to be used by the user is |
| 210 | `-2..+2`, as the user is a member of all three groups (see above |
| 211 | about the system groups) and the maximum range is chosen (so the |
| 212 | lowest value granted to any group, and the highest value granted |
| 213 | to any group). |
| 214 | |
| Nico Sallembien | ee6eaf0 | 2010-02-01 13:24:49 -0800 | [diff] [blame] | 215 | Reference-level access control is also possible. |
| 216 | |
| 217 | Permissions can be set on a single reference name to match one |
| 218 | branch (e.g. `refs/heads/master`), or on a reference namespace |
| Jonathan Nieder | 5758f18 | 2015-03-30 11:28:55 -0700 | [diff] [blame] | 219 | (e.g. `+refs/heads/*+`) to match any branch starting with that |
| Sebastian Schuberth | 7bcfbaf | 2016-05-23 14:06:03 +0200 | [diff] [blame] | 220 | prefix. So a permission with `+refs/heads/*+` will match all of |
| 221 | `refs/heads/master`, `refs/heads/experimental`, `refs/heads/release/1.0` etc. |
| Nico Sallembien | ee6eaf0 | 2010-02-01 13:24:49 -0800 | [diff] [blame] | 222 | |
| Shawn O. Pearce | 6d6d451 | 2010-07-15 11:42:34 -0700 | [diff] [blame] | 223 | Reference names can also be described with a regular expression |
| Edwin Kempin | a2bf083 | 2011-09-08 14:23:30 +0200 | [diff] [blame] | 224 | by prefixing the reference name with `^`. For example |
| 225 | `^refs/heads/[a-z]{1,8}` matches all lower case branch names |
| Shawn O. Pearce | 6d6d451 | 2010-07-15 11:42:34 -0700 | [diff] [blame] | 226 | between 1 and 8 characters long. Within a regular expression `.` |
| 227 | is a wildcard matching any character, but may be escaped as `\.`. |
| Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 228 | The link:http://www.brics.dk/automaton/[dk.brics.automaton library,role=external,window=_blank] |
| Magnus Bäck | e561183 | 2011-02-02 08:57:15 +0100 | [diff] [blame] | 229 | is used for evaluation of regular expression access control |
| 230 | rules. See the library documentation for details on this |
| Doug Claar | e852eb3 | 2016-03-18 14:43:28 -0700 | [diff] [blame] | 231 | particular regular expression flavor. One quirk is that the |
| 232 | shortest possible pattern expansion must be a valid ref name: |
| 233 | thus `^refs/heads/.*/name` will fail because `refs/heads//name` |
| 234 | is not a valid reference, but `^refs/heads/.+/name` will work. |
| Shawn O. Pearce | 6d6d451 | 2010-07-15 11:42:34 -0700 | [diff] [blame] | 235 | |
| Edwin Kempin | 311d570 | 2017-07-28 15:10:24 +0200 | [diff] [blame] | 236 | [[sharded-user-id]] |
| Edwin Kempin | ad6f15b | 2016-05-04 18:20:05 +0200 | [diff] [blame] | 237 | References can have the user name or the sharded account ID of the |
| 238 | current user automatically included, creating dynamic access controls |
| 239 | that change to match the currently logged in user. For example to |
| 240 | provide a personal sandbox space to all developers, |
| 241 | `+refs/heads/sandbox/${username}/*+` allows the user 'joe' to use |
| 242 | 'refs/heads/sandbox/joe/foo'. The sharded account ID can be used to |
| 243 | give users access to their user branch in the `All-Users` repository, |
| 244 | for example `+refs/users/${shardeduserid}+` is resolved to |
| 245 | 'refs/users/23/1011123' if the account ID of the current user is |
| 246 | `1011123`. |
| Shawn O. Pearce | 6d6d451 | 2010-07-15 11:42:34 -0700 | [diff] [blame] | 247 | |
| Nico Sallembien | ee6eaf0 | 2010-02-01 13:24:49 -0800 | [diff] [blame] | 248 | When evaluating a reference-level access right, Gerrit will use |
| Nico Sallembien | a78a37c | 2010-05-04 11:49:12 -0700 | [diff] [blame] | 249 | the full set of access rights to determine if the user |
| 250 | is allowed to perform a given action. For example, if a user is a |
| 251 | member of `Foo Leads`, they are reviewing a change destined for |
| 252 | the `refs/heads/qa` branch, and the following ACLs are granted |
| 253 | on the project: |
| Nico Sallembien | ee6eaf0 | 2010-02-01 13:24:49 -0800 | [diff] [blame] | 254 | |
| Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 255 | [options="header"] |
| Fredrik Luthander | 54abc35 | 2012-01-20 16:18:41 +0100 | [diff] [blame] | 256 | |=============================================================== |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 257 | |Group |Reference Name|Label |Range |Exclusive |
| 258 | |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 | |
| Fredrik Luthander | 54abc35 | 2012-01-20 16:18:41 +0100 | [diff] [blame] | 261 | |=============================================================== |
| Nico Sallembien | ee6eaf0 | 2010-02-01 13:24:49 -0800 | [diff] [blame] | 262 | |
| Nico Sallembien | a78a37c | 2010-05-04 11:49:12 -0700 | [diff] [blame] | 263 | Then the effective range permitted to be used by the user is |
| 264 | `-2..+2`, as the user's membership of `Foo Leads` effectively grant |
| 265 | them access to the entire reference space, thanks to the wildcard. |
| 266 | |
| 267 | Gerrit also supports exclusive reference-level access control. |
| 268 | |
| 269 | It is possible to configure Gerrit to grant an exclusive ref level |
| 270 | access control so that only users of a specific group can perform |
| Fredrik Luthander | 54abc35 | 2012-01-20 16:18:41 +0100 | [diff] [blame] | 271 | an operation on a project/reference pair. This is done by ticking |
| 272 | the exclusive flag when setting the permission for the |
| 273 | `refs/heads/qa` branch. |
| Nico Sallembien | a78a37c | 2010-05-04 11:49:12 -0700 | [diff] [blame] | 274 | |
| 275 | For example, if a user who is a member of `Foo Leads` tries to |
| 276 | review a change destined for branch `refs/heads/qa` in a project, |
| 277 | and the following ACLs are granted: |
| 278 | |
| Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 279 | [options="header"] |
| Fredrik Luthander | 54abc35 | 2012-01-20 16:18:41 +0100 | [diff] [blame] | 280 | |============================================================== |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 281 | |Group |Reference Name|Label |Range |Exclusive |
| 282 | |Registered Users|refs/heads/* |Code-Review| -1..+1 | |
| 283 | |Foo Leads |refs/heads/* |Code-Review| -2..+2 | |
| 284 | |QA Leads |refs/heads/qa |Code-Review| -2..+2 |X |
| Fredrik Luthander | 54abc35 | 2012-01-20 16:18:41 +0100 | [diff] [blame] | 285 | |============================================================== |
| Nico Sallembien | a78a37c | 2010-05-04 11:49:12 -0700 | [diff] [blame] | 286 | |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 287 | Then this user will not have `Code-Review` rights on that change, |
| Nico Sallembien | a78a37c | 2010-05-04 11:49:12 -0700 | [diff] [blame] | 288 | since there is an exclusive access right in place for the |
| 289 | `refs/heads/qa` branch. This allows locking down access for a |
| 290 | particular branch to a limited set of users, bypassing inherited |
| 291 | rights and wildcards. |
| 292 | |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 293 | In order to grant the ability to `Code-Review` to the members of |
| Nico Sallembien | a78a37c | 2010-05-04 11:49:12 -0700 | [diff] [blame] | 294 | `Foo Leads`, in `refs/heads/qa` then the following access rights |
| 295 | would be needed: |
| 296 | |
| Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 297 | [options="header"] |
| Fredrik Luthander | 54abc35 | 2012-01-20 16:18:41 +0100 | [diff] [blame] | 298 | |============================================================== |
| 299 | |Group |Reference Name|Category |Range |Exclusive |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 300 | |Registered Users|refs/heads/* |Code-Review| -1..+1 | |
| 301 | |Foo Leads |refs/heads/* |Code-Review| -2..+2 | |
| 302 | |QA Leads |refs/heads/qa |Code-Review| -2..+2 |X |
| 303 | |Foo Leads |refs/heads/qa |Code-Review| -2..+2 | |
| Fredrik Luthander | 54abc35 | 2012-01-20 16:18:41 +0100 | [diff] [blame] | 304 | |============================================================== |
| Nico Sallembien | a78a37c | 2010-05-04 11:49:12 -0700 | [diff] [blame] | 305 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 306 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 307 | === OpenID Authentication |
| Shawn O. Pearce | a229966 | 2009-02-25 14:34:40 -0800 | [diff] [blame] | 308 | |
| 309 | If the Gerrit instance is configured to use OpenID authentication, |
| 310 | an account's effective group membership will be restricted to only |
| 311 | the `Anonymous Users` and `Registered Users` groups, unless *all* |
| 312 | of its OpenID identities match one or more of the patterns listed |
| Shawn O. Pearce | d7c026d | 2009-08-05 20:11:22 -0700 | [diff] [blame] | 313 | in the `auth.trustedOpenID` list from `gerrit.config`. |
| Shawn O. Pearce | a229966 | 2009-02-25 14:34:40 -0800 | [diff] [blame] | 314 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 315 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 316 | === All Projects |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 317 | |
| Shawn O. Pearce | a063182 | 2011-06-14 11:18:18 -0700 | [diff] [blame] | 318 | Any access right granted to a group within `All-Projects` |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 319 | is automatically inherited by every other project in the same |
| 320 | Gerrit instance. These rights can be seen, but not modified, |
| 321 | in any other project's `Access` administration tab. |
| 322 | |
| Fredrik Luthander | d996088 | 2011-11-08 01:42:19 +0100 | [diff] [blame] | 323 | Only members of the groups with the `Administrate Server` capability |
| 324 | may edit the access control list for `All-Projects`. By default this |
| 325 | capability is given to the group `Administrators`, but can be given |
| 326 | to more groups. |
| Shawn O. Pearce | e2c2a22 | 2010-05-11 13:43:45 -0700 | [diff] [blame] | 327 | |
| 328 | Ownership of this project cannot be delegated to another group. |
| 329 | This restriction is by design. Granting ownership to another |
| 330 | group gives nearly the same level of access as membership in |
| 331 | `Administrators` does, as group members would be able to alter |
| Fredrik Luthander | d996088 | 2011-11-08 01:42:19 +0100 | [diff] [blame] | 332 | permissions for every managed project including global capabilities. |
| Shawn O. Pearce | e2c2a22 | 2010-05-11 13:43:45 -0700 | [diff] [blame] | 333 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 334 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 335 | === Per-Project |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 336 | |
| Fredrik Luthander | da86788 | 2011-12-21 18:28:40 +0100 | [diff] [blame] | 337 | The per-project ACL is evaluated before the global `All-Projects` ACL, |
| 338 | permitting some limited override capability to project owners. This |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 339 | behavior is generally only useful on the `Read` category when |
| 340 | granting 'DENY' within a specific project to deny a group access. |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 341 | |
| 342 | |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 343 | [[references]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 344 | == Special and magic references |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 345 | |
| 346 | The reference namespaces used in git are generally two, one for branches and |
| 347 | one for tags: |
| 348 | |
| 349 | * +refs/heads/*+ |
| 350 | * +refs/tags/*+ |
| 351 | |
| 352 | However, every reference under +refs/*+ is really available, and in Gerrit this |
| 353 | opportunity for giving other refs a special meaning is used. In Gerrit they |
| 354 | are sometimes used as magic/virtual references that give the push to Gerrit a |
| 355 | special meaning. |
| 356 | |
| 357 | |
| 358 | [[references_special]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 359 | === Special references |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 360 | |
| 361 | The special references have content that's either generated by Gerrit or |
| 362 | contains important project configuration that Gerrit needs. When making |
| 363 | changes to these references, Gerrit will take extra precautions to verify the |
| 364 | contents compatibility at upload time. |
| 365 | |
| 366 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 367 | ==== refs/changes/* |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 368 | |
| 369 | Under this namespace each uploaded patch set for every change gets a static |
| 370 | reference in their git. The format is convenient but still intended to scale to |
| 371 | hundreds of thousands of patch sets. To access a given patch set you will |
| 372 | need the change number and patch set number. |
| 373 | |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 374 | -- |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 375 | 'refs/changes/'<last two digits of change number>/ |
| 376 | <change number>/ |
| 377 | <patch set number> |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 378 | -- |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 379 | |
| 380 | You can also find these static references linked on the page of each change. |
| 381 | |
| 382 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 383 | ==== refs/meta/config |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 384 | |
| Matt Baker | 3a40c6d | 2013-11-26 21:01:17 -0700 | [diff] [blame] | 385 | This is where the Gerrit configuration of each project resides. This |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 386 | branch contains several files of importance: +project.config+, +groups+ and |
| Matt Baker | 3a40c6d | 2013-11-26 21:01:17 -0700 | [diff] [blame] | 387 | +rules.pl+. Together they control access and behavior during the change |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 388 | review process. |
| 389 | |
| 390 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 391 | ==== refs/meta/dashboards/* |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 392 | |
| 393 | There's a dedicated page where you can read more about |
| 394 | link:user-dashboards.html[User Dashboards]. |
| 395 | |
| 396 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 397 | ==== refs/notes/review |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 398 | |
| 399 | Autogenerated copy of review notes for all changes in the git. Each log entry |
| 400 | on the refs/notes/review branch also references the patch set on which the |
| 401 | review is made. This functionality is provided by the review-notes plugin. |
| 402 | |
| 403 | |
| 404 | [[references_magic]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 405 | === Magic references |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 406 | |
| 407 | These are references with added functionality to them compared to a regular |
| 408 | git push operation. |
| 409 | |
| Edwin Kempin | 4bf0196 | 2014-04-16 16:47:10 +0200 | [diff] [blame] | 410 | [[refs_for]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 411 | ==== refs/for/<branch ref> |
| Fredrik Luthander | 9803025 | 2012-04-13 11:01:22 +0200 | [diff] [blame] | 412 | |
| 413 | Most prominent is the `refs/for/<branch ref>` reference which is the reference |
| 414 | upon which we build the code review intercept before submitting a commit to |
| 415 | the branch it's uploaded to. |
| 416 | |
| 417 | Further documentation on how to push can be found on the |
| 418 | link:user-upload.html#push_create[Upload changes] page. |
| 419 | |
| 420 | |
| Fredrik Luthander | 5ccf2e4 | 2013-05-08 01:06:25 +0200 | [diff] [blame] | 421 | [[access_categories]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 422 | == Access Categories |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 423 | |
| Fredrik Luthander | 5ccf2e4 | 2013-05-08 01:06:25 +0200 | [diff] [blame] | 424 | Gerrit has several permission categories that can be granted to groups |
| 425 | within projects, enabling functionality for that group's members. |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 426 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 427 | |
| Chad Horohoe | 029c85a | 2012-06-07 16:10:14 -0400 | [diff] [blame] | 428 | [[category_abandon]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 429 | === Abandon |
| Chad Horohoe | 029c85a | 2012-06-07 16:10:14 -0400 | [diff] [blame] | 430 | |
| 431 | This category controls whether users are allowed to abandon changes |
| 432 | to projects in Gerrit. It can give permission to abandon a specific |
| 433 | change to a given ref. |
| 434 | |
| Aaron Gable | b9b4ba9 | 2016-11-08 14:44:36 -0800 | [diff] [blame] | 435 | The uploader of a change, anyone granted the <<category_owner,`Owner`>> |
| 436 | permission at the ref or project level, and anyone granted the |
| 437 | <<capability_administrateServer,`Administrate Server`>> |
| 438 | permission can also Abandon changes. |
| 439 | |
| David Pursehouse | c795eb1 | 2013-07-05 14:20:28 +0900 | [diff] [blame] | 440 | This also grants the permission to restore a change if the user also |
| 441 | has link:#category_push[push permission] on the change's destination |
| 442 | ref. |
| Chad Horohoe | 35ced0a | 2012-06-27 19:20:34 -0400 | [diff] [blame] | 443 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 444 | |
| Fredrik Luthander | e9eeeea | 2011-12-08 16:45:32 +0100 | [diff] [blame] | 445 | [[category_create]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 446 | === Create Reference |
| Fredrik Luthander | e9eeeea | 2011-12-08 16:45:32 +0100 | [diff] [blame] | 447 | |
| 448 | The create reference category controls whether it is possible to |
| 449 | create new references, branches or tags. This implies that the |
| 450 | reference must not already exist, it's not a destructive permission |
| David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 451 | in that you can't overwrite or remove any previously existing |
| Fredrik Luthander | e9eeeea | 2011-12-08 16:45:32 +0100 | [diff] [blame] | 452 | references (and also discard any commits in the process). |
| 453 | |
| 454 | It's probably most common to either permit the creation of a single |
| 455 | branch in many gits (by granting permission on a parent project), or |
| 456 | to grant this permission to a name pattern of branches. |
| 457 | |
| 458 | This permission is often given in conjunction with regular push |
| 459 | branch permissions, allowing the holder of both to create new branches |
| 460 | as well as bypass review for new commits on that branch. |
| 461 | |
| David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 462 | To push lightweight (non-annotated) tags, grant |
| Jonathan Nieder | 5758f18 | 2015-03-30 11:28:55 -0700 | [diff] [blame] | 463 | `Create Reference` for reference name `+refs/tags/*+`, as lightweight |
| Edwin Kempin | 94db6b6 | 2016-09-02 14:37:17 +0200 | [diff] [blame] | 464 | tags are implemented just like branches in Git. To push a lightweight |
| 465 | tag on a new commit (commit not reachable from any branch/tag) grant |
| Edwin Kempin | 439dd1f | 2016-09-05 16:25:12 +0200 | [diff] [blame] | 466 | `Push` permission on `+refs/tags/*+` too. The `Push` permission on |
| 467 | `+refs/tags/*+` also allows fast-forwarding of lightweight tags. |
| Fredrik Luthander | e9eeeea | 2011-12-08 16:45:32 +0100 | [diff] [blame] | 468 | |
| 469 | For example, to grant the possibility to create new branches under the |
| 470 | namespace `foo`, you have to grant this permission on |
| Jonathan Nieder | 5758f18 | 2015-03-30 11:28:55 -0700 | [diff] [blame] | 471 | `+refs/heads/foo/*+` for the group that should have it. |
| Fredrik Luthander | e9eeeea | 2011-12-08 16:45:32 +0100 | [diff] [blame] | 472 | Finally, if you plan to grant each user a personal namespace in |
| 473 | where they are free to create as many branches as they wish, you |
| 474 | should grant the create reference permission so it's possible |
| 475 | to create new branches. This is done by using the special |
| 476 | `${username}` keyword in the reference pattern, e.g. |
| Jonathan Nieder | 5758f18 | 2015-03-30 11:28:55 -0700 | [diff] [blame] | 477 | `+refs/heads/sandbox/${username}/*+`. If you do, it's also recommended |
| Fredrik Luthander | e9eeeea | 2011-12-08 16:45:32 +0100 | [diff] [blame] | 478 | you grant the users the push force permission to be able to clean up |
| 479 | stale branches. |
| 480 | |
| Edwin Kempin | 4666bd9 | 2016-09-07 11:43:59 +0200 | [diff] [blame] | 481 | [[category_delete]] |
| 482 | === Delete Reference |
| 483 | |
| 484 | The delete reference category controls whether it is possible to delete |
| 485 | references, branches or tags. It doesn't allow any other update of |
| 486 | references. |
| 487 | |
| 488 | Deletion of references is also possible if `Push` with the force option |
| 489 | is granted, however that includes the permission to fast-forward and |
| Brian Bamsch | 2f6d714 | 2017-05-23 14:41:30 -0700 | [diff] [blame] | 490 | force-update references to existing and new commits. Being able to push |
| Edwin Kempin | 4666bd9 | 2016-09-07 11:43:59 +0200 | [diff] [blame] | 491 | references for new commits is bad if bypassing of code review must be |
| 492 | prevented. |
| 493 | |
| Fredrik Luthander | e9eeeea | 2011-12-08 16:45:32 +0100 | [diff] [blame] | 494 | |
| Fredrik Luthander | 8f430f1 | 2011-12-27 13:40:43 +0100 | [diff] [blame] | 495 | [[category_forge_author]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 496 | === Forge Author |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 497 | |
| 498 | Normally Gerrit requires the author and the committer identity |
| 499 | lines in a Git commit object (or tagger line in an annotated tag) to |
| 500 | match one of the registered email addresses of the uploading user. |
| Fredrik Luthander | 8f430f1 | 2011-12-27 13:40:43 +0100 | [diff] [blame] | 501 | This permission allows users to bypass parts of that validation, which |
| 502 | may be necessary when mirroring changes from an upstream project. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 503 | |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 504 | Permits the use of an unverified author line in commit objects. |
| 505 | This can be useful when applying patches received by email from |
| 506 | 3rd parties, when cherry-picking changes written by others across |
| 507 | branches, or when amending someone else's commit to fix up a minor |
| 508 | problem before submitting. |
| Fredrik Luthander | 8f430f1 | 2011-12-27 13:40:43 +0100 | [diff] [blame] | 509 | |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 510 | By default this is granted to `Registered Users` in all projects, |
| 511 | but a site administrator may disable it if verified authorship |
| 512 | is required. |
| 513 | |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 514 | |
| Fredrik Luthander | 8f430f1 | 2011-12-27 13:40:43 +0100 | [diff] [blame] | 515 | [[category_forge_committer]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 516 | === Forge Committer |
| Fredrik Luthander | 8f430f1 | 2011-12-27 13:40:43 +0100 | [diff] [blame] | 517 | |
| 518 | Normally Gerrit requires the author and the committer identity |
| 519 | lines in a Git commit object (or tagger line in an annotated tag) to |
| 520 | match one of the registered email addresses of the uploading user. |
| 521 | This permission allows users to bypass parts of that validation, which |
| 522 | may be necessary when mirroring changes from an upstream project. |
| 523 | |
| 524 | Allows the use of an unverified committer line in commit objects, or an |
| 525 | unverified tagger line in annotated tag objects. Typically this is only |
| 526 | required when mirroring commits from an upstream project repository. |
| 527 | |
| 528 | |
| 529 | [[category_forge_server]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 530 | === Forge Server |
| Fredrik Luthander | 8f430f1 | 2011-12-27 13:40:43 +0100 | [diff] [blame] | 531 | |
| 532 | Normally Gerrit requires the author and the committer identity |
| 533 | lines in a Git commit object (or tagger line in an annotated tag) to |
| 534 | match one of the registered email addresses of the uploading user. |
| 535 | This permission allows users to bypass parts of that validation, which |
| 536 | may be necessary when mirroring changes from an upstream project. |
| 537 | |
| 538 | Allows the use of the server's own name and email on the committer |
| 539 | line of a new commit object. This should only be necessary when force |
| 540 | pushing a commit history which has been rewritten by 'git filter-branch' |
| 541 | and that contains merge commits previously created by this Gerrit Code |
| 542 | Review server. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 543 | |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 544 | |
| 545 | [[category_owner]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 546 | === Owner |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 547 | |
| 548 | The `Owner` category controls which groups can modify the project's |
| 549 | configuration. Users who are members of an owner group can: |
| 550 | |
| 551 | * Change the project description |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 552 | * Grant/revoke any access rights, including `Owner` |
| 553 | |
| Mani Chandel | 7ec4ac7 | 2013-12-10 14:50:33 +0530 | [diff] [blame] | 554 | To get SSH branch access project owners must grant an access right to a group |
| 555 | they are a member of, just like for any other user. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 556 | |
| 557 | Ownership over a particular branch subspace may be delegated by |
| 558 | entering a branch pattern. To delegate control over all branches |
| 559 | that begin with `qa/` to the QA group, add `Owner` category |
| Jonathan Nieder | 5758f18 | 2015-03-30 11:28:55 -0700 | [diff] [blame] | 560 | for reference `+refs/heads/qa/*+`. Members of the QA group can |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 561 | further refine access, but only for references that begin with |
| Fredrik Luthander | 8fa3d26 | 2011-11-07 17:04:01 +0100 | [diff] [blame] | 562 | `refs/heads/qa/`. See <<project_owners,project owners>> to find |
| 563 | out more about this role. |
| 564 | |
| Edwin Kempin | 362fc85 | 2016-12-05 17:32:04 +0100 | [diff] [blame] | 565 | For the `All-Projects` root project any `Owner` access right on |
| 566 | 'refs/*' is ignored since this permission would allow users to edit the |
| 567 | global capabilities, which is the same as being able to administrate |
| 568 | the Gerrit server (e.g. the user could assign the `Administrate Server` |
| 569 | capability to the own account). |
| 570 | |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 571 | |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 572 | [[category_push]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 573 | === Push |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 574 | |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 575 | This category controls how users are allowed to upload new commits |
| 576 | to projects in Gerrit. It can either give permission to push |
| 577 | directly into a branch, bypassing any code review process |
| 578 | that would otherwise be used. Or it may give permission to upload |
| 579 | new changes for code review, this depends on which namespace the |
| 580 | permission is granted to. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 581 | |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 582 | [[category_push_direct]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 583 | ==== Direct Push |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 584 | |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 585 | Any existing branch can be fast-forwarded to a new commit. |
| Robin Rosenberg | 524a303 | 2012-10-14 14:24:36 +0200 | [diff] [blame] | 586 | Creation of new branches is controlled by the |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 587 | link:access-control.html#category_create['Create Reference'] |
| 588 | category. Deletion of existing branches is rejected. This is the |
| 589 | safest mode as commits cannot be discarded. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 590 | |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 591 | * Force option |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 592 | + |
| Gert van Dijk | 8c5e33c | 2017-10-19 22:38:06 +0200 | [diff] [blame] | 593 | Implies <<category_delete,Delete Reference>>. Since a force push is |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 594 | effectively a delete immediately followed by a create, but performed |
| 595 | atomically on the server and logged, this option also permits forced |
| 596 | push updates to branches. Enabling this option allows existing commits |
| 597 | to be discarded from a project history. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 598 | |
| Fredrik Luthander | ea13ca5 | 2011-12-29 11:36:48 +0100 | [diff] [blame] | 599 | The push category is primarily useful for projects that only want to |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 600 | take advantage of Gerrit's access control features and do not need |
| 601 | its code review functionality. Projects that need to require code |
| 602 | reviews should not grant this category. |
| 603 | |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 604 | |
| Dave Borowitz | aa91227 | 2018-04-24 12:48:09 -0400 | [diff] [blame] | 605 | [[category_push_review]] |
| 606 | ==== Upload To Code Review |
| 607 | |
| 608 | The `Push` access right granted on the namespace |
| 609 | `refs/for/refs/heads/BRANCH` permits the user to upload a non-merge |
| 610 | commit to the project's `refs/for/BRANCH` namespace, creating a new |
| 611 | change for code review. |
| 612 | |
| 613 | A user must be able to clone or fetch the project in order to create |
| 614 | a new commit on their local system, so in practice they must also |
| 615 | have the `Read` access granted to upload a change. |
| 616 | |
| 617 | For an open source, public Gerrit installation, it is common to grant |
| 618 | `Push` for `+refs/for/refs/heads/*+` to `Registered Users` in the |
| 619 | `All-Projects` ACL. For more private installations, its common to |
| 620 | grant `Push` for `+refs/for/refs/heads/*+` to all users of a project. |
| 621 | |
| 622 | * Force option |
| 623 | + |
| 624 | The force option has no function when granted to a branch in the |
| 625 | `+refs/for/refs/heads/*+` namespace. |
| 626 | |
| 627 | |
| David Pursehouse | 596f364 | 2016-08-31 10:25:19 +0900 | [diff] [blame] | 628 | [[category_add_patch_set]] |
| 629 | === Add Patch Set |
| 630 | |
| 631 | This category controls which users are allowed to upload new patch sets to |
| 632 | existing changes. Irrespective of this permission, change owners are always |
| Dave Borowitz | 942a8fe | 2018-04-24 11:56:17 -0400 | [diff] [blame] | 633 | allowed to upload new patch sets for their changes. This permission needs to be |
| 634 | set on `refs/for/*`. |
| David Pursehouse | 596f364 | 2016-08-31 10:25:19 +0900 | [diff] [blame] | 635 | |
| Dave Borowitz | 942a8fe | 2018-04-24 11:56:17 -0400 | [diff] [blame] | 636 | By default, this permission is granted to `Registered Users` on `refs/for/*`, |
| Aaron Gable | bf7f41a | 2016-09-20 15:25:00 -0700 | [diff] [blame] | 637 | allowing all registered users to upload a new patch set to any change. Revoking |
| 638 | this permission (by granting it to no groups and setting the "Exclusive" flag) |
| 639 | will prevent users from uploading a patch set to a change they do not own. |
| David Pursehouse | 596f364 | 2016-08-31 10:25:19 +0900 | [diff] [blame] | 640 | |
| 641 | |
| Fredrik Luthander | bf56857 | 2012-01-18 11:17:00 +0100 | [diff] [blame] | 642 | [[category_push_merge]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 643 | === Push Merge Commits |
| Fredrik Luthander | bf56857 | 2012-01-18 11:17:00 +0100 | [diff] [blame] | 644 | |
| Magnus Bäck | 282c102 | 2012-04-18 15:39:17 -0400 | [diff] [blame] | 645 | The `Push Merge Commit` access right permits the user to upload merge |
| Gustaf Lundh | a28a1d2 | 2013-05-08 15:05:12 +0100 | [diff] [blame] | 646 | commits. It's an add-on to the <<category_push,Push>> access right, and |
| Magnus Bäck | 282c102 | 2012-04-18 15:39:17 -0400 | [diff] [blame] | 647 | so it won't be sufficient with only `Push Merge Commit` granted for a |
| 648 | push to happen. Some projects wish to restrict merges to being created |
| 649 | by Gerrit. By granting `Push` without `Push Merge Commit`, the only |
| Edwin Kempin | aef5d6e | 2012-01-24 09:04:54 +0100 | [diff] [blame] | 650 | merges that enter the system will be those created by Gerrit. |
| Fredrik Luthander | bf56857 | 2012-01-18 11:17:00 +0100 | [diff] [blame] | 651 | |
| Dave Borowitz | 942a8fe | 2018-04-24 11:56:17 -0400 | [diff] [blame] | 652 | The reference name connected to a `Push Merge Commit` entry must always |
| 653 | be prefixed with `refs/for/`, for example `refs/for/refs/heads/BRANCH`. |
| 654 | This applies even for an entry that complements a `Push` entry for |
| 655 | `refs/heads/BRANCH` that allows direct pushes of non-merge commits, and |
| 656 | the intention of the `Push Merge Commit` entry is to allow direct pushes |
| 657 | of merge commits. |
| 658 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 659 | |
| Fredrik Luthander | d774986 | 2012-01-20 07:29:43 +0100 | [diff] [blame] | 660 | [[category_push_annotated]] |
| Edwin Kempin | 62c1568 | 2016-09-05 14:32:38 +0200 | [diff] [blame] | 661 | [[category_create_annotated]] |
| 662 | === Create Annotated Tag |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 663 | |
| David Pursehouse | 690cebe | 2012-12-12 19:22:45 +0900 | [diff] [blame] | 664 | This category permits users to push an annotated tag object into the |
| 665 | project's repository. Typically this would be done with a command line |
| 666 | such as: |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 667 | |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 668 | ---- |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 669 | git push ssh://USER@HOST:PORT/PROJECT tag v1.0 |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 670 | ---- |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 671 | |
| David Pursehouse | 690cebe | 2012-12-12 19:22:45 +0900 | [diff] [blame] | 672 | Or: |
| 673 | |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 674 | ---- |
| David Pursehouse | 690cebe | 2012-12-12 19:22:45 +0900 | [diff] [blame] | 675 | git push https://HOST/PROJECT tag v1.0 |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 676 | ---- |
| David Pursehouse | 690cebe | 2012-12-12 19:22:45 +0900 | [diff] [blame] | 677 | |
| David Pursehouse | b429ce1 | 2012-12-12 11:04:40 +0900 | [diff] [blame] | 678 | Tags must be annotated (created with `git tag -a`), should exist in |
| 679 | the `refs/tags/` namespace, and should be new. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 680 | |
| 681 | This category is intended to be used to publish tags when a project |
| 682 | reaches a stable release point worth remembering in history. |
| 683 | |
| Fredrik Luthander | d774986 | 2012-01-20 07:29:43 +0100 | [diff] [blame] | 684 | It allows for a new annotated (unsigned) tag to be created. The |
| 685 | tagger email address must be verified for the current user. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 686 | |
| 687 | To push tags created by users other than the current user (such |
| Fredrik Luthander | d774986 | 2012-01-20 07:29:43 +0100 | [diff] [blame] | 688 | as tags mirrored from an upstream project), `Forge Committer Identity` |
| Edwin Kempin | 62c1568 | 2016-09-05 14:32:38 +0200 | [diff] [blame] | 689 | must be also granted in addition to `Create Annotated Tag`. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 690 | |
| Fredrik Luthander | d774986 | 2012-01-20 07:29:43 +0100 | [diff] [blame] | 691 | To push lightweight (non annotated) tags, grant |
| 692 | <<category_create,`Create Reference`>> for reference name |
| Jonathan Nieder | 5758f18 | 2015-03-30 11:28:55 -0700 | [diff] [blame] | 693 | `+refs/tags/*+`, as lightweight tags are implemented just like |
| Fredrik Luthander | d774986 | 2012-01-20 07:29:43 +0100 | [diff] [blame] | 694 | branches in Git. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 695 | |
| Fredrik Luthander | d774986 | 2012-01-20 07:29:43 +0100 | [diff] [blame] | 696 | To delete or overwrite an existing tag, grant `Push` with the force |
| Jonathan Nieder | 5758f18 | 2015-03-30 11:28:55 -0700 | [diff] [blame] | 697 | option enabled for reference name `+refs/tags/*+`, as deleting a tag |
| Fredrik Luthander | d774986 | 2012-01-20 07:29:43 +0100 | [diff] [blame] | 698 | requires the same permission as deleting a branch. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 699 | |
| Edwin Kempin | 94db6b6 | 2016-09-02 14:37:17 +0200 | [diff] [blame] | 700 | To push an annotated tag on a new commit (commit not reachable from any |
| 701 | branch/tag) grant `Push` permission on `+refs/tags/*+` too. |
| Edwin Kempin | 439dd1f | 2016-09-05 16:25:12 +0200 | [diff] [blame] | 702 | The `Push` permission on `+refs/tags/*+` does *not* allow updating of annotated |
| Edwin Kempin | 0a41b9c | 2016-09-05 16:38:51 +0200 | [diff] [blame] | 703 | tags, not even fast-forwarding of annotated tags. Update of annotated tags |
| 704 | is only allowed by granting `Push` with `force` option on `+refs/tags/*+`. |
| Edwin Kempin | 94db6b6 | 2016-09-02 14:37:17 +0200 | [diff] [blame] | 705 | |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 706 | |
| David Pursehouse | b429ce1 | 2012-12-12 11:04:40 +0900 | [diff] [blame] | 707 | [[category_push_signed]] |
| Edwin Kempin | 62c1568 | 2016-09-05 14:32:38 +0200 | [diff] [blame] | 708 | [[category_create_signed]] |
| 709 | === Create Signed Tag |
| David Pursehouse | b429ce1 | 2012-12-12 11:04:40 +0900 | [diff] [blame] | 710 | |
| David Pursehouse | 690cebe | 2012-12-12 19:22:45 +0900 | [diff] [blame] | 711 | This category permits users to push a PGP signed tag object into the |
| 712 | project's repository. Typically this would be done with a command |
| 713 | line such as: |
| David Pursehouse | b429ce1 | 2012-12-12 11:04:40 +0900 | [diff] [blame] | 714 | |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 715 | ---- |
| David Pursehouse | b429ce1 | 2012-12-12 11:04:40 +0900 | [diff] [blame] | 716 | git push ssh://USER@HOST:PORT/PROJECT tag v1.0 |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 717 | ---- |
| David Pursehouse | b429ce1 | 2012-12-12 11:04:40 +0900 | [diff] [blame] | 718 | |
| David Pursehouse | 690cebe | 2012-12-12 19:22:45 +0900 | [diff] [blame] | 719 | Or: |
| 720 | |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 721 | ---- |
| David Pursehouse | 690cebe | 2012-12-12 19:22:45 +0900 | [diff] [blame] | 722 | git push https://HOST/PROJECT tag v1.0 |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 723 | ---- |
| David Pursehouse | 690cebe | 2012-12-12 19:22:45 +0900 | [diff] [blame] | 724 | |
| David Pursehouse | b429ce1 | 2012-12-12 11:04:40 +0900 | [diff] [blame] | 725 | Tags must be signed (created with `git tag -s`), should exist in the |
| 726 | `refs/tags/` namespace, and should be new. |
| 727 | |
| 728 | |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 729 | [[category_read]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 730 | === Read |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 731 | |
| 732 | The `Read` category controls visibility to the project's |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 733 | changes, comments, code diffs, and Git access over SSH or HTTP. |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 734 | A user must have this access granted in order to see a project, its |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 735 | changes, or any of its data. |
| 736 | |
| Nasser Grainawi | 990284e | 2019-05-24 11:12:47 -0600 | [diff] [blame] | 737 | [[read_special_behaviors]] |
| 738 | ==== Special behaviors |
| 739 | |
| 740 | This category has multiple special behaviors: |
| 741 | |
| 742 | The per-project ACL is evaluated before the global all projects ACL. |
| 743 | If the per-project ACL has granted `Read` with 'DENY', and does not |
| 744 | otherwise grant `Read` with 'ALLOW', then a `Read` in the all projects |
| 745 | ACL is ignored. This behavior is useful to hide a handful of projects |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 746 | on an otherwise public server. |
| 747 | |
| Nasser Grainawi | 990284e | 2019-05-24 11:12:47 -0600 | [diff] [blame] | 748 | You cannot grant `Read` on the `refs/tags/` namespace. Visibility to |
| 749 | `refs/tags/` is derived from `Read` grants on refs namespaces other than |
| 750 | `refs/tags/`, `refs/changes/`, and `refs/cache-automerge/` by finding |
| 751 | tags reachable from those refs. For example, if a tag `refs/tags/test` |
| 752 | points to a commit on the branch `refs/heads/master`, then allowing |
| 753 | `Read` access to `refs/heads/master` would also allow access to |
| 754 | `refs/tags/test`. If a tag is reachable from multiple refs, allowing |
| 755 | access to any of those refs allows access to the tag. |
| 756 | |
| 757 | [[read_typical_usage]] |
| 758 | ==== Typical usage |
| 759 | |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 760 | For an open source, public Gerrit installation it is common to grant |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 761 | `Read` to `Anonymous Users` in the `All-Projects` ACL, enabling |
| 762 | casual browsing of any project's changes, as well as fetching any |
| 763 | project's repository over SSH or HTTP. New projects can be |
| 764 | temporarily hidden from public view by granting `Read` with 'DENY' |
| 765 | to `Anonymous Users` and granting `Read` to the project owner's |
| 766 | group within the per-project ACL. |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 767 | |
| 768 | For a private Gerrit installation using a trusted HTTP authentication |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 769 | source, granting `Read` to `Registered Users` may be more |
| Fredrik Luthander | db7679a | 2011-11-03 08:52:56 +0100 | [diff] [blame] | 770 | typical, enabling read access only to those users who have been |
| 771 | able to authenticate through the HTTP access controls. This may |
| 772 | be suitable in a corporate deployment if the HTTP access control |
| 773 | is already restricted to the correct set of users. |
| 774 | |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 775 | |
| Edwin Kempin | fd330fc | 2012-05-09 21:09:55 +0200 | [diff] [blame] | 776 | [[category_rebase]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 777 | === Rebase |
| Edwin Kempin | fd330fc | 2012-05-09 21:09:55 +0200 | [diff] [blame] | 778 | |
| 779 | This category permits users to rebase changes via the web UI by pushing |
| 780 | the `Rebase Change` button. |
| 781 | |
| 782 | The change owner and submitters can always rebase changes in the web UI |
| 783 | (even without having the `Rebase` access right assigned). |
| 784 | |
| 785 | Users without this access right who are able to upload new patch sets |
| 786 | can still do the rebase locally and upload the rebased commit as a new |
| 787 | patch set. |
| 788 | |
| Gal Paikin | 6c9ed95 | 2020-01-22 10:36:35 +0100 | [diff] [blame] | 789 | [[category_revert]] |
| 790 | === Revert |
| 791 | |
| 792 | This category permits users to revert changes via the web UI by pushing |
| 793 | the `Revert Change` button. |
| 794 | |
| 795 | Users without this access right who are able to upload changes can |
| 796 | still do the revert locally and upload the revert commit as a new change. |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 797 | |
| Chad Horohoe | c626f3c | 2012-09-13 11:04:20 -0700 | [diff] [blame] | 798 | [[category_remove_reviewer]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 799 | === Remove Reviewer |
| Chad Horohoe | c626f3c | 2012-09-13 11:04:20 -0700 | [diff] [blame] | 800 | |
| 801 | This category permits users to remove other users from the list of |
| 802 | reviewers on a change. |
| 803 | |
| David Pursehouse | b3d1383 | 2014-12-04 14:50:37 +0900 | [diff] [blame] | 804 | Change owners can always remove reviewers who have given a zero or positive |
| 805 | score (even without having the `Remove Reviewer` access right assigned). |
| 806 | |
| 807 | Project owners and site administrators can always remove any reviewer (even |
| 808 | without having the `Remove Reviewer` access right assigned). |
| Chad Horohoe | c626f3c | 2012-09-13 11:04:20 -0700 | [diff] [blame] | 809 | |
| 810 | Users without this access right can only remove themselves from the |
| 811 | reviewer list on a change. |
| 812 | |
| Edwin Kempin | fd330fc | 2012-05-09 21:09:55 +0200 | [diff] [blame] | 813 | |
| Fredrik Luthander | 5ccf2e4 | 2013-05-08 01:06:25 +0200 | [diff] [blame] | 814 | [[category_review_labels]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 815 | === Review Labels |
| Fredrik Luthander | 5ccf2e4 | 2013-05-08 01:06:25 +0200 | [diff] [blame] | 816 | |
| 817 | For every configured label `My-Name` in the project, there is a |
| 818 | corresponding permission `label-My-Name` with a range corresponding to |
| Shawn Pearce | 9d78312 | 2013-06-11 18:18:03 -0700 | [diff] [blame] | 819 | the defined values. There is also a corresponding `labelAs-My-Name` |
| 820 | permission that enables editing another user's label. |
| Fredrik Luthander | 5ccf2e4 | 2013-05-08 01:06:25 +0200 | [diff] [blame] | 821 | |
| 822 | Gerrit comes pre-configured with a default 'Code-Review' label that can |
| 823 | be granted to groups within projects, enabling functionality for that |
| 824 | group's members. link:config-labels.html[Custom labels] may also be |
| 825 | defined globally or on a per-project basis. |
| 826 | |
| 827 | |
| Fredrik Luthander | 5e1b51b | 2012-01-20 13:06:06 +0100 | [diff] [blame] | 828 | [[category_submit]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 829 | === Submit |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 830 | |
| David Pursehouse | 6bf46ed | 2015-02-04 20:31:23 +0900 | [diff] [blame] | 831 | This category permits users to submit changes. |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 832 | |
| 833 | Submitting a change causes it to be merged into the destination |
| 834 | branch as soon as possible, making it a permanent part of the |
| David Pursehouse | 22bd6f9 | 2014-02-20 21:11:01 +0900 | [diff] [blame] | 835 | project's history. |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 836 | |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 837 | In order to submit, all labels (such as `Verified` and `Code-Review`, |
| 838 | above) must enable submit, and also must not block it. See above for |
| 839 | details on each label. |
| Shawn O. Pearce | 4b122b8 | 2009-02-18 18:22:14 -0800 | [diff] [blame] | 840 | |
| Edwin Kempin | bfa0621 | 2013-04-04 16:06:39 +0200 | [diff] [blame] | 841 | To link:user-upload.html#auto_merge[immediately submit a change on push] |
| Dave Borowitz | 942a8fe | 2018-04-24 11:56:17 -0400 | [diff] [blame] | 842 | the caller needs to have the Submit permission on `refs/for/<ref>` |
| 843 | (e.g. on `refs/for/refs/heads/master`). |
| Edwin Kempin | bfa0621 | 2013-04-04 16:06:39 +0200 | [diff] [blame] | 844 | |
| Edwin Kempin | 1493bd6 | 2016-12-02 10:12:17 +0100 | [diff] [blame] | 845 | Submitting to the `refs/meta/config` branch is only allowed to project |
| 846 | owners. Any explicit submit permissions for non-project-owners on this |
| 847 | branch are ignored. By submitting to the `refs/meta/config` branch the |
| 848 | configuration of the project is changed, which can include changes to |
| 849 | the access rights of the project. Allowing this to be done by a |
| 850 | non-project-owner would open a security hole enabling editing of access |
| 851 | rights, and thus granting of powers beyond submitting to the |
| 852 | configuration. |
| 853 | |
| David Pursehouse | 22bd6f9 | 2014-02-20 21:11:01 +0900 | [diff] [blame] | 854 | [[category_submit_on_behalf_of]] |
| 855 | === Submit (On Behalf Of) |
| 856 | |
| 857 | This category permits users who have also been granted the `Submit` |
| Dave Borowitz | c6d143d | 2016-02-24 12:32:23 -0500 | [diff] [blame] | 858 | permission to submit changes on behalf of another user, by using the |
| 859 | `on_behalf_of` field in link:rest-api-changes.html#submit-input[SubmitInput] |
| 860 | when link:rest-api-changes.html#submit-change[submitting using the REST API]. |
| David Pursehouse | 22bd6f9 | 2014-02-20 21:11:01 +0900 | [diff] [blame] | 861 | |
| 862 | Note that this permission is named `submitAs` in the `project.config` |
| 863 | file. |
| Fredrik Luthander | bc75ef7 | 2012-01-26 15:57:08 +0100 | [diff] [blame] | 864 | |
| Edwin Kempin | 98ddc8a | 2017-02-21 11:56:08 +0100 | [diff] [blame] | 865 | [[category_view_private_changes]] |
| 866 | === View Private Changes |
| 867 | |
| Edwin Kempin | 311be60 | 2018-12-28 14:03:50 +0100 | [diff] [blame] | 868 | This category permits users to view all private changes and all change edit refs. |
| Edwin Kempin | 98ddc8a | 2017-02-21 11:56:08 +0100 | [diff] [blame] | 869 | |
| 870 | The change owner and any explicitly added reviewers can always see |
| 871 | private changes (even without having the `View Private Changes` access |
| 872 | right assigned). |
| 873 | |
| Edwin Kempin | 3e856b2 | 2020-11-04 14:45:21 +0100 | [diff] [blame] | 874 | **NOTE**: If link:config-gerrit.html#auth.skipFullRefEvaluationIfAllRefsAreVisible[ |
| 875 | auth.skipFullRefEvaluationIfAllRefsAreVisible] is `true` (which is the case by |
| 876 | default) privates changes and all change edit refs are also visible to users |
| 877 | that have read access on `refs/*`. |
| 878 | |
| David Ostrovsky | c3f6b14 | 2020-07-03 11:53:04 +0000 | [diff] [blame] | 879 | [[category_toggle_work_in_progress_state]] |
| 880 | === Toggle Work In Progress state |
| 881 | |
| 882 | This category controls who is able to flip the Work In Progress bit. |
| 883 | |
| 884 | Change owner, server administrators and project owners can always flip |
| 885 | the Work In Progress bit of the change (even without having the |
| 886 | `Toggle Work In Progress state` access right assigned). |
| David Pursehouse | be7f458 | 2012-12-12 11:21:29 +0900 | [diff] [blame] | 887 | |
| Paladox none | 580ae0e | 2017-02-12 18:15:48 +0000 | [diff] [blame] | 888 | [[category_delete_own_changes]] |
| 889 | === Delete Own Changes |
| 890 | |
| 891 | This category permits users to delete their own changes if they are not merged |
| 892 | yet. This means only own changes that are open or abandoned can be deleted. |
| 893 | |
| David Pursehouse | 42488f8 | 2018-07-05 13:24:47 +0900 | [diff] [blame] | 894 | [[category_delete_changes]] |
| 895 | === Delete Changes |
| 896 | |
| 897 | This category permits users to delete other users' changes if they are not merged |
| 898 | yet. This means only changes that are open or abandoned can be deleted. |
| 899 | |
| 900 | Having this permission implies having the link:#category_delete_own_changes[ |
| 901 | Delete Own Changes] permission. |
| 902 | |
| 903 | Administrators may always delete changes without having this permission. |
| 904 | |
| David Pursehouse | 59aee36 | 2012-11-15 17:25:17 +0900 | [diff] [blame] | 905 | [[category_edit_topic_name]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 906 | === Edit Topic Name |
| David Pursehouse | 59aee36 | 2012-11-15 17:25:17 +0900 | [diff] [blame] | 907 | |
| 908 | This category permits users to edit the topic name of a change that |
| 909 | is uploaded for review. |
| 910 | |
| 911 | The change owner, branch owners, project owners, and site administrators |
| 912 | can always edit the topic name (even without having the `Edit Topic Name` |
| 913 | access right assigned). |
| 914 | |
| Edwin Kempin | 1f77b53 | 2013-11-08 07:16:31 +0100 | [diff] [blame] | 915 | Whether the topic can be edited on closed changes can be controlled |
| 916 | by the 'Force Edit' flag. If this flag is not set the topic can only be |
| 917 | edited on open changes. |
| 918 | |
| David Pursehouse | 59aee36 | 2012-11-15 17:25:17 +0900 | [diff] [blame] | 919 | |
| David Pursehouse | de71170 | 2014-09-10 16:23:34 +0200 | [diff] [blame] | 920 | [[category_edit_hashtags]] |
| 921 | === Edit Hashtags |
| 922 | |
| Dave Borowitz | daf0f0f | 2018-03-15 10:37:54 -0400 | [diff] [blame] | 923 | This category permits users to add or remove |
| 924 | link:intro-user.html#hashtags[hashtags] on a change that is uploaded for review. |
| David Pursehouse | de71170 | 2014-09-10 16:23:34 +0200 | [diff] [blame] | 925 | |
| 926 | The change owner, branch owners, project owners, and site administrators |
| 927 | can always edit or remove hashtags (even without having the `Edit Hashtags` |
| 928 | access right assigned). |
| 929 | |
| Sven Selberg | a3ca604 | 2016-09-13 16:16:54 +0200 | [diff] [blame] | 930 | [[category_edit_assigned_to]] |
| 931 | === Edit Assignee |
| 932 | |
| 933 | This category permits users to set who is assigned to a change that is |
| 934 | uploaded for review. |
| 935 | |
| 936 | The change owner, ref owners, and the user currently assigned to a change |
| 937 | can always change the assignee. |
| David Pursehouse | de71170 | 2014-09-10 16:23:34 +0200 | [diff] [blame] | 938 | |
| Edwin Kempin | 4bf0196 | 2014-04-16 16:47:10 +0200 | [diff] [blame] | 939 | [[example_roles]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 940 | == Examples of typical roles in a project |
| Fredrik Luthander | bc75ef7 | 2012-01-26 15:57:08 +0100 | [diff] [blame] | 941 | |
| 942 | Below follows a set of typical roles on a server and which access |
| 943 | rights these roles typically should be granted. You may see them as |
| David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 944 | general guidelines for a typical way to set up your project on a |
| Fredrik Luthander | bc75ef7 | 2012-01-26 15:57:08 +0100 | [diff] [blame] | 945 | brand new Gerrit instance. |
| 946 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 947 | |
| Fredrik Luthander | bc75ef7 | 2012-01-26 15:57:08 +0100 | [diff] [blame] | 948 | [[examples_contributor]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 949 | === Contributor |
| Fredrik Luthander | bc75ef7 | 2012-01-26 15:57:08 +0100 | [diff] [blame] | 950 | |
| 951 | This is the typical user on a public server. They are able to read |
| 952 | your project and upload new changes to it. They are able to give |
| 953 | feedback on other changes as well, but are unable to block or approve |
| 954 | any changes. |
| 955 | |
| 956 | Suggested access rights to grant: |
| 957 | |
| Nasser Grainawi | 990284e | 2019-05-24 11:12:47 -0600 | [diff] [blame] | 958 | * xref:category_read[`Read`] on 'refs/heads/\*' |
| Dave Borowitz | aa91227 | 2018-04-24 12:48:09 -0400 | [diff] [blame] | 959 | * xref:category_push[`Push`] to 'refs/for/refs/heads/*' |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 960 | * link:config-labels.html#label_Code-Review[`Code-Review`] with range '-1' to '+1' for 'refs/heads/*' |
| Fredrik Luthander | bc75ef7 | 2012-01-26 15:57:08 +0100 | [diff] [blame] | 961 | |
| Fredrik Luthander | d6c5925 | 2014-03-17 00:56:04 +0100 | [diff] [blame] | 962 | If it's desired to have the possibility to upload temporarily hidden |
| 963 | changes there's a specific permission for that. This enables someone |
| 964 | to add specific reviewers for early feedback before making the change |
| David Ostrovsky | 6ffb7d9 | 2017-02-13 21:16:58 +0100 | [diff] [blame] | 965 | publicly visible. |
| Fredrik Luthander | d6c5925 | 2014-03-17 00:56:04 +0100 | [diff] [blame] | 966 | |
| Fredrik Luthander | bc75ef7 | 2012-01-26 15:57:08 +0100 | [diff] [blame] | 967 | |
| Fredrik Luthander | 654161c | 2012-01-31 14:42:36 +0100 | [diff] [blame] | 968 | [[examples_developer]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 969 | === Developer |
| Fredrik Luthander | 654161c | 2012-01-31 14:42:36 +0100 | [diff] [blame] | 970 | |
| 971 | This is the typical core developer on a public server. They are able |
| 972 | to read the project, upload changes to a branch. They are allowed to |
| 973 | push merge commits to merge branches together. Also, they are allowed |
| 974 | to forge author identity, thus handling commits belonging to others |
| 975 | than themselves, effectively allowing them to transfer commits |
| 976 | between different branches. |
| 977 | |
| 978 | They are furthermore able to code review and verify commits, and |
| 979 | eventually submit them. If you have an automated CI system that |
| 980 | builds all uploaded patch sets you might want to skip the |
| 981 | verification rights for the developer and let the CI system do that |
| 982 | exclusively. |
| 983 | |
| 984 | Suggested access rights to grant: |
| 985 | |
| Nasser Grainawi | 990284e | 2019-05-24 11:12:47 -0600 | [diff] [blame] | 986 | * xref:category_read[`Read`] on 'refs/heads/\*' |
| Dave Borowitz | aa91227 | 2018-04-24 12:48:09 -0400 | [diff] [blame] | 987 | * xref:category_push[`Push`] to 'refs/for/refs/heads/*' |
| Dave Borowitz | 942a8fe | 2018-04-24 11:56:17 -0400 | [diff] [blame] | 988 | * xref:category_push_merge[`Push merge commit`] to 'refs/for/refs/heads/*' |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 989 | * xref:category_forge_author[`Forge Author Identity`] to 'refs/heads/*' |
| 990 | * link:config-labels.html#label_Code-Review[`Label: Code-Review`] with range '-2' to '+2' for 'refs/heads/*' |
| Peter Jönsson | 3bfcae7 | 2013-07-17 22:06:32 +0200 | [diff] [blame] | 991 | * link:config-labels.html#label_Verified[`Label: Verified`] with range '-1' to '+1' for 'refs/heads/*' |
| Edwin Kempin | 7b1897c | 2015-04-16 15:13:44 +0200 | [diff] [blame] | 992 | * xref:category_submit[`Submit`] on 'refs/heads/*' |
| Fredrik Luthander | 654161c | 2012-01-31 14:42:36 +0100 | [diff] [blame] | 993 | |
| 994 | If the project is small or the developers are seasoned it might make |
| 995 | sense to give them the freedom to push commits directly to a branch. |
| 996 | |
| 997 | Optional access rights to grant: |
| 998 | |
| 999 | * <<category_push,`Push`>> to 'refs/heads/*' |
| 1000 | * <<category_push_merge,`Push merge commit`>> to 'refs/heads/*' |
| 1001 | |
| 1002 | |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1003 | [[examples_cisystem]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1004 | === CI system |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1005 | |
| Gustaf Lundh | a28a1d2 | 2013-05-08 15:05:12 +0100 | [diff] [blame] | 1006 | A typical Continuous Integration system should be able to download new changes |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1007 | to build and then leave a verdict somehow. |
| 1008 | |
| 1009 | As an example, the popular |
| Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 1010 | link:https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger[gerrit-trigger plugin,role=external,window=_blank] |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1011 | for Jenkins/Hudson can set labels at: |
| 1012 | |
| 1013 | * The start of a build |
| 1014 | * A successful build |
| 1015 | * An unstable build (tests fails) |
| 1016 | * A failed build |
| 1017 | |
| Peter Jönsson | 3bfcae7 | 2013-07-17 22:06:32 +0200 | [diff] [blame] | 1018 | Usually the range chosen for this verdict is the `Verified` label. Depending on |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1019 | the size of your project and discipline of involved developers you might want |
| Peter Jönsson | 3bfcae7 | 2013-07-17 22:06:32 +0200 | [diff] [blame] | 1020 | to limit access right to the +1 `Verified` label to the CI system only. That |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1021 | way it's guaranteed that submitted commits always get built and pass tests |
| 1022 | successfully. |
| 1023 | |
| 1024 | If the build doesn't complete successfully the CI system can set the |
| Peter Jönsson | 3bfcae7 | 2013-07-17 22:06:32 +0200 | [diff] [blame] | 1025 | `Verified` label to -1. However that means that a failed build will block |
| 1026 | submit of the change even if someone else sets `Verified` +1. Depending on the |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1027 | project and how much the CI system can be trusted for accurate results, a |
| 1028 | blocking label might not be feasible. A recommended alternative is to set the |
| 1029 | label `Code-review` to -1 instead, as it isn't a blocking label but still |
| David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 1030 | shows a red label in the Gerrit UI. Optionally, to enable the possibility to |
| 1031 | deliver different results (build error vs unstable for instance), it's also |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1032 | possible to set `Code-review` +1 as well. |
| 1033 | |
| Edwin Kempin | a2e13cf | 2012-03-30 09:02:36 +0200 | [diff] [blame] | 1034 | If pushing new changes is granted, it's possible to automate cherry-pick of |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1035 | submitted changes for upload to other branches under certain conditions. This |
| 1036 | is probably not the first step of what a project wants to automate however, |
| 1037 | and so the push right can be found under the optional section. |
| 1038 | |
| 1039 | Suggested access rights to grant, that won't block changes: |
| 1040 | |
| Nasser Grainawi | 990284e | 2019-05-24 11:12:47 -0600 | [diff] [blame] | 1041 | * xref:category_read[`Read`] on 'refs/heads/\*' |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 1042 | * link:config-labels.html#label_Code-Review[`Label: Code-Review`] with range '-1' to '0' for 'refs/heads/*' |
| Peter Jönsson | 3bfcae7 | 2013-07-17 22:06:32 +0200 | [diff] [blame] | 1043 | * link:config-labels.html#label_Verified[`Label: Verified`] with range '0' to '+1' for 'refs/heads/*' |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1044 | |
| 1045 | Optional access rights to grant: |
| 1046 | |
| Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 1047 | * link:config-labels.html#label_Code-Review[`Label: Code-Review`] with range '-1' to '+1' for 'refs/heads/*' |
| Dave Borowitz | aa91227 | 2018-04-24 12:48:09 -0400 | [diff] [blame] | 1048 | * xref:category_push[`Push`] to 'refs/for/refs/heads/*' |
| 1049 | |
| Fredrik Luthander | f2105be | 2012-01-27 12:44:05 +0100 | [diff] [blame] | 1050 | |
| Fredrik Luthander | fe72002 | 2012-03-22 17:29:39 +0100 | [diff] [blame] | 1051 | [[examples_integrator]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1052 | === Integrator |
| Fredrik Luthander | fe72002 | 2012-03-22 17:29:39 +0100 | [diff] [blame] | 1053 | |
| 1054 | Integrators are like developers but with some additional rights granted due |
| 1055 | to their administrative role in a project. They can upload or push any commit |
| 1056 | with any committer email (not just their own) and they can also create new |
| 1057 | tags and branches. |
| 1058 | |
| 1059 | Suggested access rights to grant: |
| 1060 | |
| 1061 | * <<examples_developer,Developer rights>> |
| 1062 | * <<category_push,`Push`>> to 'refs/heads/*' |
| 1063 | * <<category_push_merge,`Push merge commit`>> to 'refs/heads/*' |
| Fredrik Luthander | 404a285 | 2012-10-10 08:51:22 +0200 | [diff] [blame] | 1064 | * <<category_forge_committer,`Forge Committer Identity`>> to 'refs/for/refs/heads/*' |
| Fredrik Luthander | fe72002 | 2012-03-22 17:29:39 +0100 | [diff] [blame] | 1065 | * <<category_create,`Create Reference`>> to 'refs/heads/*' |
| Edwin Kempin | 62c1568 | 2016-09-05 14:32:38 +0200 | [diff] [blame] | 1066 | * <<category_create_annotated,`Create Annotated Tag`>> to 'refs/tags/*' |
| Fredrik Luthander | fe72002 | 2012-03-22 17:29:39 +0100 | [diff] [blame] | 1067 | |
| 1068 | |
| Fredrik Luthander | 9c64536 | 2012-03-22 18:10:42 +0100 | [diff] [blame] | 1069 | [[examples_project-owner]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1070 | === Project owner |
| Fredrik Luthander | 9c64536 | 2012-03-22 18:10:42 +0100 | [diff] [blame] | 1071 | |
| 1072 | The project owner is almost like an integrator but with additional destructive |
| 1073 | power in the form of being able to delete branches. Optionally these users |
| 1074 | also have the power to configure access rights in gits assigned to them. |
| 1075 | |
| 1076 | [WARNING] |
| Gustaf Lundh | a28a1d2 | 2013-05-08 15:05:12 +0100 | [diff] [blame] | 1077 | These users should be really knowledgeable about git, for instance knowing why |
| Fredrik Luthander | 9c64536 | 2012-03-22 18:10:42 +0100 | [diff] [blame] | 1078 | tags never should be removed from a server. This role is granted potentially |
| 1079 | destructive access rights and cleaning up after such a mishap could be time |
| 1080 | consuming! |
| 1081 | |
| 1082 | Suggested access rights to grant: |
| 1083 | |
| 1084 | * <<examples_integrator,Integrator rights>> |
| 1085 | * <<category_push,`Push`>> with the force option to 'refs/heads/\*' and 'refs/tags/*' |
| 1086 | |
| 1087 | Optional access right to grant: |
| 1088 | |
| 1089 | * <<category_owner,`Owner`>> in the gits they mostly work with. |
| 1090 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 1091 | |
| Fredrik Luthander | 5a8e7d8 | 2012-03-22 17:29:39 +0100 | [diff] [blame] | 1092 | [[examples_administrator]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1093 | === Administrator |
| Fredrik Luthander | 5a8e7d8 | 2012-03-22 17:29:39 +0100 | [diff] [blame] | 1094 | |
| 1095 | The administrator role is the most powerful role known in the Gerrit universe. |
| Fredrik Luthander | b8eaa08 | 2014-03-17 01:02:22 +0100 | [diff] [blame] | 1096 | This role may grant itself (or others) any access right. By default the |
| Fredrik Luthander | 5a8e7d8 | 2012-03-22 17:29:39 +0100 | [diff] [blame] | 1097 | <<administrators,`Administrators` group>> is the group that has this role. |
| 1098 | |
| 1099 | Mandatory access rights: |
| 1100 | |
| 1101 | * <<capability_administrateServer,The `Administrate Server` capability>> |
| 1102 | |
| 1103 | Suggested access rights to grant: |
| 1104 | |
| Fredrik Luthander | b8eaa08 | 2014-03-17 01:02:22 +0100 | [diff] [blame] | 1105 | * <<examples_project-owner,`Project owner rights`>> |
| 1106 | * Any <<global_capabilities,`capabilities`>> needed by the administrator |
| Fredrik Luthander | 5a8e7d8 | 2012-03-22 17:29:39 +0100 | [diff] [blame] | 1107 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 1108 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1109 | == Enforcing site wide access policies |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1110 | |
| Jonathan Nieder | 5758f18 | 2015-03-30 11:28:55 -0700 | [diff] [blame] | 1111 | By granting the <<category_owner,`Owner`>> access right on the `+refs/*+` to a |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1112 | group, Gerrit administrators can delegate the responsibility of maintaining |
| 1113 | access rights for that project to that group. |
| 1114 | |
| 1115 | In a corporate deployment it is often necessary to enforce some access |
| 1116 | policies. An example could be that no-one can update or delete a tag, not even |
| 1117 | the project owners. The 'ALLOW' and 'DENY' rules are not enough for this |
| 1118 | purpose as project owners can grant themselves any access right they wish and, |
| 1119 | thus, effectively override any inherited access rights from the |
| 1120 | "`All-Projects`" or some other common parent project. |
| 1121 | |
| 1122 | What is needed is a mechanism to block a permission in a parent project so |
| 1123 | that even project owners cannot allow a blocked permission in their child |
| 1124 | project. Still, project owners should retain the possibility to manage all |
| 1125 | non-blocked rules as they wish. This gives best of both worlds: |
| 1126 | |
| 1127 | * Gerrit administrators can concentrate on enforcing site wide policies |
| 1128 | and providing a meaningful set of default access permissions |
| 1129 | * Project owners can manage access rights of their projects without a danger |
| 1130 | of violating a site wide policy |
| 1131 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 1132 | |
| Edwin Kempin | 60ab853 | 2013-03-27 14:33:46 +0100 | [diff] [blame] | 1133 | [[block]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1134 | === 'BLOCK' access rule |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1135 | |
| Tyler Cipriani | efd09b6 | 2019-03-27 21:36:09 -0600 | [diff] [blame] | 1136 | The 'BLOCK' rule can be used to take away rights from users. The BLOCK rule |
| 1137 | works across project inheritance, from the top down, so an administrator can |
| 1138 | use 'BLOCK' rules to enforce site-wide restrictions. |
| 1139 | |
| 1140 | For example, if a user in the 'Foo Users' group tries to push to |
| 1141 | 'refs/heads/mater' with the permissions below, that user will be blocked |
| 1142 | |
| 1143 | [options="header"] |
| 1144 | |========================================================================= |
| 1145 | |Project | Inherits From |Reference Name |Permissions | |
| 1146 | |All-Projects | - |refs/* |push = block Foo Users | |
| 1147 | |Foo | All-Projects |refs/heads/* |push = Foo Users | |
| 1148 | |========================================================================= |
| 1149 | |
| 1150 | 'BLOCK' rules are evaluated starting from the parent project, and after a 'BLOCK' |
| 1151 | rule is found to apply, further rules are ignored. Hence, in this example, the |
| 1152 | permissions on child-project is ignored. |
| 1153 | |
| 1154 | ---- |
| 1155 | All-Projects: project.config |
| 1156 | [access "refs/heads/*"] |
| 1157 | push = block group X |
| 1158 | |
| 1159 | child-project: project.config |
| 1160 | [access "refs/heads/*"] |
| 1161 | exclusiveGroupPermissions = push |
| 1162 | push = group X |
| 1163 | ---- |
| 1164 | |
| 1165 | In this case push for group 'X' will be blocked, even though the Exclusive |
| 1166 | flag was set for the child-project. |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1167 | |
| 1168 | A 'BLOCK' rule that blocks the 'push' permission blocks any type of push, |
| 1169 | force or not. A blocking force push rule blocks only force pushes, but |
| 1170 | allows non-forced pushes if an 'ALLOW' rule would have permitted it. |
| 1171 | |
| Tyler Cipriani | efd09b6 | 2019-03-27 21:36:09 -0600 | [diff] [blame] | 1172 | It is also possible to block label ranges. To block a group 'X' from voting |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1173 | '-2' and '+2', but keep their existing voting permissions for the '-1..+1' |
| 1174 | range intact we would define: |
| 1175 | |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1176 | ---- |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1177 | [access "refs/heads/*"] |
| 1178 | label-Code-Review = block -2..+2 group X |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1179 | ---- |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1180 | |
| 1181 | The interpretation of the 'min..max' range in case of a blocking rule is: block |
| 1182 | every vote from '-INFINITE..min' and 'max..INFINITE'. For the example above it |
| 1183 | means that the range '-1..+1' is not affected by this block. |
| 1184 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1185 | === 'BLOCK' and 'ALLOW' rules in the same access section |
| Sasa Zivkov | cff084b | 2013-01-15 18:52:32 +0100 | [diff] [blame] | 1186 | |
| 1187 | When an access section of a project contains a 'BLOCK' and an 'ALLOW' rule for |
| 1188 | the same permission then this 'ALLOW' rule overrides the 'BLOCK' rule: |
| 1189 | |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1190 | ---- |
| Sasa Zivkov | cff084b | 2013-01-15 18:52:32 +0100 | [diff] [blame] | 1191 | [access "refs/heads/*"] |
| 1192 | push = block group X |
| 1193 | push = group Y |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1194 | ---- |
| Sasa Zivkov | cff084b | 2013-01-15 18:52:32 +0100 | [diff] [blame] | 1195 | |
| 1196 | In this case a user which is a member of the group 'Y' will still be allowed to |
| 1197 | push to 'refs/heads/*' even if it is a member of the group 'X'. |
| 1198 | |
| Tyler Cipriani | efd09b6 | 2019-03-27 21:36:09 -0600 | [diff] [blame] | 1199 | === 'BLOCK' and 'ALLOW' rules in the same project with the Exclusive flag |
| 1200 | |
| 1201 | When a project contains a 'BLOCK' and 'ALLOW' that uses the Exclusive flag in a |
| 1202 | more specific reference, the 'ALLOW' rule with the Exclusive flag will override |
| 1203 | the 'BLOCK' rule: |
| 1204 | |
| 1205 | ---- |
| 1206 | [access "refs/*"] |
| 1207 | read = block group X |
| 1208 | |
| 1209 | [access "refs/heads/*"] |
| 1210 | exclusiveGroupPermissions = read |
| 1211 | read = group X |
| 1212 | ---- |
| 1213 | |
| 1214 | In this case a user which is a member of the group 'X' will still be allowed to |
| 1215 | read 'refs/heads/*'. |
| 1216 | |
| Michael Ochmann | 8129ece | 2016-07-08 11:25:25 +0200 | [diff] [blame] | 1217 | [NOTE] |
| 1218 | An 'ALLOW' rule overrides a 'BLOCK' rule only when both of them are |
| Sasa Zivkov | cff084b | 2013-01-15 18:52:32 +0100 | [diff] [blame] | 1219 | inside the same access section of the same project. An 'ALLOW' rule in a |
| 1220 | different access section of the same project or in any access section in an |
| 1221 | inheriting project cannot override a 'BLOCK' rule. |
| 1222 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 1223 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1224 | === Examples |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1225 | |
| 1226 | The following examples show some possible use cases for the 'BLOCK' rules. |
| 1227 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1228 | ==== Make sure no one can update or delete a tag |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1229 | |
| 1230 | This requirement is quite common in a corporate deployment where |
| 1231 | reproducibility of a build must be guaranteed. To achieve that we block 'push' |
| 1232 | permission for the <<anonymous_users,'Anonymous Users'>> in "`All-Projects`": |
| 1233 | |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1234 | ---- |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1235 | [access "refs/tags/*"] |
| 1236 | push = block group Anonymous Users |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1237 | ---- |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1238 | |
| 1239 | By blocking the <<anonymous_users,'Anonymous Users'>> we effectively block |
| 1240 | everyone as everyone is a member of that group. Note that the permission to |
| 1241 | create a tag is still necessary. Assuming that only <<category_owner,project |
| 1242 | owners>> are allowed to create tags, we would extend the example above: |
| 1243 | |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1244 | ---- |
| Sasa Zivkov | d589f46 | 2013-02-12 14:27:09 +0100 | [diff] [blame] | 1245 | [access "refs/tags/*"] |
| 1246 | push = block group Anonymous Users |
| 1247 | create = group Project Owners |
| 1248 | pushTag = group Project Owners |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1249 | ---- |
| Fredrik Luthander | 9c64536 | 2012-03-22 18:10:42 +0100 | [diff] [blame] | 1250 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 1251 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1252 | ==== Let only a dedicated group vote in a special category |
| Sasa Zivkov | cff084b | 2013-01-15 18:52:32 +0100 | [diff] [blame] | 1253 | |
| 1254 | Assume there is a more restrictive process for submitting changes in stable |
| 1255 | release branches which is manifested as a new voting category |
| 1256 | 'Release-Process'. Assume we want to make sure that only a 'Release Engineers' |
| 1257 | group can vote in this category and that even project owners cannot approve |
| 1258 | this category. We have to block everyone except the 'Release Engineers' to vote |
| 1259 | in this category and, of course, allow 'Release Engineers' to vote in that |
| 1260 | category. In the "`All-Projects`" we define the following rules: |
| 1261 | |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1262 | ---- |
| Sasa Zivkov | cff084b | 2013-01-15 18:52:32 +0100 | [diff] [blame] | 1263 | [access "refs/heads/stable*"] |
| Gustaf Lundh | a28a1d2 | 2013-05-08 15:05:12 +0100 | [diff] [blame] | 1264 | label-Release-Process = block -1..+1 group Anonymous Users |
| 1265 | label-Release-Process = -1..+1 group Release Engineers |
| Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 1266 | ---- |
| Sasa Zivkov | cff084b | 2013-01-15 18:52:32 +0100 | [diff] [blame] | 1267 | |
| David Pursehouse | 8becc2a | 2013-04-23 18:51:04 +0900 | [diff] [blame] | 1268 | [[global_capabilities]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1269 | == Global Capabilities |
| Fredrik Luthander | 80ebf9d | 2012-02-13 09:32:43 +0100 | [diff] [blame] | 1270 | |
| David Pursehouse | 8becc2a | 2013-04-23 18:51:04 +0900 | [diff] [blame] | 1271 | The global capabilities control actions that the administrators of |
| Fredrik Luthander | 80ebf9d | 2012-02-13 09:32:43 +0100 | [diff] [blame] | 1272 | the server can perform which usually affect the entire |
| 1273 | server in some way. The administrators may delegate these |
| 1274 | capabilities to trusted groups of users. |
| 1275 | |
| 1276 | Delegation of capabilities allows groups to be granted a subset of |
| 1277 | administrative capabilities without being given complete |
| 1278 | administrative control of the server. This makes it possible to |
| 1279 | keep fewer users in the administrators group, even while spreading |
| 1280 | much of the server administration burden out to more users. |
| 1281 | |
| David Pursehouse | 8becc2a | 2013-04-23 18:51:04 +0900 | [diff] [blame] | 1282 | Global capabilities are assigned to groups in the access rights settings |
| 1283 | of the root project ("`All-Projects`"). |
| 1284 | |
| Fredrik Luthander | 80ebf9d | 2012-02-13 09:32:43 +0100 | [diff] [blame] | 1285 | Below you find a list of capabilities available: |
| 1286 | |
| 1287 | |
| David Pursehouse | 11c4c5f | 2013-06-09 08:07:23 +0900 | [diff] [blame] | 1288 | [[capability_accessDatabase]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1289 | === Access Database |
| David Pursehouse | 11c4c5f | 2013-06-09 08:07:23 +0900 | [diff] [blame] | 1290 | |
| Edwin Kempin | 0f595f6 | 2018-12-10 11:48:42 +0100 | [diff] [blame] | 1291 | Allow users to view code review metadata refs in repositories. |
| David Pursehouse | 11c4c5f | 2013-06-09 08:07:23 +0900 | [diff] [blame] | 1292 | |
| 1293 | |
| Fredrik Luthander | 426885f | 2012-02-13 09:56:57 +0100 | [diff] [blame] | 1294 | [[capability_administrateServer]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1295 | === Administrate Server |
| Fredrik Luthander | 426885f | 2012-02-13 09:56:57 +0100 | [diff] [blame] | 1296 | |
| 1297 | This is in effect the owner and administrator role of the Gerrit |
| Edwin Kempin | 1728742 | 2016-04-07 08:44:39 +0200 | [diff] [blame] | 1298 | instance. Any members of a group granted this capability will be |
| Fredrik Luthander | 426885f | 2012-02-13 09:56:57 +0100 | [diff] [blame] | 1299 | able to grant any access right to any group. They will also have all |
| 1300 | capabilities granted to them automatically. |
| 1301 | |
| Edwin Kempin | 1728742 | 2016-04-07 08:44:39 +0200 | [diff] [blame] | 1302 | In most installations only those users who have direct filesystem and |
| 1303 | database access should be granted this capability. |
| 1304 | |
| 1305 | This capability does not imply any other access rights. Users that have |
| 1306 | this capability do not automatically get code review approval or submit |
| 1307 | rights in projects. This is a feature designed to permit administrative |
| 1308 | users to otherwise access Gerrit as any other normal user would, |
| 1309 | without needing two different accounts. |
| 1310 | |
| Fredrik Luthander | 426885f | 2012-02-13 09:56:57 +0100 | [diff] [blame] | 1311 | |
| Bruce Zu | 4512fe6 | 2014-11-18 17:39:41 +0800 | [diff] [blame] | 1312 | [[capability_batchChangesLimit]] |
| 1313 | === Batch Changes Limit |
| 1314 | |
| 1315 | Allow site administrators to configure the batch changes limit for |
| 1316 | users to override the system config |
| 1317 | link:config-gerrit.html#receive.maxBatchChanges['receive.maxBatchChanges']. |
| 1318 | |
| 1319 | Administrators can add a global block to `All-Projects` with group(s) |
| 1320 | that should have different limits. |
| 1321 | |
| 1322 | When applying a batch changes limit to a user the largest value |
| 1323 | granted by any of their groups is used. 0 means no limit. |
| 1324 | |
| 1325 | |
| Fredrik Luthander | b02afca | 2012-02-13 09:59:48 +0100 | [diff] [blame] | 1326 | [[capability_createAccount]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1327 | === Create Account |
| Fredrik Luthander | b02afca | 2012-02-13 09:59:48 +0100 | [diff] [blame] | 1328 | |
| Fredrik Luthander | 79d3815 | 2012-03-13 09:52:22 +0100 | [diff] [blame] | 1329 | Allow link:cmd-create-account.html[account creation over the ssh prompt]. |
| Fredrik Luthander | b02afca | 2012-02-13 09:59:48 +0100 | [diff] [blame] | 1330 | This capability allows the granted group members to create non-interactive |
| 1331 | service accounts. These service accounts are generally used for automation |
| 1332 | and made to be members of the |
| Patrick Hiesel | e587c40 | 2020-08-07 16:11:29 +0200 | [diff] [blame] | 1333 | link:access-control.html#service_users['Service users'] group. |
| Fredrik Luthander | b02afca | 2012-02-13 09:59:48 +0100 | [diff] [blame] | 1334 | |
| 1335 | |
| Fredrik Luthander | 79d3815 | 2012-03-13 09:52:22 +0100 | [diff] [blame] | 1336 | [[capability_createGroup]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1337 | === Create Group |
| Fredrik Luthander | 79d3815 | 2012-03-13 09:52:22 +0100 | [diff] [blame] | 1338 | |
| 1339 | Allow group creation. Groups are used to grant users access to different |
| 1340 | actions in projects. This capability allows the granted group members to |
| Gal Paikin | b64e25b | 2020-04-06 13:44:12 +0200 | [diff] [blame] | 1341 | either link:cmd-create-group.html[create new groups via ssh] or via the web UI |
| 1342 | by navigating at the top of the page to BROWSE -> Groups, and then pushing the |
| 1343 | "CREATE NEW" button. |
| Fredrik Luthander | 79d3815 | 2012-03-13 09:52:22 +0100 | [diff] [blame] | 1344 | |
| 1345 | |
| 1346 | [[capability_createProject]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1347 | === Create Project |
| Fredrik Luthander | 79d3815 | 2012-03-13 09:52:22 +0100 | [diff] [blame] | 1348 | |
| 1349 | Allow project creation. This capability allows the granted group to |
| 1350 | either link:cmd-create-project.html[create new git projects via ssh] |
| 1351 | or via the web UI. |
| 1352 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 1353 | |
| Sasa Zivkov | 812f489 | 2012-06-21 16:25:21 +0200 | [diff] [blame] | 1354 | [[capability_emailReviewers]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1355 | === Email Reviewers |
| Sasa Zivkov | 812f489 | 2012-06-21 16:25:21 +0200 | [diff] [blame] | 1356 | |
| 1357 | Allow or deny sending email to change reviewers and watchers. This can be used |
| 1358 | to deny build bots from emailing reviewers and people who watch the change. |
| 1359 | Instead, only the authors of the change and those who starred it will be |
| 1360 | emailed. The allow rules are evaluated before deny rules, however the default |
| 1361 | is to allow emailing, if no explicit rule is matched. |
| Fredrik Luthander | 79d3815 | 2012-03-13 09:52:22 +0100 | [diff] [blame] | 1362 | |
| Fredrik Luthander | a8aa9c5 | 2013-05-09 14:50:39 +0200 | [diff] [blame] | 1363 | |
| Fredrik Luthander | 74ad0d0 | 2012-03-13 13:06:30 +0100 | [diff] [blame] | 1364 | [[capability_flushCaches]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1365 | === Flush Caches |
| Fredrik Luthander | 74ad0d0 | 2012-03-13 13:06:30 +0100 | [diff] [blame] | 1366 | |
| Fredrik Luthander | 4860300 | 2012-03-21 18:17:17 +0100 | [diff] [blame] | 1367 | Allow the flushing of Gerrit's caches. This capability allows the granted |
| Fredrik Luthander | 74ad0d0 | 2012-03-13 13:06:30 +0100 | [diff] [blame] | 1368 | group to link:cmd-flush-caches.html[flush some or all Gerrit caches via ssh]. |
| 1369 | |
| 1370 | [NOTE] |
| 1371 | This capability doesn't imply permissions to the show-caches command. For that |
| 1372 | you need the <<capability_viewCaches,view caches capability>>. |
| 1373 | |
| 1374 | |
| Fredrik Luthander | 4684302 | 2012-03-13 16:11:02 +0100 | [diff] [blame] | 1375 | [[capability_kill]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1376 | === Kill Task |
| Fredrik Luthander | 4684302 | 2012-03-13 16:11:02 +0100 | [diff] [blame] | 1377 | |
| 1378 | Allow the operation of the link:cmd-kill.html[kill command over ssh]. The |
| 1379 | kill command ends tasks that currently occupy the Gerrit server, usually |
| 1380 | a replication task or a user initiated task such as an upload-pack or |
| Gustaf Lundh | a28a1d2 | 2013-05-08 15:05:12 +0100 | [diff] [blame] | 1381 | receive-pack. |
| Fredrik Luthander | 4684302 | 2012-03-13 16:11:02 +0100 | [diff] [blame] | 1382 | |
| Dave Borowitz | 664d040 | 2015-06-11 15:35:48 -0400 | [diff] [blame] | 1383 | [[capability_maintainServer]] |
| 1384 | === Maintain Server |
| 1385 | |
| 1386 | Allow basic, constrained server maintenance tasks, such as flushing caches and |
| 1387 | reindexing changes. Does not grant arbitrary database access, read/write, or |
| 1388 | ACL management permissions, as might the |
| 1389 | <<capability_administrateServer,administrate server capability>>. |
| 1390 | |
| 1391 | Implies the following capabilities: |
| 1392 | |
| 1393 | * <<capability_flushCaches,Flush Caches>> |
| 1394 | * <<capability_kill,Kill Task>> |
| 1395 | * <<capability_runGC,Run Garbage Collection>> |
| 1396 | * <<capability_viewCaches,View Caches>> |
| 1397 | * <<capability_viewQueue,View Queue>> |
| 1398 | |
| David Ostrovsky | aa49e27 | 2014-07-22 00:55:47 +0200 | [diff] [blame] | 1399 | [[capability_modifyAccount]] |
| 1400 | === Modify Account |
| 1401 | |
| 1402 | Allow to link:cmd-set-account.html[modify accounts over the ssh prompt]. |
| 1403 | This capability allows the granted group members to modify any user account |
| Edwin Kempin | ed77716 | 2017-11-15 08:23:40 -0800 | [diff] [blame] | 1404 | setting. In addition this capability is required to view secondary emails |
| 1405 | of other accounts. |
| Fredrik Luthander | 4684302 | 2012-03-13 16:11:02 +0100 | [diff] [blame] | 1406 | |
| 1407 | [[capability_priority]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1408 | === Priority |
| Fredrik Luthander | 4684302 | 2012-03-13 16:11:02 +0100 | [diff] [blame] | 1409 | |
| 1410 | This capability allows users to use |
| 1411 | link:config-gerrit.html#sshd.batchThreads[the thread pool reserved] for |
| Patrick Hiesel | e587c40 | 2020-08-07 16:11:29 +0200 | [diff] [blame] | 1412 | link:access-control.html#service_users['Service Users']. |
| Fredrik Luthander | 4684302 | 2012-03-13 16:11:02 +0100 | [diff] [blame] | 1413 | It's a binary value in that granted users either have access to the thread |
| 1414 | pool, or they don't. |
| 1415 | |
| 1416 | There are three modes for this capability and they're listed by rising |
| 1417 | priority: |
| 1418 | |
| 1419 | No capability configured.:: |
| 1420 | The user isn't a member of a group with any priority capability granted. By |
| 1421 | default the user is then in the 'INTERACTIVE' thread pool. |
| 1422 | |
| 1423 | 'BATCH':: |
| Patrick Hiesel | e587c40 | 2020-08-07 16:11:29 +0200 | [diff] [blame] | 1424 | If there's a thread pool configured for 'Service Users' and a user is |
| Fredrik Luthander | 4684302 | 2012-03-13 16:11:02 +0100 | [diff] [blame] | 1425 | granted the priority capability with the 'BATCH' mode selected, the user ends |
| 1426 | up in the separate batch user thread pool. This is true unless the user is |
| 1427 | also granted the below 'INTERACTIVE' option. |
| 1428 | |
| 1429 | 'INTERACTIVE':: |
| 1430 | If a user is granted the priority capability with the 'INTERACTIVE' option, |
| 1431 | regardless if they also have the 'BATCH' option or not, they are in the |
| 1432 | 'INTERACTIVE' thread pool. |
| 1433 | |
| 1434 | |
| Fredrik Luthander | 80ebf9d | 2012-02-13 09:32:43 +0100 | [diff] [blame] | 1435 | [[capability_queryLimit]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1436 | === Query Limit |
| Fredrik Luthander | 80ebf9d | 2012-02-13 09:32:43 +0100 | [diff] [blame] | 1437 | |
| 1438 | Allow site administrators to configure the query limit for users to |
| 1439 | be above the default hard-coded value of 500. Administrators can add |
| David Pursehouse | b5d99aaf | 2013-08-09 11:02:48 +0900 | [diff] [blame] | 1440 | a global block to `All-Projects` with group(s) that should have different |
| 1441 | limits. |
| Fredrik Luthander | 80ebf9d | 2012-02-13 09:32:43 +0100 | [diff] [blame] | 1442 | |
| 1443 | When applying a query limit to a user the largest value granted by |
| 1444 | any of their groups is used. |
| 1445 | |
| 1446 | This limit applies not only to the link:cmd-query.html[`gerrit query`] |
| David Pursehouse | 799dcfe | 2020-05-27 11:42:44 +0900 | [diff] [blame] | 1447 | command, but also to the web UI results pagination size. |
| Fredrik Luthander | 80ebf9d | 2012-02-13 09:32:43 +0100 | [diff] [blame] | 1448 | |
| 1449 | |
| Sabari Ajay Kumar | da8a8ef | 2018-11-24 23:40:57 -0800 | [diff] [blame] | 1450 | [[capability_readAs]] |
| 1451 | === Read As |
| 1452 | |
| 1453 | Allow users to impersonate any user to see which refs they can read. |
| 1454 | |
| 1455 | |
| Shawn Pearce | bb027b0 | 2013-06-10 14:35:39 -0700 | [diff] [blame] | 1456 | [[capability_runAs]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1457 | === Run As |
| Shawn Pearce | bb027b0 | 2013-06-10 14:35:39 -0700 | [diff] [blame] | 1458 | |
| Shawn Pearce | f3ffd08 | 2013-06-12 11:21:35 -0700 | [diff] [blame] | 1459 | Allow users to impersonate any other user with the `X-Gerrit-RunAs` |
| 1460 | HTTP header on REST API calls, or the link:cmd-suexec.html[suexec] |
| 1461 | SSH command. |
| 1462 | |
| 1463 | When impersonating an administrator the Administrate Server capability |
| 1464 | is not honored. This security feature tries to prevent a role with |
| 1465 | Run As capability from modifying the access controls in All-Projects, |
| 1466 | however modification may still be possible if the impersonated user |
| 1467 | has permission to push or submit changes on `refs/meta/config`. Run |
| 1468 | As also blocks using most capabilities including Create User, Run |
| 1469 | Garbage Collection, etc., unless the capability is also explicitly |
| 1470 | granted to a group the administrator is a member of. |
| 1471 | |
| 1472 | Administrators do not automatically inherit this capability; it must |
| 1473 | be explicitly granted. |
| Shawn Pearce | bb027b0 | 2013-06-10 14:35:39 -0700 | [diff] [blame] | 1474 | |
| 1475 | |
| Edwin Kempin | 619169b | 2012-02-09 15:47:52 +0100 | [diff] [blame] | 1476 | [[capability_runGC]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1477 | === Run Garbage Collection |
| Edwin Kempin | 619169b | 2012-02-09 15:47:52 +0100 | [diff] [blame] | 1478 | |
| 1479 | Allow users to run the Git garbage collection for the repositories of |
| 1480 | all projects. |
| 1481 | |
| 1482 | |
| Ed Bartosh | d168b81 | 2013-04-13 20:15:58 +0300 | [diff] [blame] | 1483 | [[capability_streamEvents]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1484 | === Stream Events |
| Ed Bartosh | d168b81 | 2013-04-13 20:15:58 +0300 | [diff] [blame] | 1485 | |
| 1486 | Allow performing streaming of Gerrit events. This capability |
| 1487 | allows the granted group to |
| 1488 | link:cmd-stream-events.html[stream Gerrit events via ssh]. |
| 1489 | |
| 1490 | |
| Han-Wen Nienhuys | a0ce3bb | 2018-04-17 14:35:10 +0200 | [diff] [blame] | 1491 | [[capability_viewAccess]] |
| 1492 | === View Access |
| 1493 | |
| 1494 | Allow checking access rights for arbitrary (user, project) pairs, |
| 1495 | using the link:rest-api-projects.html#check-access[check.access] |
| 1496 | endpoint |
| 1497 | |
| Dave Borowitz | f3548a9 | 2014-02-20 11:02:19 -0800 | [diff] [blame] | 1498 | [[capability_viewAllAccounts]] |
| 1499 | === View All Accounts |
| 1500 | |
| 1501 | Allow viewing all accounts for purposes of auto-completion, regardless |
| 1502 | of link:config-gerrit.html#accounts.visibility[accounts.visibility] |
| 1503 | setting. |
| 1504 | |
| Edwin Kempin | ed77716 | 2017-11-15 08:23:40 -0800 | [diff] [blame] | 1505 | This capability allows to view all accounts but not all account data. |
| 1506 | E.g. secondary emails of all accounts can only be viewed with the |
| 1507 | link:#capability_modifyAccount[Modify Account] capability. |
| 1508 | |
| Dave Borowitz | f3548a9 | 2014-02-20 11:02:19 -0800 | [diff] [blame] | 1509 | |
| Fredrik Luthander | 9c7da66 | 2012-03-13 17:49:27 +0100 | [diff] [blame] | 1510 | [[capability_viewCaches]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1511 | === View Caches |
| Fredrik Luthander | 9c7da66 | 2012-03-13 17:49:27 +0100 | [diff] [blame] | 1512 | |
| Fredrik Luthander | 4860300 | 2012-03-21 18:17:17 +0100 | [diff] [blame] | 1513 | Allow querying for status of Gerrit's internal caches. This capability allows |
| Fredrik Luthander | 9c7da66 | 2012-03-13 17:49:27 +0100 | [diff] [blame] | 1514 | the granted group to |
| 1515 | link:cmd-show-caches.html[look at some or all Gerrit caches via ssh]. |
| 1516 | |
| 1517 | |
| Fredrik Luthander | 4860300 | 2012-03-21 18:17:17 +0100 | [diff] [blame] | 1518 | [[capability_viewConnections]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1519 | === View Connections |
| Fredrik Luthander | 4860300 | 2012-03-21 18:17:17 +0100 | [diff] [blame] | 1520 | |
| 1521 | Allow querying for status of Gerrit's current client connections. This |
| 1522 | capability allows the granted group to |
| 1523 | link:cmd-show-connections.html[look at Gerrit's current connections via ssh]. |
| 1524 | |
| 1525 | |
| Edwin Kempin | 362b14d1 | 2014-05-09 14:18:12 +0200 | [diff] [blame] | 1526 | [[capability_viewPlugins]] |
| 1527 | === View Plugins |
| 1528 | |
| 1529 | Allow viewing the list of installed plugins. |
| 1530 | |
| 1531 | |
| Fredrik Luthander | 4860300 | 2012-03-21 18:17:17 +0100 | [diff] [blame] | 1532 | [[capability_viewQueue]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1533 | === View Queue |
| Fredrik Luthander | 4860300 | 2012-03-21 18:17:17 +0100 | [diff] [blame] | 1534 | |
| 1535 | Allow querying for status of Gerrit's internal task queue. This capability |
| 1536 | allows the granted group to |
| 1537 | link:cmd-show-queue.html[look at the Gerrit task queue via ssh]. |
| 1538 | |
| 1539 | |
| Han-Wen Nienhuys | cc3bd44 | 2018-02-01 19:30:30 +0100 | [diff] [blame] | 1540 | [[reference]] |
| 1541 | == Permission evaluation reference |
| 1542 | |
| 1543 | Permission evaluation is expressed in the following concepts: |
| 1544 | |
| 1545 | * PermisssionRule: a single combination of {ALLOW, DENY, BLOCK} and |
| 1546 | group, and optionally a vote range and an 'exclusive' bit. |
| 1547 | |
| 1548 | * Permission: groups PermissionRule by permission name. All |
| 1549 | PermissionRules for same access type (eg. "read", "push") are grouped |
| 1550 | into a Permission implicitly. The exclusive bit lives here. |
| 1551 | |
| 1552 | * AccessSection: ties a list of Permissions to a single ref pattern. |
| 1553 | Each AccessSection comes from a single project. |
| 1554 | |
| 1555 | |
| 1556 | |
| 1557 | Here is how these play out in a link:config-project-config.html[project.config] file: |
| 1558 | |
| 1559 | ---- |
| 1560 | # An AccessSection |
| 1561 | [access "refs/heads/stable/*"] |
| 1562 | exclusiveGroupPermissions = create |
| 1563 | |
| 1564 | # Each of the following lines corresponds to a PermissionRule |
| 1565 | # The next two PermissionRule together form the "read" Permission |
| 1566 | read = group Administrators |
| 1567 | read = group Registered Users |
| 1568 | |
| 1569 | # A Permission with a block and block-override |
| 1570 | create = block group Registered Users |
| 1571 | create = group Project Owners |
| 1572 | |
| 1573 | # A Permission and PermissionRule for a label |
| 1574 | label-Code-Review = -2..+2 group Project Owners |
| 1575 | ---- |
| 1576 | |
| 1577 | === Ref permissions |
| 1578 | |
| 1579 | Access to refs can be blocked, allowed or denied. |
| 1580 | |
| 1581 | ==== BLOCK |
| 1582 | |
| 1583 | For blocking access, all rules marked BLOCK are tested, and if one |
| 1584 | such rule matches, the user is denied access. |
| 1585 | |
| 1586 | The rules are ordered by inheritance, starting from All-Projects down. |
| 1587 | Within a project, more specific ref patterns come first. The downward |
| 1588 | ordering lets administrators enforce access rules across all projects |
| 1589 | in a site. |
| 1590 | |
| 1591 | BLOCK rules can have exceptions defined on the same project (eg. BLOCK |
| 1592 | anonymous users, ie. everyone, but make an exception for Admin users), |
| 1593 | either by: |
| 1594 | |
| 1595 | 1. adding ALLOW PermissionRules in the same Permission. This implies |
| 1596 | they apply to the same ref pattern. |
| 1597 | |
| 1598 | 2. adding an ALLOW Permission in the same project with a more specific |
| 1599 | ref pattern, but marked "exclusive". This allows them to apply to |
| 1600 | different ref patterns. |
| 1601 | |
| 1602 | Such additions not only bypass BLOCK rules, but they will also grant |
| 1603 | permissions when they are processed in the ALLOW/DENY processing, as |
| 1604 | described in the next subsection. |
| 1605 | |
| 1606 | ==== ALLOW |
| 1607 | |
| 1608 | For allowing access, all ALLOW/DENY rules that might apply to a ref |
| 1609 | are tested until one granting access is found, or until either an |
| 1610 | "exclusive" rule ends the search, or all rules have been tested. |
| 1611 | |
| 1612 | The rules are ordered from specific ref patterns to general patterns, |
| 1613 | and for equally specific patterns, from originating project up to |
| 1614 | All-Projects. |
| 1615 | |
| 1616 | This ordering lets project owners apply permissions specific to their |
| 1617 | project, overwriting the site defaults specified in All-Projects. |
| 1618 | |
| 1619 | ==== DENY |
| 1620 | |
| 1621 | DENY is processed together with ALLOW. |
| 1622 | |
| 1623 | As said, during ALLOW/DENY processing, rules are tried out one by one. |
| 1624 | For each (permission, ref-pattern, group) only a single rule |
| 1625 | ALLOW/DENY rule is picked. If that first rule is a DENY rule, any |
| 1626 | following ALLOW rules for the same (permission, ref-pattern, group) |
| 1627 | will be ignored, canceling out their effect. |
| 1628 | |
| 1629 | DENY is confusing because it only works on a specific (ref-pattern, |
| 1630 | group) pair. The parent project can undo the effect of a DENY rule by |
| 1631 | introducing an extra rule which features a more general ref pattern or |
| 1632 | a different group. |
| 1633 | |
| 1634 | ==== DENY/ALLOW example |
| 1635 | |
| 1636 | Consider the ref "refs/a" and the following configuration: |
| 1637 | ---- |
| 1638 | |
| 1639 | child-project: project.config |
| 1640 | [access "refs/a"] |
| 1641 | read = deny group A |
| 1642 | |
| 1643 | All-Projects: project.config |
| 1644 | [access "refs/a"] |
| 1645 | read = group A # ALLOW |
| 1646 | [access "refs/*"] |
| 1647 | read = group B # ALLOW |
| 1648 | ---- |
| 1649 | |
| 1650 | When determining access, first "read = DENY group A" on "refs/a" is |
| 1651 | encountered. The following rule to consider is "ALLOW read group A" on |
| 1652 | "refs/a". The latter rule applies to the same (permission, |
| 1653 | ref-pattern, group) tuple, so it it is ignored. |
| 1654 | |
| 1655 | The DENY rule does not affect the last rule for "refs/*", since that |
| 1656 | has a different ref pattern and a different group. If group B is a |
| 1657 | superset of group A, the last rule will still grant group A access to |
| 1658 | "refs/a". |
| 1659 | |
| 1660 | |
| 1661 | ==== Double use of exclusive |
| 1662 | |
| 1663 | An 'exclusive' permission is evaluated both during BLOCK processing |
| 1664 | and during ALLOW/DENY: when looking BLOCK, 'exclusive' stops the |
| 1665 | search downward, while the same permission in the ALLOW/DENY |
| 1666 | processing will stop looking upward for further rule matches |
| 1667 | |
| 1668 | ==== Force permission |
| 1669 | |
| 1670 | The 'force' setting may be set on ALLOW and BLOCK rules. In the case |
| 1671 | of ALLOW, the 'force' option makes the permission stronger (allowing |
| 1672 | both forced and unforced actions). For BLOCK, the 'force' option makes |
| 1673 | it weaker (the BLOCK with 'force' only blocks forced actions). |
| 1674 | |
| 1675 | |
| 1676 | === Labels |
| 1677 | |
| 1678 | Labels use the same mechanism, with the following observations: |
| 1679 | |
| 1680 | * The 'force' setting has no effect on label ranges. |
| 1681 | |
| 1682 | * BLOCK specifies the values that a group cannot vote, eg. |
| David Shevitz | c89249b | 2018-09-21 10:04:20 -0700 | [diff] [blame] | 1683 | + |
| Han-Wen Nienhuys | cc3bd44 | 2018-02-01 19:30:30 +0100 | [diff] [blame] | 1684 | ---- |
| 1685 | label-Code-Review = block -2..+2 group Anonymous Users |
| 1686 | ---- |
| David Shevitz | c89249b | 2018-09-21 10:04:20 -0700 | [diff] [blame] | 1687 | + |
| Han-Wen Nienhuys | cc3bd44 | 2018-02-01 19:30:30 +0100 | [diff] [blame] | 1688 | prevents all users from voting -2 or +2. |
| 1689 | |
| 1690 | * DENY works for votes too, with the same caveats |
| 1691 | |
| 1692 | * The blocked vote range is the union of the all the blocked vote |
| 1693 | ranges across projects, so in |
| David Shevitz | c89249b | 2018-09-21 10:04:20 -0700 | [diff] [blame] | 1694 | + |
| Han-Wen Nienhuys | cc3bd44 | 2018-02-01 19:30:30 +0100 | [diff] [blame] | 1695 | ---- |
| 1696 | All-Projects: project.config |
| 1697 | label-Code-Review = block -2..+1 group A |
| 1698 | |
| 1699 | Child-Project: project-config |
| 1700 | label-Code-Review = block -1..+2 group A |
| 1701 | ---- |
| David Shevitz | c89249b | 2018-09-21 10:04:20 -0700 | [diff] [blame] | 1702 | + |
| Han-Wen Nienhuys | cc3bd44 | 2018-02-01 19:30:30 +0100 | [diff] [blame] | 1703 | members of group A cannot vote at all in the Child-Project. |
| 1704 | |
| 1705 | |
| 1706 | * The allowed vote range is the union of vote ranges allowed by all of |
| 1707 | the ALLOW rules. For example, in |
| David Shevitz | c89249b | 2018-09-21 10:04:20 -0700 | [diff] [blame] | 1708 | + |
| Han-Wen Nienhuys | cc3bd44 | 2018-02-01 19:30:30 +0100 | [diff] [blame] | 1709 | ---- |
| 1710 | label-Code-Review = -2..+1 group A |
| 1711 | label-Code-Review = -1..+2 group B |
| 1712 | ---- |
| David Shevitz | c89249b | 2018-09-21 10:04:20 -0700 | [diff] [blame] | 1713 | + |
| Han-Wen Nienhuys | cc3bd44 | 2018-02-01 19:30:30 +0100 | [diff] [blame] | 1714 | a user that is both in A and B can vote -2..2. |
| 1715 | |
| 1716 | |
| Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 1717 | GERRIT |
| 1718 | ------ |
| 1719 | Part of link:index.html[Gerrit Code Review] |
| Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 1720 | |
| 1721 | SEARCHBOX |
| 1722 | --------- |