Google 云存储 - 权限不足

2024-04-15

这个问题似乎与另一篇文章相似,但对我来说不同。因为我检查了testIamPermission,回报显示我获得了所需的所有许可并且仍然收到权限不足.

这是我收到的:

{'storage.buckets.get' : true}
{'storage.buckets.getIamPolicy' : true}
{'storage.objects.create' : true}
{'storage.objects.delete' : true}
{'storage.objects.get' : true}
{'storage.objects.getIamPolicy' : true}
{'storage.objects.list' : true}
{'storage.objects.setIamPolicy' : true}
{'storage.objects.update' : true}

我用来测试的代码:

googleBucket.iam.testPermissions([testPermissions], function(err, permissions) {
  if(!err)
    console.log(permissions);
  })

我错过了许可:

'storage.buckets.create',
'storage.buckets.delete',
'storage.buckets.list',
'storage.buckets.setIamPolicy',
'storage.buckets.update',

真的很困惑,我获得了创建对象的所有权限,但仍然抛出一个权限不足。我使用的 api 只是将文件上传到存储桶上。我是否错过了任何许可? (服务器位于Google Compute Engine,与Google Cloud Storage在同一项目上)


哪个用户运行该脚本会很有趣。

因为,运行脚本的用户/服务似乎只有viewer,但不是editor角色。签入IAM,如果您已将适当的角色分配给适当的服务帐户。您可能还需要登录GCE使用 Cloud shell 实例并添加这些服务帐户凭据。在cloud shell中,右上角有一个很小的“上传”按钮,可用于上传凭证json文件到虚拟机中。这文档 https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances也一步一步地解释了这一点。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Google 云存储 - 权限不足 的相关文章

随机推荐