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

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

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright 2012 Google Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 from gslib.help_provider import HELP_NAME
16 from gslib.help_provider import HELP_NAME_ALIASES
17 from gslib.help_provider import HELP_ONE_LINE_SUMMARY
18 from gslib.help_provider import HelpProvider
19 from gslib.help_provider import HELP_TEXT
20 from gslib.help_provider import HelpType
21 from gslib.help_provider import HELP_TYPE
22
23 _detailed_help_text = ("""
24 <B>OVERVIEW</B>
25 Access Control Lists (ACLs) allow you to control who can read and write
26 your data, and who can read and write the ACLs themselves.
27
28 If not specified at the time an object is uploaded (e.g., via the gstil cp
29 -a option), objects will be created with a default object ACL set on the
30 bucket (see "gsutil help setdefacl"). You can change the ACL on an object
31 or bucket using the gsutil setacl command (see "gsutil help setacl").
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 acccess and also are
40 allowed to write and delete objects in that bucket -- including
41 overwriting previously written objects.
42
43 - Users granted FULL_CONTROL 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 FULL_CONTROL 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 FULL_CONTROL 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 FULL_CONTROL 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 Gives permission to the project team based on their
77 roles. Anyone who is part of the team has READ
78 permission, and project owners and project editors
79 have FULL_CONTROL permission. This is the default
80 ACL for newly created buckets. This is also the
81 default ACL for newly created objects unless the
82 default object ACL for that bucket has been
83 changed. For more details see
84 "gsutil help projects".
85
86 private Gives the requester (and only the requester)
87 FULL_CONTROL permission for a bucket or object.
88
89 public-read Gives the requester FULL_CONTROL permission and
90 gives all users READ permission. When you apply
91 this to an object, anyone on the Internet can
92 read the object without authenticating.
93
94 public-read-write Gives the requester FULL_CONTROL permission and
95 gives all users READ and WRITE permission. This
96 ACL applies only to buckets.
97
98 authenticated-read Gives the requester FULL_CONTROL permission and
99 gives all authenticated Google account holders
100 READ permission.
101
102 bucket-owner-read Gives the requester FULL_CONTROL permission and
103 gives the bucket owner READ permission. This is
104 used only with objects.
105
106 bucket-owner-full-control Gives the requester FULL_CONTROL permission and
107 gives the bucket owner FULL_CONTROL
108 permission. This is used only with objects.
109
110
111 <B>ACL XML</B>
112 When you use a canned ACL, it is translated into an XML representation
113 that can later be retrieved and edited to specify more fine grained
114 detail about who can read and write buckets and objects. By running
115 the gsutil getacl command you can retrieve the ACL XML, and edit it to
116 customize the permissions.
117
118 As an example, if you create an object in a bucket that has no default
119 object ACL set and then retrieve the ACL on the object, it will look
120 something like this:
121
122 <AccessControlList>
123 <Owner>
124 <ID>
125 00b4903a97163d99003117abe64d292561d2b4074fc90ce5c0e35ac45f66ad70
126 </ID>
127 </Owner>
128 <Entries>
129 <Entry>
130 <Scope type="UserById">
131 <ID>
132 00b4903a97163d99003117abe64d292561d2b4074fc90ce5c0e35ac45f66ad70
133 </ID>
134 </Scope>
135 <Permission>
136 FULL_CONTROL
137 </Permission>
138 </Entry>
139 </Entries>
140 </AccessControlList>
141
142 The IDs shown here are "canonical IDs", which uniquely identify individuals
143 and groups.
144
145 The ACL consists of an Owner element and a collection of Entry elements, each
146 of which specifies a Scope and a Permission. Scopes are the way you specify
147 an individual or group of individuals, and Permissions specify what access
148 they're permitted.
149
150 This particular ACL grants a single user (the person who uploaded the
151 object in this case) FULL_CONTROL over the object, which just means
152 that person is allowed to read the object and read and write the ACL.
153
154 Here's an example of a more interesting ACL:
155
156 <AccessControlList>
157 <Entries>
158 <Entry>
159 <Permission>
160 FULL_CONTROL
161 </Permission>
162 <Scope type="GroupByEmail">
163 <EmailAddress>travel-companion-owners@googlegroups.com</EmailAddress>
164 </Scope>
165 </Entry>
166 <Entry>
167 <Permission>
168 READ
169 </Permission>
170 <Scope type="GroupByEmail">
171 <EmailAddress>travel-companion-readers@googlegroups.com</EmailAddress>
172 </Scope>
173 </Entry>
174 </Entries>
175 </AccessControlList>
176
177 This ACL grants one group FULL_CONTROL, and grants a different
178 (probably much larger) group READ access. By applying group grants to
179 a collection of objects you can edit access control for large numbers
180 of objects at once via http://groups.google.com. That way, for example,
181 you can easily and quickly change access to a group of company objects
182 when employees join and leave your company (i.e., without having to
183 individually change ACLs across potentially millions of objects).
184
185
186 <B>CANONICAL IDS VS. HUMAN READABLE IDENTIFIERS</B>
187 The first ACL in the previous section contained canonical IDs, while the
188 second contained email address-based identifiers. The reason for canonical IDs
189 is to guard user privacy, so that by default the names and email addresses
190 of sharees aren't visible (even to those users who are allowed to view
191 and edit the ACL). If hiding user identities is not needed for your case
192 and you'd like to have the ACLs contain human-readable addresses you can
193 add a DisplayName element to each Scope you put in the ACL. For example,
194 the second ACL above could be edited to contain this information:
195
196 <AccessControlList>
197 <Entries>
198 <Entry>
199 <Permission>
200 FULL_CONTROL
201 </Permission>
202 <Scope type="GroupByEmail">
203 <EmailAddress>travel-companion-owners@googlegroups.com</EmailAddress>
204 <DisplayName>travel-companion-owners@googlegroups.com</DisplayName>
205 </Scope>
206 </Entry>
207 <Entry>
208 <Permission>
209 READ
210 </Permission>
211 <Scope type="GroupByEmail">
212 <EmailAddress>travel-companion-readers@googlegroups.com</EmailAddress>
213 <DisplayName>travel-companion-readers@googlegroups.com</DisplayName>
214 </Scope>
215 </Entry>
216 </Entries>
217 </AccessControlList>
218
219 When written this way, even though the original identity will be translated
220 by the Google Cloud Storage service into a canonical ID when retrieved later,
221 the DisplayName field will be left with whatever content you wrote (the
222 email address in the above case).
223
224
225 <B>PROJECT GROUPS</B>
226 Google Cloud Storage buckets are owned by projects. Associated with each
227 project is an owners group, an editors group, and a viewers group. In short,
228 these groups make it easy to set up a bucket and start uploading objects
229 with access control appropriate for a project at your company, as the three
230 group memberships can be configured by your administrative staff. Control
231 over projects and their associated memberships is provided by the Google
232 APIs Console (https://code.google.com/apis/console).
233
234
235 <B>SHARING SCENARIOS</B>
236 For more detailed examples how to achieve various useful sharing use
237 cases see https://developers.google.com/storage/docs/collaboration
238 """)
239
240
241 class CommandOptions(HelpProvider):
242 """Additional help about Access Control Lists."""
243
244 help_spec = {
245 # Name of command or auxiliary help info for which this help applies.
246 HELP_NAME : 'acls',
247 # List of help name aliases.
248 HELP_NAME_ALIASES : ['acl', 'ACL', 'access control', 'access control list',
249 'authorization', 'canned', 'canned acl'],
250 # Type of help:
251 HELP_TYPE : HelpType.ADDITIONAL_HELP,
252 # One line summary of this help.
253 HELP_ONE_LINE_SUMMARY : 'Working with Access Control Lists',
254 # The full help text.
255 HELP_TEXT : _detailed_help_text,
256 }
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