6.11. Red Hat Quay API を使用してリポジトリー権限を管理する


リポジトリー権限は、Red Hat Quay API を使用して管理できます。たとえば、ユーザーおよびチームの権限を作成、表示、削除できます。

次の手順は、Red Hat Quay API を使用してリポジトリー権限を管理する方法を示しています。

6.11.1. Red Hat Quay API を使用してユーザー権限を管理する

Red Hat Quay API を使用してユーザー権限を管理するには、次の手順に従います。

手順

  1. ユーザーのリポジトリー権限を取得するには、GET /api/v1/repository/{repository}/permissions/user/{username} エンドポイントを使用します。以下に例を示します。

    $ curl -X GET \
      -H "Authorization: Bearer <access_token>" \
      "https://quay-server.example.com/api/v1/repository/<repository_path>/permissions/user/<username>"

    出力例

    $ {"role": "read", "name": "testuser", "is_robot": false, "avatar": {"name": "testuser", "hash": "f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a", "color": "#6b6ecf", "kind": "user"}, "is_org_member": false}

  2. すべてのユーザー権限は GET /api/v1/repository/{repository}/permissions/user/ エンドポイントを使用して返せます。

    $ curl -X GET \
      -H "Authorization: Bearer <access_token>" \
      "https://quay-server.example.com/api/v1/repository/<namespace>/<repository>/permissions/user/"

    出力例

    {"permissions": {"quayadmin": {"role": "admin", "name": "quayadmin", "is_robot": false, "avatar": {"name": "quayadmin", "hash": "6d640d802fe23b93779b987c187a4b7a4d8fbcbd4febe7009bdff58d84498fba", "color": "#f7b6d2", "kind": "user"}, "is_org_member": true}, "test+example": {"role": "admin", "name": "test+example", "is_robot": true, "avatar": {"name": "test+example", "hash": "3b03050c26e900500437beee4f7f2a5855ca7e7c5eab4623a023ee613565a60e", "color": "#a1d99b", "kind": "robot"}, "is_org_member": true}}}

  3. または、GET /api/v1/repository/{repository}/permissions/user/{username}/transitive エンドポイントを使用して、ユーザーのリポジトリー権限のみを返すこともできます。

    $ curl -X GET \
      -H "Authorization: Bearer <access_token>" \
      "https://quay-server.example.com/api/v1/repository/<repository_path>/permissions/user/<username>/transitive"

    出力例

    {"permissions": [{"role": "admin"}]}

  4. PUT /api/v1/repository/{repository}/permissions/user/{username} エンドポイントを使用して、ユーザーを admin にするなど、ユーザーの権限を変更できます。以下に例を示します。

    $ curl -X PUT \
      -H "Authorization: Bearer <access_token>" \
      -H "Content-Type: application/json" \
      -d '{"role": "<role>"}' \
      "https://quay-server.example.com/api/v1/repository/<repository_path>/permissions/user/<username>"

    出力例

    {"role": "admin", "name": "testuser", "is_robot": false, "avatar": {"name": "testuser", "hash": "f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a", "color": "#6b6ecf", "kind": "user"}, "is_org_member": false}

  5. ユーザー権限は、DELETE /api/v1/repository/{repository}/permissions/user/{username} エンドポイントを使用して削除できます。以下に例を示します。

    $ curl -X DELETE \
      -H "Authorization: Bearer <access_token>" \
      "https://quay-server.example.com/api/v1/repository/<namespace>/<repository>/permissions/user/<username>"

    このコマンドは出力を返しません。

6.11.2. Red Hat Quay API を使用してチーム権限を管理する

Red Hat Quay API を使用してチーム権限を管理するには、次の手順に従います。

  1. 指定されたチームの権限は、GET /api/v1/repository/{repository}/permissions/team/{teamname} エンドポイントを使用して返せます。

    $ curl -X GET \
      -H "Authorization: Bearer <access_token>" \
      "https://quay-server.example.com/api/v1/repository/<namespace>/<repository>/permissions/team/<teamname>"

    出力例

    {"role": "write"}

  2. すべてのチームの権限は、GET /api/v1/repository/{repository}/permissions/team/ エンドポイントを使用して返せます。以下に例を示します。

    $ curl -X GET \
      -H "Authorization: Bearer <access_token>" \
      "https://quay-server.example.com/api/v1/repository/<namespace>/<repository>/permissions/team/"

    出力例

    {"permissions": {"ironmanteam": {"role": "read", "name": "ironmanteam", "avatar": {"name": "ironmanteam", "hash": "8045b2361613622183e87f33a7bfc54e100a41bca41094abb64320df29ef458d", "color": "#969696", "kind": "team"}}, "sillyteam": {"role": "read", "name": "sillyteam", "avatar": {"name": "sillyteam", "hash": "f275d39bdee2766d2404e2c6dbff28fe290969242e9fcf1ffb2cde36b83448ff", "color": "#17becf", "kind": "team"}}}}

  3. 指定されたチームの権限は、PUT /api/v1/repository/{repository}/permissions/team/{teamname} コマンドを使用して変更できます。以下に例を示します。

    $ curl -X PUT \
      -H "Authorization: Bearer <access_token>" \
      -H "Content-Type: application/json" \
      -d '{"role": "<role>"}' \
      "https://quay-server.example.com/api/v1/repository/<namespace>/<repository>/permissions/team/<teamname>"

    出力例

    {"role": "admin", "name": "superteam", "avatar": {"name": "superteam", "hash": "48cb6d114200039fed5c601480653ae7371d5a8849521d4c3bf2418ea013fc0f", "color": "#9467bd", "kind": "team"}}

  4. チーム権限は、DELETE /api/v1/repository/{repository}/permissions/team/{teamname} ンドを使用して削除できます。以下に例を示します。

    $ curl -X DELETE \
      -H "Authorization: Bearer <access_token>" \
      "https://quay-server.example.com/api/v1/repository/<namespace>/<repository>/permissions/team/<teamname>"

    このコマンドは CLI に出力を返しません。

Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.