Uploaded image for project: 'Project Quay'
  1. Project Quay
  2. PROJQUAY-7154

deleteOrganizationTeamMember API with super user token doesn't work when enable FEATURE_SUPERUSERS_FULL_ACCESS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • quay-v3.11.2
    • quay-v3.11.0
    • quay

      Description of problem:

      When enable FEATURE_SUPERUSERS_FULL_ACCESS, deleteOrganizationTeamMember API with super user token doesn't work against team created by normal user. 

      Version-Release number of selected component (if applicable):

      quay-operator-bundle-container-v3.11.1-18)
      ------------------------------ 
      registry.redhat.io/quay/quay-operator-rhel8@sha256:a3a2171448b30385700e6f64633016abfb5dc331849a91cdc354405a32eb444c
      ------------------------------
      registry.redhat.io/quay/quay-rhel8@sha256:bca647c67c7ece7fb427498db44af850ca05b4cba2f55b78d90fb9d7059883e7

      How reproducible:

      1. enable FEATURE_SUPERUSERS_FULL_ACCESS in quay config.yaml

      FEATURE_SUPERUSERS_FULL_ACCESS: true 
      SUPER_USERS:
        - whuquay

      2. Create a normal user "user1" , "user3"  and a super user "whuquay".

      3. log in quay by normal user "user1" and create a organization "user1_org"

      4 create a team  "user1_team"  by normal user1

      $ curl -k -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H "Authorization: Bearer pt6TaFkCp0oxKWvVMuIl5hhezFetGVgFF57zf3WU"  --data '{"role": "member"}' https://quayregistry-quay-quay-enterprise.apps.whu415aw14.qe.devcluster.openshift.com/api/v1/organization/user1_org/team/user1_team
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   260  100   242  100    18    135     10  0:00:01  0:00:01 --:--:--   145
      {
        "name": "user1_team",
        "description": "",
        "can_view": true,
        "role": "member",
        "avatar": {
          "name": "user1_team",
          "hash": "573545c1eceaf01f637d3e0fe05eb38ee91861600fff9a8c3cbf5568a76f7868",
          "color": "#9c9ede",
          "kind": "team"
        },
        "new_team": true
      }

      5 add user3 to this team  

      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      -> super user token : Uh7HKz1jKpzpkXqHb6eZncTwXDiuz18EkzZ8o0BC
      -> normal user token: pt6TaFkCp0oxKWvVMuIl5hhezFetGVgFF57zf3WU
      ->
      -> Add user to team by super user
      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      
      ------------------------------
      $ curl -k -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H "Authorization: Bearer Uh7HKz1jKpzpkXqHb6eZncTwXDiuz18EkzZ8o0BC" https://quayregistry-quay-quay-enterprise.apps.whu415aw14.qe.devcluster.openshift.com/api/v1/organization/user1_org/team/user1_team/members/user3
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   212  100   212    0     0    211      0  0:00:01  0:00:01 --:--:--   211
      {
        "name": "user3",
        "kind": "user",
        "is_robot": false,
        "avatar": {
          "name": "user3",
          "hash": "924773ae8821ac150e7cb9d042a11403e89be6499a826dc5714e969a1cfc832b",
          "color": "#17becf",
          "kind": "user"
        },
        "invited": false
      } 

      6. call deleteOrganizationTeamMember API with super user token against team "user1_team" to remove user3

      Actual results:

      Super user can't remove user3 by calling API "DELETE /api/v1/organization/{orgname}/team/{teamname}/members/{membername}"  when enable FEATURE_SUPERUSERS_FULL_ACCESS

      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      -> super user token : Uh7HKz1jKpzpkXqHb6eZncTwXDiuz18EkzZ8o0BC
      -> normal user token: pt6TaFkCp0oxKWvVMuIl5hhezFetGVgFF57zf3WU
      ->
      -> delete user from team by super user
      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      
      ------------------------------
      $ curl -k -X DELETE  -H "Content-Type: application/json" -H "Authorization: Bearer Uh7HKz1jKpzpkXqHb6eZncTwXDiuz18EkzZ8o0BC" https://quayregistry-quay-quay-enterprise.apps.whu415aw14.qe.devcluster.openshift.com/api/v1/organization/user1_org/team/user1_team/members/user3
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   271  100   271    0     0    288      0 --:--:-- --:--:-- --:--:--   288
      {
        "detail": "Unauthorized",
        "error_message": "Unauthorized",
        "error_type": "insufficient_scope",
        "title": "insufficient_scope",
        "type": "https://quayregistry-quay-quay-enterprise.apps.whu415aw14.qe.devcluster.openshift.com/api/v1/error/insufficient_scope",
        "status": 403
      }

      Expected results

      Super user can remove user3 by calling API " DELETE /api/v1/organization/{orgname}/team/{teamname}/members/{membername}"  when enable FEATURE_SUPERUSERS_FULL_ACCESS

      Additional Information:

      Normal user "user1" can remove user3 by calling API "DELETE /api/v1/organization/{orgname}/team/{teamname}/members/{membername}" successfully.

      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      -> super user token : Uh7HKz1jKpzpkXqHb6eZncTwXDiuz18EkzZ8o0BC
      -> normal user token: pt6TaFkCp0oxKWvVMuIl5hhezFetGVgFF57zf3WU
      ->
      -> delete user from team by normal user
      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      
      ------------------------------
      $ curl -k -X DELETE  -H "Content-Type: application/json" -H "Authorization: Bearer pt6TaFkCp0oxKWvVMuIl5hhezFetGVgFF57zf3WU" https://quayregistry-quay-quay-enterprise.apps.whu415aw14.qe.devcluster.openshift.com/api/v1/organization/user1_org/team/user1_team/members/user3 |jq .
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
        0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
      
      ------------------------------
      $ curl -k -X GET -H "Content-Type: application/json" -H "Authorization: Bearer pt6TaFkCp0oxKWvVMuIl5hhezFetGVgFF57zf3WU" https://quayregistry-quay-quay-enterprise.apps.whu415aw14.qe.devcluster.openshift.com/api/v1/organization/user1_org/team/user1_team/members|jq .
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100    56  100    56    0     0     56      0  0:00:01 --:--:--  0:00:01    56
      {
        "name": "user1_team",
        "members": [],
        "can_edit": true
      }
      
      

              bcaton@redhat.com Brandon Caton
              rhwhu Weihua Hu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: