** 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: 'user-useremail@example.com',
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:
- the name of the
scope parameter
- the name of the
permission parameter
- the fact that user's need to be prefixed with
user-
- 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@example.com', 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@example.com').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@example.com').user('other@example.com').grantOwner(function(err, aclObject) {})
Thoughts?
/cc @ryanseys @stephenplusplus
** 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:
scopeparameterpermissionparameteruser-OWNER_ROLE... is itREADER_ROLEorREAD_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