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 |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 7 | -- |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 8 | 'ssh' -p <port> <host> 'gerrit ls-groups' |
Edwin Kempin | 73b2698 | 2012-07-16 13:53:22 +0200 | [diff] [blame] | 9 | [--project <NAME> | -p <NAME>] |
| 10 | [--user <NAME> | -u <NAME>] |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 11 | [--owned] |
Edwin Kempin | 4d5f4b7 | 2011-09-06 13:12:53 +0200 | [diff] [blame] | 12 | [--visible-to-all] |
Edwin Kempin | 73b2698 | 2012-07-16 13:53:22 +0200 | [diff] [blame] | 13 | [--type {internal | system}] |
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 |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 26 | Any user who has configured an SSH key. |
| 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 | 6ac5fd6 | 2011-09-29 10:50:29 +0200 | [diff] [blame] | 70 | --type:: |
| 71 | Display only groups of the specified type. If not specified, |
| 72 | groups of all types are displayed. Supported types: |
| 73 | + |
| 74 | -- |
| 75 | `internal`:: Any group defined within Gerrit. |
Edwin Kempin | 6ac5fd6 | 2011-09-29 10:50:29 +0200 | [diff] [blame] | 76 | `system`:: Any system defined and managed group. |
| 77 | -- |
| 78 | |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 79 | -q:: |
| 80 | Group that should be inspected. The `-q` option can be specified |
| 81 | multiple times to define several groups to be inspected. If |
| 82 | specified the listed groups will only contain groups that were |
| 83 | specified to be inspected. This is e.g. useful in combination with |
| 84 | the `--owned` and `--user` options to check whether a group is |
| 85 | owned by a user. |
| 86 | |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 87 | --verbose:: |
| 88 | -v:: |
| 89 | Enable verbose output with tab-separated columns for the |
Edwin Kempin | 4201d15 | 2013-01-22 15:18:25 +0100 | [diff] [blame] | 90 | group name, UUID, description, owner group name, owner group UUID |
| 91 | and whether the group is visible to all (`true` or `false`). |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 92 | + |
| 93 | If a group has been "orphaned", i.e. its owner group UUID refers to a |
| 94 | nonexistent group, the owner group name field will read `n/a`. |
| 95 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 96 | == EXAMPLES |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 97 | |
| 98 | List visible groups: |
| 99 | ===== |
| 100 | $ ssh -p 29418 review.example.com gerrit ls-groups |
| 101 | Administrators |
| 102 | Anonymous Users |
| 103 | MyProject_Committers |
| 104 | Project Owners |
| 105 | Registered Users |
| 106 | ===== |
| 107 | |
Edwin Kempin | e11aeae | 2011-09-05 15:48:33 +0200 | [diff] [blame] | 108 | List all groups for which any permission is set for the project |
| 109 | "MyProject": |
| 110 | ===== |
| 111 | $ ssh -p 29418 review.example.com gerrit ls-groups --project MyProject |
| 112 | MyProject_Committers |
| 113 | Project Owners |
| 114 | Registered Users |
| 115 | ===== |
| 116 | |
Edwin Kempin | bf75002 | 2013-02-01 16:23:10 +0100 | [diff] [blame] | 117 | List all groups which are owned by the calling user: |
| 118 | ===== |
| 119 | $ ssh -p 29418 review.example.com gerrit ls-groups --owned |
| 120 | MyProject_Committers |
| 121 | MyProject_Verifiers |
| 122 | ===== |
| 123 | |
| 124 | Check if the calling user owns the group `MyProject_Committers`. If |
| 125 | `MyProject_Committers` is returned the calling user owns this group. |
| 126 | If the result is empty, the calling user doesn't own the group. |
| 127 | ===== |
| 128 | $ ssh -p 29418 review.example.com gerrit ls-groups --owned -q MyProject_Committers |
| 129 | MyProject_Committers |
| 130 | ===== |
| 131 | |
Magnus Bäck | 8ddb12e | 2012-03-27 09:49:06 -0400 | [diff] [blame] | 132 | Extract the UUID of the 'Administrators' group: |
| 133 | |
| 134 | ===== |
| 135 | $ ssh -p 29418 review.example.com gerrit ls-groups -v | awk '-F\t' '$1 == "Administrators" {print $2}' |
| 136 | ad463411db3eec4e1efb0d73f55183c1db2fd82a |
| 137 | ===== |
| 138 | |
| 139 | Extract and expand the multi-line description of the 'Administrators' |
| 140 | group: |
| 141 | |
| 142 | ===== |
| 143 | $ printf "$(ssh -p 29418 review.example.com gerrit ls-groups -v | awk '-F\t' '$1 == "Administrators" {print $3}')\n" |
| 144 | This is a |
| 145 | multi-line |
| 146 | description. |
| 147 | ===== |
| 148 | |
Edwin Kempin | cf6c359 | 2011-09-01 15:55:15 +0200 | [diff] [blame] | 149 | GERRIT |
| 150 | ------ |
| 151 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 152 | |
| 153 | SEARCHBOX |
| 154 | --------- |