Skip to content

Make files public and private#390

Merged
ryanseys merged 1 commit intogoogleapis:masterfrom
ryanseys:rs--make-public
Mar 5, 2015
Merged

Make files public and private#390
ryanseys merged 1 commit intogoogleapis:masterfrom
ryanseys:rs--make-public

Conversation

@ryanseys
Copy link
Contributor

Included in this PR is my interpretation of how we should handle making Google Cloud Storage objects public and private.

I am not putting it under the file.acl object because if the user understand acls then they probably don't need to use these helper methods. These are slap-em-on permissions that require minimal configuration.

Buckets, by default, apply a default ACL of project-private, that is it is private only to the maintainers of the project. This is the "default" setting. By running file.makePrivate() we are reverting to this default. If you want to REALLY make it private, that is only to the object owner user, then you can pass in { strict: true } (ideas on a better param name are welcome). makePrivate() removes all other permissions. It DNGAF.

makePublic() just slaps on allUsers: READER permission, maintaining all other permissions. It's nicer than makePrivate() in this regard.

Edit: Added tests.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 11, 2015
@ryanseys ryanseys added don't merge api: storage Issues related to the Cloud Storage API. labels Feb 11, 2015
@stephenplusplus
Copy link
Contributor

All sounds good to me.

@ryanseys
Copy link
Contributor Author

Cool beans, I'll add some tests to this bad boy. Might leave makePublic and makePrivate for buckets out for now as a way to break the problem down.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@ryanseys
Copy link
Contributor Author

This should be good for a second look. I've added tests. I've omitted a test for testing makePrivate with strict: true because I only have project-level access, not user access, so the file would be completely inaccessible to me after making it private. I do test makePrivate on a project level though.

This comment was marked as spam.

This comment was marked as spam.

@ryanseys
Copy link
Contributor Author

PTAL. Sorry I squashed so you'll have to go back through your comments :(

This comment was marked as spam.

@stephenplusplus
Copy link
Contributor

LGTM but I'll leave it unmerged for now to confirm the way it works is what @jgeewax had in mind.

@stephenplusplus
Copy link
Contributor

Yolo merge?

ryanseys added a commit that referenced this pull request Mar 5, 2015
@ryanseys ryanseys merged commit 381e535 into googleapis:master Mar 5, 2015
@ryanseys ryanseys deleted the rs--make-public branch March 5, 2015 20:06
@ryanseys
Copy link
Contributor Author

ryanseys commented Mar 5, 2015

YEP

@stephenplusplus
Copy link
Contributor

Woooooo!

sofisl pushed a commit that referenced this pull request Jan 10, 2023
sofisl pushed a commit that referenced this pull request Sep 13, 2023
Update npm scripts: add clean, prelint, prefix; make sure that lint and fix are set properly. Use post-process feature of synthtool.
sofisl pushed a commit that referenced this pull request Sep 14, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/uuid](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^7.0.2` -> `^8.0.0`](https://renovatebot.com/diffs/npm/@types%2fuuid/7.0.4/8.0.0) |

---

### Renovate configuration

:date: **Schedule**: "after 9am and before 3pm" (UTC).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-dns).
miguelvelezsa pushed a commit that referenced this pull request Jul 23, 2025
GautamSharda pushed a commit that referenced this pull request Feb 2, 2026
* build: switch to releasing with GitHub bot

* chore: drop releaseType from yaml
@sofisl sofisl mentioned this pull request Feb 3, 2026
sofisl pushed a commit that referenced this pull request Feb 3, 2026
GautamSharda pushed a commit that referenced this pull request Feb 3, 2026
* build: switch to releasing with GitHub bot

* chore: drop releaseType from yaml
sofisl pushed a commit that referenced this pull request Feb 4, 2026
@sofisl sofisl added the library: cloud-profiler Issues transferred from another repository label Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API. cla: yes This human has signed the Contributor License Agreement. library: cloud-profiler Issues transferred from another repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants