blob: 6d4bdc537487ed40a902b6eaae04992ada1025d3 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= gerrit ls-groups
Edwin Kempincf6c3592011-09-01 15:55:15 +02002
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003== NAME
Edwin Kempincf6c3592011-09-01 15:55:15 +02004gerrit ls-groups - List groups visible to caller
5
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006== SYNOPSIS
Michael Ochmanne2d76a12016-06-23 17:07:37 +02007[verse]
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08008--
Michael Ochmanne2d76a12016-06-23 17:07:37 +02009_ssh_ -p <port> <host> _gerrit ls-groups_
Edwin Kempin73b26982012-07-16 13:53:22 +020010 [--project <NAME> | -p <NAME>]
11 [--user <NAME> | -u <NAME>]
Edwin Kempinbf750022013-02-01 16:23:10 +010012 [--owned]
Edwin Kempin4d5f4b72011-09-06 13:12:53 +020013 [--visible-to-all]
Edwin Kempinbf750022013-02-01 16:23:10 +010014 [-q <GROUP>]
Edwin Kempin73b26982012-07-16 13:53:22 +020015 [--verbose | -v]
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080016--
Edwin Kempincf6c3592011-09-01 15:55:15 +020017
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080018== DESCRIPTION
Edwin Kempincf6c3592011-09-01 15:55:15 +020019Displays the list of group names, one per line, that are visible to
20the account of the calling user.
21
22If the caller is a member of the privileged 'Administrators' group,
23all groups are listed.
24
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080025== ACCESS
Gert van Dijkdc4f8d12017-08-27 21:14:23 +020026Any user who has SSH access to Gerrit.
Edwin Kempincf6c3592011-09-01 15:55:15 +020027
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080028== SCRIPTING
Edwin Kempincf6c3592011-09-01 15:55:15 +020029This command is intended to be used in scripts.
30
Magnus Bäck8ddb12e2012-03-27 09:49:06 -040031All non-printable characters (ASCII value 31 or less) are escaped
32according to the conventions used in languages like C, Python, and Perl,
33employing standard sequences like `\n` and `\t`, and `\xNN` for all
34others. In shell scripts, the `printf` command can be used to unescape
35the output.
36
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080037== OPTIONS
Edwin Kempine11aeae2011-09-05 15:48:33 +020038--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 Kempin54eb3532011-11-21 10:18:58 +010046+
47This 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+
54The calling user can list the groups for the own user or must be a
55member of the privileged 'Administrators' group to list the groups
56for other users.
57+
58This option can't be used together with the '--project' option.
Edwin Kempine11aeae2011-09-05 15:48:33 +020059
Edwin Kempinbf750022013-02-01 16:23:10 +010060--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 Kempin4d5f4b72011-09-06 13:12:53 +020065--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 Kempinbf750022013-02-01 16:23:10 +010070-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äck8ddb12e2012-03-27 09:49:06 -040078--verbose::
79-v::
80 Enable verbose output with tab-separated columns for the
Edwin Kempin4201d152013-01-22 15:18:25 +010081 group name, UUID, description, owner group name, owner group UUID
82 and whether the group is visible to all (`true` or `false`).
Magnus Bäck8ddb12e2012-03-27 09:49:06 -040083+
84If a group has been "orphaned", i.e. its owner group UUID refers to a
85nonexistent group, the owner group name field will read `n/a`.
86
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080087== EXAMPLES
Edwin Kempincf6c3592011-09-01 15:55:15 +020088
89List visible groups:
Michael Ochmannb99feab2016-07-06 14:10:22 +020090----
Edwin Kempincf6c3592011-09-01 15:55:15 +020091 $ ssh -p 29418 review.example.com gerrit ls-groups
92 Administrators
93 Anonymous Users
94 MyProject_Committers
95 Project Owners
96 Registered Users
Michael Ochmannb99feab2016-07-06 14:10:22 +020097----
Edwin Kempincf6c3592011-09-01 15:55:15 +020098
Edwin Kempine11aeae2011-09-05 15:48:33 +020099List all groups for which any permission is set for the project
100"MyProject":
Michael Ochmannb99feab2016-07-06 14:10:22 +0200101----
Edwin Kempine11aeae2011-09-05 15:48:33 +0200102 $ ssh -p 29418 review.example.com gerrit ls-groups --project MyProject
103 MyProject_Committers
104 Project Owners
105 Registered Users
Michael Ochmannb99feab2016-07-06 14:10:22 +0200106----
Edwin Kempine11aeae2011-09-05 15:48:33 +0200107
Edwin Kempinbf750022013-02-01 16:23:10 +0100108List all groups which are owned by the calling user:
Michael Ochmannb99feab2016-07-06 14:10:22 +0200109----
Edwin Kempinbf750022013-02-01 16:23:10 +0100110 $ ssh -p 29418 review.example.com gerrit ls-groups --owned
111 MyProject_Committers
112 MyProject_Verifiers
Michael Ochmannb99feab2016-07-06 14:10:22 +0200113----
Edwin Kempinbf750022013-02-01 16:23:10 +0100114
115Check if the calling user owns the group `MyProject_Committers`. If
116`MyProject_Committers` is returned the calling user owns this group.
117If the result is empty, the calling user doesn't own the group.
Michael Ochmannb99feab2016-07-06 14:10:22 +0200118----
Edwin Kempinbf750022013-02-01 16:23:10 +0100119 $ ssh -p 29418 review.example.com gerrit ls-groups --owned -q MyProject_Committers
120 MyProject_Committers
Michael Ochmannb99feab2016-07-06 14:10:22 +0200121----
Edwin Kempinbf750022013-02-01 16:23:10 +0100122
Magnus Bäck8ddb12e2012-03-27 09:49:06 -0400123Extract the UUID of the 'Administrators' group:
124
Michael Ochmannb99feab2016-07-06 14:10:22 +0200125----
Magnus Bäck8ddb12e2012-03-27 09:49:06 -0400126 $ ssh -p 29418 review.example.com gerrit ls-groups -v | awk '-F\t' '$1 == "Administrators" {print $2}'
127 ad463411db3eec4e1efb0d73f55183c1db2fd82a
Michael Ochmannb99feab2016-07-06 14:10:22 +0200128----
Magnus Bäck8ddb12e2012-03-27 09:49:06 -0400129
130Extract and expand the multi-line description of the 'Administrators'
131group:
132
Michael Ochmannb99feab2016-07-06 14:10:22 +0200133----
Magnus Bäck8ddb12e2012-03-27 09:49:06 -0400134 $ 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 Ochmannb99feab2016-07-06 14:10:22 +0200138----
Magnus Bäck8ddb12e2012-03-27 09:49:06 -0400139
Edwin Kempincf6c3592011-09-01 15:55:15 +0200140GERRIT
141------
142Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700143
144SEARCHBOX
145---------