Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = gerrit ls-groups |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 2 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 3 | == NAME |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 4 | gerrit ls-groups - List groups visible to caller |
| 5 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 6 | == SYNOPSIS |
Michael Ochmann | e2d76a1 | 2016-06-23 17:07:37 +0200 | [diff] [blame] | 7 | [verse] |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 8 | -- |
Michael Ochmann | e2d76a1 | 2016-06-23 17:07:37 +0200 | [diff] [blame] | 9 | _ssh_ -p <port> <host> _gerrit ls-groups_ |
Edwin Kempin | 73b2698 | 2012-07-16 13:53:22 +0200 | [diff] [blame] | 10 | [--project <NAME> | -p <NAME>] |
| 11 | [--user <NAME> | -u <NAME>] |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 12 | [--owned] |
Edwin Kempin | 4d5f4b7 | 2011-09-06 13:12:53 +0200 | [diff] [blame] | 13 | [--visible-to-all] |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 14 | [-q <GROUP>] |
Edwin Kempin | 73b2698 | 2012-07-16 13:53:22 +0200 | [diff] [blame] | 15 | [--verbose | -v] |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 16 | -- |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 17 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 18 | == DESCRIPTION |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 19 | Displays the list of group names, one per line, that are visible to |
| 20 | the account of the calling user. |
| 21 | |
| 22 | If the caller is a member of the privileged 'Administrators' group, |
| 23 | all groups are listed. |
| 24 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 25 | == ACCESS |
Gert van Dijk | dc4f8d1 | 2017-08-27 21:14:23 +0200 | [diff] [blame] | 26 | Any user who has SSH access to Gerrit. |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 27 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 28 | == SCRIPTING |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 29 | This command is intended to be used in scripts. |
| 30 | |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 31 | All non-printable characters (ASCII value 31 or less) are escaped |
| 32 | according to the conventions used in languages like C, Python, and Perl, |
| 33 | employing standard sequences like `\n` and `\t`, and `\xNN` for all |
| 34 | others. In shell scripts, the `printf` command can be used to unescape |
| 35 | the output. |
| 36 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 37 | == OPTIONS |
Edwin Kempin | e11aeae | 2011-09-05 15:48:33 +0200 | [diff] [blame] | 38 | --project:: |
| 39 | -p:: |
| 40 | Name of the project for which the groups should be listed. Only |
| 41 | groups are listed for which any permission is set on this project |
| 42 | (or for which a permission is inherited from a parent project). |
| 43 | Multiple --project options may be specified to specify additional |
| 44 | projects. In this case all groups are listed that have a |
| 45 | permission for any of the specified projects. |
Edwin Kempin | 54eb353 | 2011-11-21 10:18:58 +0100 | [diff] [blame] | 46 | + |
| 47 | This option can't be used together with the '--user' option. |
| 48 | |
| 49 | --user:: |
| 50 | -u:: |
| 51 | User for which the groups should be listed. Only groups are |
| 52 | listed that contain this user as a member. |
| 53 | + |
| 54 | The calling user can list the groups for the own user or must be a |
| 55 | member of the privileged 'Administrators' group to list the groups |
| 56 | for other users. |
| 57 | + |
| 58 | This option can't be used together with the '--project' option. |
Edwin Kempin | e11aeae | 2011-09-05 15:48:33 +0200 | [diff] [blame] | 59 | |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 60 | --owned:: |
| 61 | Lists only the groups that are owned by the user that was specified |
| 62 | by the `--user` option or if no user was specified the groups that |
| 63 | are owned by the calling user. |
| 64 | |
Edwin Kempin | 4d5f4b7 | 2011-09-06 13:12:53 +0200 | [diff] [blame] | 65 | --visible-to-all:: |
| 66 | Displays only groups that are visible to all registered users |
| 67 | (groups that are explicitly marked as visible to all registered |
| 68 | users). |
| 69 | |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 70 | -q:: |
| 71 | Group that should be inspected. The `-q` option can be specified |
| 72 | multiple times to define several groups to be inspected. If |
| 73 | specified the listed groups will only contain groups that were |
| 74 | specified to be inspected. This is e.g. useful in combination with |
| 75 | the `--owned` and `--user` options to check whether a group is |
| 76 | owned by a user. |
| 77 | |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 78 | --verbose:: |
| 79 | -v:: |
| 80 | Enable verbose output with tab-separated columns for the |
Edwin Kempin | 4201d15 | 2013-01-22 15:18:25 +0100 | [diff] [blame] | 81 | group name, UUID, description, owner group name, owner group UUID |
| 82 | and whether the group is visible to all (`true` or `false`). |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 83 | + |
| 84 | If a group has been "orphaned", i.e. its owner group UUID refers to a |
| 85 | nonexistent group, the owner group name field will read `n/a`. |
| 86 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 87 | == EXAMPLES |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 88 | |
| 89 | List visible groups: |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 90 | ---- |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 91 | $ ssh -p 29418 review.example.com gerrit ls-groups |
| 92 | Administrators |
| 93 | Anonymous Users |
| 94 | MyProject_Committers |
| 95 | Project Owners |
| 96 | Registered Users |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 97 | ---- |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 98 | |
Edwin Kempin | e11aeae | 2011-09-05 15:48:33 +0200 | [diff] [blame] | 99 | List all groups for which any permission is set for the project |
| 100 | "MyProject": |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 101 | ---- |
Edwin Kempin | e11aeae | 2011-09-05 15:48:33 +0200 | [diff] [blame] | 102 | $ ssh -p 29418 review.example.com gerrit ls-groups --project MyProject |
| 103 | MyProject_Committers |
| 104 | Project Owners |
| 105 | Registered Users |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 106 | ---- |
Edwin Kempin | e11aeae | 2011-09-05 15:48:33 +0200 | [diff] [blame] | 107 | |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 108 | List all groups which are owned by the calling user: |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 109 | ---- |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 110 | $ ssh -p 29418 review.example.com gerrit ls-groups --owned |
| 111 | MyProject_Committers |
| 112 | MyProject_Verifiers |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 113 | ---- |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 114 | |
| 115 | Check if the calling user owns the group `MyProject_Committers`. If |
| 116 | `MyProject_Committers` is returned the calling user owns this group. |
| 117 | If the result is empty, the calling user doesn't own the group. |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 118 | ---- |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 119 | $ ssh -p 29418 review.example.com gerrit ls-groups --owned -q MyProject_Committers |
| 120 | MyProject_Committers |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 121 | ---- |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 122 | |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 123 | Extract the UUID of the 'Administrators' group: |
| 124 | |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 125 | ---- |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 126 | $ ssh -p 29418 review.example.com gerrit ls-groups -v | awk '-F\t' '$1 == "Administrators" {print $2}' |
| 127 | ad463411db3eec4e1efb0d73f55183c1db2fd82a |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 128 | ---- |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 129 | |
| 130 | Extract and expand the multi-line description of the 'Administrators' |
| 131 | group: |
| 132 | |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 133 | ---- |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 134 | $ printf "$(ssh -p 29418 review.example.com gerrit ls-groups -v | awk '-F\t' '$1 == "Administrators" {print $3}')\n" |
| 135 | This is a |
| 136 | multi-line |
| 137 | description. |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 138 | ---- |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 139 | |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 140 | GERRIT |
| 141 | ------ |
| 142 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 143 | |
| 144 | SEARCHBOX |
| 145 | --------- |