Hi,
We are planning to implement a REST API endpoint to APIM 3.2.0. This API is
supposed to get the scope-role mapping. Earlier we implement this API under
'setting' resource and as per discussion, we planned to move it to
'system-scopes' with some modifications.
We need to add a tag to classify the scopes according to the portal that
belongs to. You can find the previous implementation here[1].

Please find the new OAS definition and resources below:

/system-scopes/scopes:
    #--------------------------------------------------
    # Retrieve the list of role scope mapping
    #--------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:scope_manage
      summary: |
        Get the list of role scope mapping.
      description: |
        This operation is used to get the list of role scope mapping from
tenant-conf for the apim admin dashboard
      tags:
        - System Scopes
      responses:
        200:
          description: |
            OK.
            The list of role scope mappings are returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
          schema:
            $ref: '#/definitions/ScopeList'
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        500:
          description: |
            Internal Server Error.
            An internal server error occurred while retrieving the role
scope mapping.
          schema:
            $ref: '#/definitions/Error'

#-----------------------------------------------------
# The Role Scope Mapping List resource
#-----------------------------------------------------
  ScopeList:
    title: Role Scope Mapping List
    properties:
      list:
        type: array
        items:
          $ref: '#/definitions/Scope'

#-----------------------------------------------------
# The Role Scope resource
#-----------------------------------------------------
Scope:
    title: Role Scope
    properties:
      tag:
        type: string
        description: |
          Portal name.
        example: "publisher"
      scope:
        type: string
        description: |
          Scope name.
        example: "apim:api_publish"
      description:
        type: string
        description: |
          About scope.
        example: "Publish API"
      roles:
        type: string
        description: |
          Roles for the particular scope.
        example: "admin,Internal/publisher"

The flow of this API:

   - Get the scope list from tenant-conf.
   - Get the scope list of each portal from the YAML file.
   - For each portal-scope-list, set DTO with expected properties (tag,
   role, description and roles) in the response.

Appreciate your thoughts on the above and correct me if I am wrong.

[1] - https://github.com/wso2/carbon-apimgt/pull/8640

Thanks & Regards,
*S.Meruja* |Software Engineer | WSO2 Inc.
(m) +94779650506 | Email: [email protected]
Linkedin:   https://www.linkedin.com/in/meruja
<https://www.google.com/url?q=https://www.linkedin.com/in/meruja>
Medium: https://medium.com/@meruja
<http://wso2.com/signature>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to