Skip to content

Can we look into making ACL operations really nice for users? #351

@jgeewax

Description

@jgeewax

** revised proposal: #351 (comment) **

Hi guys,

In gcloud-node, the ACL methods are very closely tied to the API specification, for example:

myBucket.acl.add({
  scope: '[email protected]',
  permission: Storage.acl.OWNER_ROLE
}, function(err, aclObject) {});

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:

  1. the name of the scope parameter
  2. the name of the permission parameter
  3. the fact that user's need to be prefixed with user-
  4. the constant for the name of the role (OWNER_ROLE... is it READER_ROLE or READ_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:

myBucket.acl.owners.addUser('[email protected]', function(err, aclObject) {});
myBucket.acl.readers.removeDomain('example.com', function(err, aclObject) {});
myBucket.acl.writers.addAllUsers(function(err, aclObject) {});
myBucket.acl.readers.addAllAuthenticatedUsers(function(err, aclObject) {});

Or we could go the same route that gcloud-python went with the grant_* and revoke_* directives acting as the "commit" operation, so the code would look like:

myBucket.acl.user('[email protected]').grantOwner(function(err, aclObject) {})
myBucket.acl.domain('example.com').revokeRead(function(err, aclObject) {})
myBucket.acl.allUsers().grantWrite(function(err, aclObject) {})
myBucket.acl.allAuthenticatedUsers().grantRead(function(err, aclObject) {})

Ideally you could chain this stuff together:

myBucket.acl.user('[email protected]').user('[email protected]').grantOwner(function(err, aclObject) {})

Thoughts?

/cc @ryanseys @stephenplusplus

Metadata

Metadata

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions