-
Notifications
You must be signed in to change notification settings - Fork 597
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
Can we look into making ACL operations really nice for users? #351
Comments
I like the idea of having predefined bucket objects like myBucket.acl.user(['email@example.com', 'other@example.com']).grantOwner(function(){}); Additionally you should not be able to run a grant or revoke or whatever after a grant/revoke operation such as |
I prefer the first example to the second, and here's another suggestion: var gcloud = require("gcloud")({ /*credentials*/ })
var ACL = gcloud.storage.acl
var myBucket = gcloud.storage.bucket("my-bucket")
var user = ACL.user("email@example.com")
var domain = ACL.domain("domain.com")
myBucket.acl.owners.add([user, domain], function(err) {})
myBucket.acl.writers.remove(user, function(err) {})
myBucket.acl.writers.add(ACL.ALL_USERS, function(err) {})
myBucket.acl.owners.add(ACL.AUTHENTICATED_USERS, function(err) {}) This way a dev only needs to know two methods (add/remove), and the rest should be logical. |
I'm down with the owners/writers/readers and add/remove. I'm not a fan of I also am not a huge fan of the I also think we should keep the shortcut for making public/private. So: var bucket = gcloud.storage.bucket('...');
bucket.acl.owners.add('user@example.com', function(err) { });
bucket.acl.readers.remove('domain.com', function(err) { });
// Then the magic methods: addAll(), addAllAuthenticated(), makePublic(), makePrivate()
bucket.acl.writers.addAll();
bucket.acl.writers.addAllAuthenticated();
bucket.acl.makePublic();
bucket.acl.makePrivate(); Thoughts? |
https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls There are many types of "entities" that the API expects in string format matching the following conventions:
I'm not sure parsing a string is going to be able to handle detecting what's a projectId vs a domain vs a groupId, etc. It would be easier to have methods for these, I still think the way the library is now, adding permissions to a scope through methods like Just to sum up my thoughts:
|
I'm hugely -1 on To be clear: I still think the current way we do it (with Revised proposal
Examplevar bucket = gcloud.storage.bucket('...');
bucket.acl.owners.addUser('user@example.com', function(err) { });
bucket.acl.readers.removeDomain('domain.com', function(err) { });
// Then the magic methods: addAll(), addAllAuthenticated(), makePublic(), makePrivate()
bucket.acl.writers.addAll(function(err) { ... });
bucket.acl.writers.addAllAuthenticated(function(err) { ... });
bucket.acl.makePublic(function(err) { ... });
bucket.acl.makePrivate(function(err) { ... }); |
If we make the helper methods for user, group, domain, project, allusers, allAuthenticated we will fit more closely with the gcloud-python library as well. Personally it's a little more verbose but it's easy to understand and I don't need to know prefixes at all! I'm really fond of stephen's suggestion earlier: var gcloud = require("gcloud")({ /*credentials*/ })
var ACL = gcloud.storage.acl
var myBucket = gcloud.storage.bucket("my-bucket")
var user = ACL.user("email@example.com")
var domain = ACL.domain("domain.com")
myBucket.acl.owners.add([user, domain], function(err) {})
myBucket.acl.writers.remove(user, function(err) {})
myBucket.acl.writers.add(ACL.ALL_USERS, function(err) {})
myBucket.acl.owners.add(ACL.AUTHENTICATED_USERS, function(err) {}) |
Are we all -1 to the If so -- why is that? gcloud-python's syntax is slightly different, but along these lines ( |
Sorry @jgeewax, missed your most recent comment. I'm happy with that suggestion as well with the added benefit that we don't have magic constants for all users and all authenticated users! 👍 |
I'm not -1 for addUser and removeDomain etc... in fact, I like those. We can keep generic add and remove for backward compatibility and more "to the book" users. |
I'll start implementing #351 (comment) 👍 |
Cool 👍 ! Thanks guys ! |
…secrets.sh (#351) This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/e306327b-605f-4c07-9420-c106e40c47d5/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: googleapis/synthtool@e703494
* updated CHANGELOG.md * updated package.json * updated samples/package.json
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`^16.0.0` -> `^18.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/16.18.3/18.11.9) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/compatibility-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/confidence-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **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 [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-web-risk). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yNDEuMTEiLCJ1cGRhdGVkSW5WZXIiOiIzNC4xMS4xIn0=-->
#351) * build(node): add feat in node post-processor to add client library version number in snippet metadata Co-authored-by: Benjamin E. Coe <bencoe@google.com> Source-Link: googleapis/synthtool@d337b88 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:d106724ad2a96daa1b8d88de101ba50bdb30b8df62ffa0aa2b451d93b4556641
PiperOrigin-RevId: 453542250 Source-Link: googleapis/googleapis@ac9c393 Source-Link: googleapis/googleapis-gen@d1e2f1a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDFlMmYxYWIzZGU2YjVhMzYxODZkNjkxNjU0MTJhYTY4NmFlZmIyNiJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [3.1.3](https://togithub.com/googleapis/nodejs-game-servers/compare/v3.1.2...v3.1.3) (2022-11-10) ### Bug Fixes * **deps:** Use google-gax v3.5.2 ([#349](https://togithub.com/googleapis/nodejs-game-servers/issues/349)) ([879eea3](https://togithub.com/googleapis/nodejs-game-servers/commit/879eea37422f58286d3e39e27f5c1b2f6aa4ae9c)) * Regenerated protos JS and TS definitions ([#353](https://togithub.com/googleapis/nodejs-game-servers/issues/353)) ([21535e1](https://togithub.com/googleapis/nodejs-game-servers/commit/21535e16d9dc28888514414117e463271383a971)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
* updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip]
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/fc1dd810-ea11-44c0-ab02-fa000827a405/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: googleapis/synthtool@363fe30
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [dns-zonefile](https://togithub.com/elgs/dns-zonefile) | dependencies | patch | [`0.2.3` -> `0.2.6`](https://renovatebot.com/diffs/npm/dns-zonefile/0.2.3/0.2.6) | --- ### Release Notes <details> <summary>elgs/dns-zonefile</summary> ### [`v0.2.6`](https://togithub.com/elgs/dns-zonefile/compare/3bef8775b91f3f0911981cd8e051e294612db718...fdb82e625f9569362f8837e61107a497b04b37ec) [Compare Source](https://togithub.com/elgs/dns-zonefile/compare/3bef8775b91f3f0911981cd8e051e294612db718...fdb82e625f9569362f8837e61107a497b04b37ec) ### [`v0.2.5`](https://togithub.com/elgs/dns-zonefile/compare/bc44ce8040aad3bcccb5b0e89bfa434140976b19...3bef8775b91f3f0911981cd8e051e294612db718) [Compare Source](https://togithub.com/elgs/dns-zonefile/compare/bc44ce8040aad3bcccb5b0e89bfa434140976b19...3bef8775b91f3f0911981cd8e051e294612db718) ### [`v0.2.4`](https://togithub.com/elgs/dns-zonefile/compare/0.2.3...bc44ce8040aad3bcccb5b0e89bfa434140976b19) [Compare Source](https://togithub.com/elgs/dns-zonefile/compare/0.2.3...bc44ce8040aad3bcccb5b0e89bfa434140976b19) </details> --- ### 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).
🤖 I have created a release \*beep\* \*boop\* --- ### [1.2.9](https://www.github.com/googleapis/nodejs-dns/compare/v1.2.8...v1.2.9) (2020-03-17) ### Bug Fixes * **deps:** update dependency dns-zonefile to v0.2.6 ([#351](https://www.github.com/googleapis/nodejs-dns/issues/351)) ([437505b](https://www.github.com/googleapis/nodejs-dns/commit/437505b52ab43d7beeb5ce3f5bd6266c1067db96)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please).
** revised proposal: #351 (comment) **
Hi guys,
In gcloud-node, the ACL methods are very closely tied to the API specification, for example:
There are definitely times where I want to do low level operations, but other times I want to first-class citizen methods for the different options... Additionally, I now have to know a few things about this API:
scope
parameterpermission
parameteruser-
OWNER_ROLE
... is itREADER_ROLE
orREAD_ROLE
?) and where to look for those constants when I inevitably forget them...Can take a stab at making this more friendly? For example, it might be cool to have:
Or we could go the same route that gcloud-python went with the
grant_*
andrevoke_*
directives acting as the "commit" operation, so the code would look like:Ideally you could chain this stuff together:
Thoughts?
/cc @ryanseys @stephenplusplus
The text was updated successfully, but these errors were encountered: