Simulate permissions for a user
POST/v1/blueprints/:blueprint_identifier/permissions/simulate
This route allows you to simulate what permissions a specific user would have for entities in a blueprint.
Provide a userIdentifier and operation to see which entities are accessible, or additionally provide an entityIdentifier to see detailed permission checks for that specific entity.
To learn more, see the permission simulator documentation.
Request
Parameters (JSON)
{
"parameters": [
{
"schema": {
"type": "string",
"minLength": 1
},
"in": "path",
"name": "blueprint_identifier",
"required": true,
"description": "The identifier of the blueprint to operate on."
}
]
}Request body schema (JSON)
{
"title": "Body",
"body": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"userIdentifier": {
"type": "string",
"description": "The identifier of the user to simulate permissions for."
},
"operation": {
"type": "string",
"enum": [
"read",
"register",
"update",
"unregister"
],
"description": "The operation to simulate permissions for."
},
"entityIdentifier": {
"type": "string",
"description": "The identifier of the entity to simulate permissions for."
},
"entity": {
"allOf": [
{
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"title": {
"type": "string"
},
"team": {
"type": "array",
"items": {
"type": "string"
}
},
"icon": {
"type": "string"
},
"properties": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"relations": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
]
}
}
},
"required": [
"properties"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"identifier": {
"type": "string"
}
},
"additionalProperties": false
}
],
"description": "The entity to register or update."
},
"permissions": {
"description": "The permissions to simulate.",
"type": "object",
"properties": {
"entities": {
"type": "object",
"properties": {
"read": {
"type": "object",
"properties": {
"roles": {
"description": "The roles to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"users": {
"description": "The users to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"teams": {
"description": "The teams to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"ownedByTeam": {
"description": "The owned by team to simulate permissions for.",
"type": "boolean"
},
"policy": {
"type": "object",
"properties": {
"combinator": {
"type": "string",
"enum": [
"and",
"or"
]
},
"rules": {
"type": "array",
"items": {}
}
},
"required": [
"combinator",
"rules"
],
"additionalProperties": false
}
},
"additionalProperties": false
},
"register": {
"type": "object",
"properties": {
"roles": {
"description": "The roles to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"users": {
"description": "The users to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"teams": {
"description": "The teams to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"ownedByTeam": {
"description": "The owned by team to simulate permissions for.",
"type": "boolean"
},
"policy": {
"type": "object",
"properties": {
"combinator": {
"type": "string",
"enum": [
"and",
"or"
]
},
"rules": {
"type": "array",
"items": {}
}
},
"required": [
"combinator",
"rules"
],
"additionalProperties": false
}
},
"additionalProperties": false
},
"update": {
"type": "object",
"properties": {
"roles": {
"description": "The roles to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"users": {
"description": "The users to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"teams": {
"description": "The teams to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"ownedByTeam": {
"description": "The owned by team to simulate permissions for.",
"type": "boolean"
},
"policy": {
"type": "object",
"properties": {
"combinator": {
"type": "string",
"enum": [
"and",
"or"
]
},
"rules": {
"type": "array",
"items": {}
}
},
"required": [
"combinator",
"rules"
],
"additionalProperties": false
}
},
"additionalProperties": false
},
"unregister": {
"type": "object",
"properties": {
"roles": {
"description": "The roles to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"users": {
"description": "The users to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"teams": {
"description": "The teams to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"ownedByTeam": {
"description": "The owned by team to simulate permissions for.",
"type": "boolean"
},
"policy": {
"type": "object",
"properties": {
"combinator": {
"type": "string",
"enum": [
"and",
"or"
]
},
"rules": {
"type": "array",
"items": {}
}
},
"required": [
"combinator",
"rules"
],
"additionalProperties": false
}
},
"additionalProperties": false
},
"updateProperties": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "object",
"properties": {
"roles": {
"description": "The roles to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"users": {
"description": "The users to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"teams": {
"description": "The teams to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"ownedByTeam": {
"description": "The owned by team to simulate permissions for.",
"type": "boolean"
}
},
"additionalProperties": false
}
},
"updateRelations": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "object",
"properties": {
"roles": {
"description": "The roles to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"users": {
"description": "The users to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"teams": {
"description": "The teams to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"ownedByTeam": {
"description": "The owned by team to simulate permissions for.",
"type": "boolean"
}
},
"additionalProperties": false
}
},
"readProperties": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "object",
"properties": {
"roles": {
"description": "The roles to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"users": {
"description": "The users to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"teams": {
"description": "The teams to simulate permissions for.",
"type": "array",
"items": {
"type": "string"
}
},
"ownedByTeam": {
"description": "The owned by team to simulate permissions for.",
"type": "boolean"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false,
"description": "The entities to simulate permissions for."
}
},
"additionalProperties": false
}
},
"required": [
"userIdentifier",
"operation"
],
"additionalProperties": false
}
}
},
"required": true
}
}Responses
- 401
- 404
- 413
- 422
Default Response
A resource with the provided identifier was not found
Request body is too large (limit is 1MiB)
The json provided does not match the route's schema
Responses (JSON)
{
"responses": {
"401": {
"description": "Default Response",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error"
],
"additionalProperties": false
}
}
}
},
"404": {
"description": "A resource with the provided identifier was not found",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error",
"message"
],
"additionalProperties": false,
"description": "A resource with the provided identifier was not found"
}
}
}
},
"413": {
"description": "Request body is too large (limit is 1MiB)",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error"
],
"additionalProperties": false,
"description": "Request body is too large (limit is 1MiB)"
}
}
}
},
"422": {
"description": "The json provided does not match the route's schema",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error",
"message"
],
"additionalProperties": false,
"description": "The json provided does not match the route's schema"
}
}
}
}
}
}