1.5. API を使用したリポジトリーのアクセス設定の調整
API を使用してリポジトリーのユーザーアカウントまたはロボットアカウントのアクセス設定を調整するには、次の手順に従います。
前提条件
- ユーザーアカウントまたはロボットアカウントを作成した。
- OAuth アクセストークンを作成し ました。
手順
ユーザーの権限を変更するには、次の
PUT/api/v1/repository/{repository}/permissions/user/{username}
コマンドを入力します。curl -X PUT \ -H "Authorization: Bearer <bearer_token>" \ -H "Content-Type: application/json" \ -d '{"role": "admin"}' \ https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository>/permissions/user/<username>
$ curl -X PUT \ -H "Authorization: Bearer <bearer_token>" \ -H "Content-Type: application/json" \ -d '{"role": "admin"}' \ https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository>/permissions/user/<username>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"role": "admin", "name": "quayadmin+test", "is_robot": true, "avatar": {"name": "quayadmin+test", "hash": "ca9afae0a9d3ca322fc8a7a866e8476dd6c98de543decd186ae090e420a88feb", "color": "#8c564b", "kind": "robot"}}
{"role": "admin", "name": "quayadmin+test", "is_robot": true, "avatar": {"name": "quayadmin+test", "hash": "ca9afae0a9d3ca322fc8a7a866e8476dd6c98de543decd186ae090e420a88feb", "color": "#8c564b", "kind": "robot"}}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の権限を削除するには、
DELETE/api/v1/repository/{repository}/permissions/user/{username}
コマンドを入力します。curl -X DELETE \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository>/permissions/user/<username>
$ curl -X DELETE \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository>/permissions/user/<username>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow このコマンドは CLI に出力を返しません。代わりに、
GET/api/v1/repository/{repository}/permissions/user/
コマンドを入力して、権限が削除されたことを確認できます。curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository>/permissions/user/<username>/
$ curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository>/permissions/user/<username>/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"message":"User does not have permission for repo."}
{"message":"User does not have permission for repo."}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow