Skip to content

Permissions Management API

M♢NTΛSIM edited this page Aug 17, 2024 · 1 revision

Permissions Management API Documentation

Create a New Permission

  • POST /permissions/
    • Summary: Creates a new permission record. This endpoint is accessible only to users with admin permissions.
    • Security: Bearer Authentication
    • Request Body:
      • Content-Type: application/json
      • Schema:
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The name of the permission."
            },
            "description": {
              "type": "string",
              "description": "A brief description of the permission."
            }
          }
        }
    • Responses:
      • 201 Created: Permission created successfully.
      • 400 Bad Request: Invalid input data.
    • Tags:
      • Permissions Management

Retrieve a List of Permissions

  • GET /permissions/
    • Summary: Fetches a list of permissions, optionally filtered by various criteria.
    • Security: Bearer Authentication
    • Responses:
      • 200 OK: A list of permissions.
        • Content-Type: application/json
        • Schema:
          {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              }
            }
          }
    • Tags:
      • Permissions Management

Delete Multiple Permissions

  • DELETE /permissions/
    • Summary: Deletes a list of permissions based on provided identifiers.
    • Security: Bearer Authentication
    • Request Body:
      • Content-Type: application/json
      • Schema:
        {
          "type": "object",
          "properties": {
            "ids": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Array of permission IDs to delete."
            }
          }
        }
    • Responses:
      • 200 OK: Permissions deleted successfully.
      • 400 Bad Request: Invalid request format.
    • Tags:
      • Permissions Management

Create Default Permission Set

  • POST /permissions/default
    • Summary: Generates and assigns default permissions.
    • Security: Bearer Authentication
    • Responses:
      • 201 Created: Default permissions created successfully.
    • Tags:
      • Permissions Management

Retrieve a Permission by ID

  • GET /permissions/{id}
    • Summary: Fetches details of a specific permission by its ID.
    • Security: Bearer Authentication
    • Parameters:
      • Path Parameter:
        • Name: id
        • Description: The ID of the permission.
        • Schema:
          {
            "type": "string"
          }
    • Responses:
      • 200 OK: Permission details retrieved successfully.
      • 404 Not Found: Permission not found.
    • Tags:
      • Permissions Management

Update a Permission by ID

  • PUT /permissions/{id}
    • Summary: Modifies details of a specific permission using its ID.
    • Security: Bearer Authentication
    • Request Body:
      • Content-Type: application/json
      • Schema:
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "Updated name of the permission."
            },
            "description": {
              "type": "string",
              "description": "Updated description of the permission."
            }
          }
        }
    • Responses:
      • 200 OK: Permission updated successfully.
      • 404 Not Found: Permission not found.
    • Tags:
      • Permissions Management

Delete a Permission by ID

  • DELETE /permissions/{id}
    • Summary: Removes a specific permission using its ID.
    • Security: Bearer Authentication
    • Parameters:
      • Path Parameter:
        • Name: id
        • Description: The ID of the permission to delete.
        • Schema:
          {
            "type": "string"
          }
    • Responses:
      • 200 OK: Permission deleted successfully.
      • 404 Not Found: Permission not found.
    • Tags:
      • Permissions Management

Handles Unsupported Methods

  • All Other Methods on /permissions/, /permissions/default, and /permissions/{id}
    • Summary: Handles unsupported methods for the respective endpoints.
    • Responses:
      • 405 Method Not Allowed: Method not supported.
    • Tags:
      • Permissions Management