blob: a0c7c344c452445d0c1fcc20ce08cfd3a39a0385 [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
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08007--
Edwin Kempincf6c3592011-09-01 15:55:15 +02008'ssh' -p <port> <host> 'gerrit ls-groups'
Edwin Kempin73b26982012-07-16 13:53:22 +02009 [--project <NAME> | -p <NAME>]
10 [--user <NAME> | -u <NAME>]
Edwin Kempinbf750022013-02-01 16:23:10 +010011 [--owned]
Edwin Kempin4d5f4b72011-09-06 13:12:53 +020012 [--visible-to-all]
Edwin Kempin73b26982012-07-16 13:53:22 +020013 [--type {internal | system}]
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
Edwin Kempincf6c3592011-09-01 15:55:15 +020026Any user who has configured an SSH key.
27
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 Kempin6ac5fd62011-09-29 10:50:29 +020070--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 Kempin6ac5fd62011-09-29 10:50:29 +020076`system`:: Any system defined and managed group.
77--
78
Edwin Kempinbf750022013-02-01 16:23:10 +010079-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äck8ddb12e2012-03-27 09:49:06 -040087--verbose::
88-v::
89 Enable verbose output with tab-separated columns for the
Edwin Kempin4201d152013-01-22 15:18:25 +010090 group name, UUID, description, owner group name, owner group UUID
91 and whether the group is visible to all (`true` or `false`).
Magnus Bäck8ddb12e2012-03-27 09:49:06 -040092+
93If a group has been "orphaned", i.e. its owner group UUID refers to a
94nonexistent group, the owner group name field will read `n/a`.
95
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080096== EXAMPLES
Edwin Kempincf6c3592011-09-01 15:55:15 +020097
98List 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 Kempine11aeae2011-09-05 15:48:33 +0200108List 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 Kempinbf750022013-02-01 16:23:10 +0100117List 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
124Check if the calling user owns the group `MyProject_Committers`. If
125`MyProject_Committers` is returned the calling user owns this group.
126If 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äck8ddb12e2012-03-27 09:49:06 -0400132Extract 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
139Extract and expand the multi-line description of the 'Administrators'
140group:
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 Kempincf6c3592011-09-01 15:55:15 +0200149GERRIT
150------
151Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700152
153SEARCHBOX
154---------