Skip to content

add examples of making an object publicly-readable #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/storage/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ function Bucket(storage, name) {
* {module:storage/bucket#acl.default}.
*
* @mixes module:storage/acl
*
* @example
* //-
* // Make a bucket's contents publicly readable.
* //-
* myBucket.acl.add({
* scope: 'allUsers',
* permission: Storage.acl.READER_ROLE
* }, function(err, aclObject) {});
*/
this.acl = new Acl({
makeReq: this.makeReq_.bind(this),
Expand Down
9 changes: 9 additions & 0 deletions lib/storage/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ function File(bucket, name, metadata) {
* the ACLs defined on your bucket, as well as set, update, and delete them.
*
* @mixes module:storage/acl
*
* @example
* //-
* // Make a file publicly readable.
* //-
* myFile.acl.add({
* scope: 'allUsers',
* permission: Storage.acl.READER_ROLE
* }, function(err, aclObject) {});
*/
this.acl = new Acl({
makeReq: this.makeReq_,
Expand Down
20 changes: 20 additions & 0 deletions lib/storage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,26 @@ function Storage(config) {
* var storage = gcloud.storage();
* var albums = storage.bucket('albums');
*
* //-
* // Make all of the files currently in a bucket publicly readable.
* //-
* albums.acl.add({
* scope: 'allUsers',
* permission: Storage.acl.READER_ROLE
* }, function(err, aclObject) {});
*
* //-
* // Make any new objects added to a bucket publicly readable.
* //-
* albums.acl.default.add({
* scope: 'allUsers',
* permission: Storage.acl.READER_ROLE
* }, function(err, aclObject) {});
*
* //-
* // Grant a user ownership permissions to a bucket.
* //-
*
* albums.acl.add({
* scope: '[email protected]',
* permission: Storage.acl.OWNER_ROLE
Expand Down