Skip to content

storage: iam support - #2060

Merged
stephenplusplus merged 10 commits into
googleapis:masterfrom
stephenplusplus:spp--2057
Apr 14, 2017
Merged

stephenplusplus merged 10 commits into
googleapis:masterfrom
stephenplusplus:spp--2057

Conversation

@stephenplusplus

@stephenplusplus stephenplusplus commented Mar 7, 2017 •

Copy link
Copy Markdown
Contributor

Fixes #2057

To Dos

  • Whitelisting for my project
  • Whitelisting for system tests project
  • Hide Object API
  • Docs
  • Tests
    • Unit
      • bucket.js
      • iam.js
    • System
      • Get
      • Set
      • Test

This adds IAM support to Buckets and Objects:

bucket.iam.getPolicy(function(err, policy, apiResponse) {})
file.iam.getPolicy(function(err, policy, apiResponse) {})

bucket.iam.setPolicy(policy, function(err, policy, apiResponse) {})
file.iam.setPolicy(policy, function(err, policy, apiResponse) {})

bucket.iam.testPermissions(['permission', 'permission.2'], function(err, permissions, apiResponse) {})
file.iam.testPermissions(['permission', 'permission.2'], function(err, permissions, apiResponse) {})

@stephenplusplus stephenplusplus added api: storage Issues related to the Cloud Storage API. Status: Don't Merge labels Mar 7, 2017
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 7, 2017
@stephenplusplus stephenplusplus added the status: blocked Resolving the issue is dependent on other work. label Mar 7, 2017
@stephenplusplus

Copy link
Copy Markdown
Contributor Author

@jmuk -- blocked for now, as I'm waiting to be whitelisted.

@lukesneeringer

Copy link
Copy Markdown
Contributor

@danoscarmike Can you reach out to the GCS team and ask them to whitelist Stephen?

@danoscarmike

Copy link
Copy Markdown
Contributor

Requested, standby...

@stephenplusplus

Copy link
Copy Markdown
Contributor Author

@danoscarmike any updates?

@stephenplusplus

stephenplusplus commented Mar 27, 2017 •

Copy link
Copy Markdown
Contributor Author

I seem to have been whitelisted-- I haven't checked for the CI account yet.

I had an issue with setting a policy:

PUT https://www.googleapis.com/storage/v1/b/gcloud-test-86d6a2e0-130f-11e7-aa15-43bde3d9a94b/iam

Request Body

  {
    "resourceId": "buckets/gcloud-test-86d6a2e0-130f-11e7-aa15-43bde3d9a94b",                                 
    "bindings": [                                                                                             
      {                                                                                                       
        "role": "roles/storage.objectViewer",                                                                 
        "members": [                                                                                          
          "allUsers"                                                                                          
        ]                                                                                                     
      }                                                                                                       
    ]                                                                                                         
  }                                                                                                                                                                                                                      

This returns: Invalid argument.

@stephenplusplus stephenplusplus removed the status: blocked Resolving the issue is dependent on other work. label Mar 27, 2017
@elibixby

Copy link
Copy Markdown

@stephenplusplus You need a version and should probably be following the read-modify-write pattern as well, providing an etag

@stephenplusplus

Copy link
Copy Markdown
Contributor Author

Thanks! I don't see a version property documented here: https://cloud.google.com/storage/docs/json_api/v1/buckets/setIamPolicy.

Using the Pub/Sub IAM endpoint as a reference, the etag isn't required. I'm struggling to get one through to the API as well, but I'm working on that.

Is one of / are both version and etag required?

@elibixby

Copy link
Copy Markdown

@stephenplusplus looks like Cloud Storage implements a non-standard version of IAM (this is basically because it's an old API into which IAM was backported, all new APIs will share a common implementation which includes version, which is soley for user use, and the API doesn't care about, the new APIs should probably share an IAM implementatoin, as most new APIs will be launching with IAM support.)

As for that particular request I'm not sure why it failed now. I would make sure you have permissions to grant all users access, and maybe try a different role/member set combo.

@lukesneeringer

Copy link
Copy Markdown
Contributor

@stephenplusplus What do you need from me to unblock you? We would like to get this done this week.

@stephenplusplus

Copy link
Copy Markdown
Contributor Author

#2060 (comment)

It would save a lot of guess work if someone knew what a request body would look like that will not return the Invalid error.

@lukesneeringer

Copy link
Copy Markdown
Contributor

@bjwatson @anthmgoogle Is there someone I can tag in to find out about this?

@bjwatson bjwatson added the priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. label Apr 6, 2017
@lukesneeringer

lukesneeringer commented Apr 12, 2017 •

Copy link
Copy Markdown
Contributor

@stephenplusplus @callmehiphop You should be whitelisted now. Can you try again?

@stephenplusplus

Copy link
Copy Markdown
Contributor Author

System tests pass now, just needs unit tests.

@stephenplusplus

Copy link
Copy Markdown
Contributor Author

Unit tests done, ready for your review @callmehiphop!

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling da91d49 on stephenplusplus:spp--2057 into 326ad28 on GoogleCloudPlatform:master.

assert(promisified);
});

it('should localize the request function', function(done) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 33ef55c on stephenplusplus:spp--2057 into 326ad28 on GoogleCloudPlatform:master.

@stephenplusplus
stephenplusplus merged commit 8bc7f0d into googleapis:master Apr 14, 2017
sofisl pushed a commit that referenced this pull request Feb 25, 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. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants