Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: third_party/gsutil/gslib/addlhelp/acls.py

Issue 1377933002: [catapult] - Copy Telemetry's gsutilz over to third_party. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Rename to gsutil. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # -*- coding: utf-8 -*-
2 # Copyright 2012 Google Inc. All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 """Additional help about Access Control Lists."""
16
17 from __future__ import absolute_import
18
19 from gslib.help_provider import HelpProvider
20
21 _DETAILED_HELP_TEXT = ("""
22 <B>OVERVIEW</B>
23 Access Control Lists (ACLs) allow you to control who can read and write
24 your data, and who can read and write the ACLs themselves.
25
26 If not specified at the time an object is uploaded (e.g., via the gsutil cp
27 -a option), objects will be created with a default object ACL set on the
28 bucket (see "gsutil help defacl"). You can replace the ACL on an object
29 or bucket using the "gsutil acl set" command, or
30 modify the existing ACL using the "gsutil acl ch" command (see "gsutil help
31 acl").
32
33
34 <B>BUCKET VS OBJECT ACLS</B>
35 In Google Cloud Storage, the bucket ACL works as follows:
36
37 - Users granted READ access are allowed to list the bucket contents.
38
39 - Users granted WRITE access are allowed READ access and also are
40 allowed to write and delete objects in that bucket -- including
41 overwriting previously written objects.
42
43 - Users granted OWNER access are allowed WRITE access and also
44 are allowed to read and write the bucket's ACL.
45
46 The object ACL works as follows:
47
48 - Users granted READ access are allowed to read the object's data and
49 metadata.
50
51 - Users granted OWNER access are allowed READ access and also
52 are allowed to read and write the object's ACL.
53
54 A couple of points are worth noting, that sometimes surprise users:
55
56 1. There is no WRITE access for objects; attempting to set an ACL with WRITE
57 permission for an object will result in an error.
58
59 2. The bucket ACL plays no role in determining who can read objects; only the
60 object ACL matters for that purpose. This is different from how things
61 work in Linux file systems, where both the file and directory permission
62 control file read access. It also means, for example, that someone with
63 OWNER over the bucket may not have read access to objects in
64 the bucket. This is by design, and supports useful cases. For example,
65 you might want to set up bucket ownership so that a small group of
66 administrators have OWNER on the bucket (with the ability to
67 delete data to control storage costs), but not grant those users read
68 access to the object data (which might be sensitive data that should
69 only be accessed by a different specific group of users).
70
71
72 <B>CANNED ACLS</B>
73 The simplest way to set an ACL on a bucket or object is using a "canned
74 ACL". The available canned ACLs are:
75
76 project-private
77 Gives permission to the project team based on their roles. Anyone who is
78 part of the team has READ permission, and project owners and project editors
79 have OWNER permission. This is the default ACL for newly created
80 buckets. This is also the default ACL for newly created objects unless the
81 default object ACL for that bucket has been changed. For more details see
82 "gsutil help projects".
83
84 private
85 Gives the requester (and only the requester) OWNER permission for a
86 bucket or object.
87
88 public-read
89 Gives all users (whether logged in or anonymous) READ permission. When
90 you apply this to an object, anyone on the Internet can read the object
91 without authenticating.
92
93 NOTE: By default, publicly readable objects are served with a Cache-Control
94 header allowing such objects to be cached for 3600 seconds. If you need to
95 ensure that updates become visible immediately, you should set a
96 Cache-Control header of "Cache-Control:private, max-age=0, no-transform" on
97 such objects. For help doing this, see 'gsutil help setmeta'.
98
99 NOTE: Setting a bucket ACL to public-read will remove all OWNER and WRITE
100 permissions from everyone except the project owner group. Setting an object
101 ACL to public-read will remove all OWNER and WRITE permissions from
102 everyone except the object owner. For this reason, we recommend using
103 the "acl ch" command to make these changes; see "gsutil help acl ch" for
104 details.
105
106 public-read-write
107 Gives all users READ and WRITE permission. This ACL applies only to buckets.
108 NOTE: Setting a bucket to public-read-write will allow anyone on the
109 Internet to upload anything to your bucket. You will be responsible for this
110 content.
111
112 NOTE: Setting a bucket ACL to public-read-write will remove all OWNER
113 permissions from everyone except the project owner group. Setting an object
114 ACL to public-read-write will remove all OWNER permissions from
115 everyone except the object owner. For this reason, we recommend using
116 the "acl ch" command to make these changes; see "gsutil help acl ch" for
117 details.
118
119 authenticated-read
120 Gives the requester OWNER permission and gives all authenticated
121 Google account holders READ permission.
122
123 bucket-owner-read
124 Gives the requester OWNER permission and gives the bucket owner READ
125 permission. This is used only with objects.
126
127 bucket-owner-full-control
128 Gives the requester OWNER permission and gives the bucket owner
129 OWNER permission. This is used only with objects.
130
131
132 <B>ACL JSON</B>
133 When you use a canned ACL, it is translated into an JSON representation
134 that can later be retrieved and edited to specify more fine-grained
135 detail about who can read and write buckets and objects. By running
136 the "gsutil acl get" command you can retrieve the ACL JSON, and edit it to
137 customize the permissions.
138
139 As an example, if you create an object in a bucket that has no default
140 object ACL set and then retrieve the ACL on the object, it will look
141 something like this:
142
143 [
144 {
145 "entity": "group-00b4903a9740e42c29800f53bd5a9a62a2f96eb3f64a4313a115df3f3 a776bf7",
146 "entityId": "00b4903a9740e42c29800f53bd5a9a62a2f96eb3f64a4313a115df3f3a776 bf7",
147 "role": "OWNER"
148 },
149 {
150 "entity": "group-00b4903a977fd817e9da167bc81306489181a110456bb635f466d71cf 90a0d51",
151 "entityId": "00b4903a977fd817e9da167bc81306489181a110456bb635f466d71cf90a0 d51",
152 "role": "OWNER"
153 },
154 {
155 "entity": "00b4903a974898cc8fc309f2f2835308ba3d3df1b889d3fc7e33e187d52d8e7 1",
156 "entityId": "00b4903a974898cc8fc309f2f2835308ba3d3df1b889d3fc7e33e187d52d8 e71",
157 "role": "READER"
158 }
159 ]
160
161 The ACL consists collection of elements, each of which specifies an Entity
162 and a Role. Entities are the way you specify an individual or group of
163 individuals, and Roles specify what access they're permitted.
164
165 This particular ACL grants OWNER to two groups (which means members
166 of those groups are allowed to read the object and read and write the ACL),
167 and READ permission to a third group. The project groups are (in order)
168 the project owners group, editors group, and viewers group.
169
170 The 64 digit hex identifiers (following any prefixes like "group-") used in
171 this ACL are called canonical IDs. They are used to identify predefined
172 groups associated with the project that owns the bucket: the Project Owners,
173 Project Editors, and All Project Team Members groups. For more information
174 the permissions and roles of these project groups, see "gsutil help projects".
175
176 Here's an example of an ACL specified using the group-by-email and
177 group-by-domain entities:
178
179 [
180 {
181 "entity": "group-travel-companion-owners@googlegroups.com"
182 "email": "travel-companion-owners@googlegroups.com",
183 "role": "OWNER",
184 }
185 {
186 "domain": "example.com",
187 "entity": "domain-example.com"
188 "role": "READER",
189 },
190 ]
191
192 This ACL grants members of an email group OWNER, and grants READ
193 access to any user in a domain (which must be a Google Apps for Business
194 domain). By applying email group grants to a collection of objects
195 you can edit access control for large numbers of objects at once via
196 http://groups.google.com. That way, for example, you can easily and quickly
197 change access to a group of company objects when employees join and leave
198 your company (i.e., without having to individually change ACLs across
199 potentially millions of objects).
200
201
202 <B>SHARING SCENARIOS</B>
203 For more detailed examples how to achieve various useful sharing use
204 cases see https://developers.google.com/storage/docs/collaboration
205 """)
206
207
208 class CommandOptions(HelpProvider):
209 """Additional help about Access Control Lists."""
210
211 # Help specification. See help_provider.py for documentation.
212 help_spec = HelpProvider.HelpSpec(
213 help_name='acls',
214 help_name_aliases=[
215 'ACL', 'access control', 'access control list', 'authorization',
216 'canned', 'canned acl'],
217 help_type='additional_help',
218 help_one_line_summary='Working With Access Control Lists',
219 help_text=_DETAILED_HELP_TEXT,
220 subcommand_help_text={},
221 )
OLDNEW
« no previous file with comments | « third_party/gsutil/gslib/addlhelp/__init__.py ('k') | third_party/gsutil/gslib/addlhelp/anon.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698