Permissions Interface (v1)

http://github.com/org/folio/mod-auth/_tenantPermissions

Table of contents

tenant permissions API implementation

This API provides a callback point for Okapi when new permission sets are added to the tenant

/_/tenantpermissions

POST /_/tenantpermissions

Load new permissionSets into the permission module when a module gets enabled for a tenant

POST /_/tenantpermissions
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Okapi Permissions Set",
  "type": "object",
  "description": "A set of permissions populated by Okapi",
  "properties": {
    "moduleId": {
      "description": "The ID of the Okapi module that provides these permissions",
      "type": "string"
    },
    "perms": {
      "description": "A set of permissions",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "title": "Okapi Permission Object",
        "description": "An individual permission from an Okapi permission set",
        "javaType": "org.folio.rest.jaxrs.model.OkapiPermission",
        "properties": {
          "permissionName": {
            "description": "The unique permission name",
            "type": "string"
          },
          "replaces": {
            "description": "previously used names for this permission",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "displayName": {
            "description": "The human-readable name",
            "type": "string"
          },
          "description": {
            "description": "Description of the permission",
            "type": "string"
          },
          "subPermissions": {
            "description": "A list of child permissions granted by this permission",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "visible": {
            "description": "Whether or not this permission is visible to users",
            "type": "boolean"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "required": [
    "moduleId"
  ]
}

Example:

{
  "moduleId": "sample-module",
  "perms": [
    {
      "permissionName": "everything",
      "displayName": "every possible permission",
      "description": "All permissions combined",
      "subPermissions": [
        "sample.needed",
        "sample.extra"
      ]
    }
  ]
}

Response 201

Permissions loaded successfully

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Okapi Permissions Set",
  "type": "object",
  "description": "A set of permissions populated by Okapi",
  "properties": {
    "moduleId": {
      "description": "The ID of the Okapi module that provides these permissions",
      "type": "string"
    },
    "perms": {
      "description": "A set of permissions",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "title": "Okapi Permission Object",
        "description": "An individual permission from an Okapi permission set",
        "javaType": "org.folio.rest.jaxrs.model.OkapiPermission",
        "properties": {
          "permissionName": {
            "description": "The unique permission name",
            "type": "string"
          },
          "replaces": {
            "description": "previously used names for this permission",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "displayName": {
            "description": "The human-readable name",
            "type": "string"
          },
          "description": {
            "description": "Description of the permission",
            "type": "string"
          },
          "subPermissions": {
            "description": "A list of child permissions granted by this permission",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "visible": {
            "description": "Whether or not this permission is visible to users",
            "type": "boolean"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "required": [
    "moduleId"
  ]
}

Response 400

Bad request

Body

Media type: text/plain

Type: any

Example:

Bad request

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "An error",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message text"
          },
          "type": {
            "type": "string",
            "description": "Error message type"
          },
          "code": {
            "type": "string",
            "description": "Error message code"
          },
          "parameters": {
            "type": "object",
            "description": "Error message parameters",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "message"
        ]
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Error