Bulk create that creates all the permissions and return a list of errors.
Permission Level: Read-Write
POST /users/permissions
Operation id: PermissionService_CreatePermissions
Tags: PermissionService
Security
- Authorization (apiKey)
- Bearer token
Responses
200 — A successful response.
Content type: application/json
default — An unexpected error response.
Content type: application/json
Request body
Required: Yes
application/json
Schema
| Property | Type | Required | Description |
|---|---|---|---|
ownerTenantId | string | No | |
permissions | array | No | |
rollback | boolean | No |
{
"type": "object",
"properties": {
"ownerTenantId": {
"type": "string"
},
"permissions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"friendlyId": {
"type": "string"
},
"domain": {
"type": "string"
},
"scope": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"type": "string"
},
"grants": {
"type": "string"
},
"tenants": {
"type": "string"
},
"targets": {
"type": "array",
"items": {
"type": "object",
"description": "Targets describe what the permission applies to.\nFor example if you wanted to have an admin permission and wanted the user to only have permissions on unitA and unitB\nyou would design your target like this:\nid_type = \"byUnit\"\nid = \"unitA,unitB\"\nThe actual values used are free form and determined by the application when designing their authorization model.\nSome standards we try to stick to despite the free form are:\nid_type we try and model with by{{Thing}}. The most common use case for this is byTenant (which we moved up to the base permission\nlevel, see permission.proto).\nFor ID, which is the actual value this is giving access to we recommend using:\n* - if the user should have access to everything in that Thing. so a byTenant - * permission would give access to ALL tenants.\n^ - gives access to the user's own Thing. For example - byTenant - ^ would give access to the user's own tenant.\nThis gives the ability to create a single permission that can be used by multiple roles.\nOtherwise we use a specific value, so byTenant - mytenant would give access to the \"mytenant\" tenant. This is best used for giving\naccess to someone outside of our tenant to your tenant, or if you have a list of specific things that wont change depending on who\nhas access to the permission."
}
},
"roles": {
"type": "array",
"items": {
"type": "object"
}
},
"users": {
"type": "array",
"items": {
"type": "object"
}
},
"systemLevel": {
"type": "boolean",
"description": "whether permission is a system_level permission or not, Default: false, Required: false\nNote: If permission is being created by a user from tenant other than \"root\" then system_level will be set to false irrespective of what value is set for this boolean."
},
"groupIds": {
"type": "array",
"items": {
"type": "string"
}
},
"typeFriendlyName": {
"type": "string",
"description": "Friendly name of the type of permission. Required: false."
},
"grantFriendlyName": {
"type": "string",
"description": "Friendly name of the grant from PERMISSION_GRANTS property. Required: false."
},
"grantDescription": {
"type": "string",
"description": "Description of the grant from PERMISSION_GRANTS property. Required: false."
}
}
}
},
"rollback": {
"type": "boolean"
}
}
}
Response models
200 — A successful response.
Content type: application/json
Schema
| Property | Type | Required | Description |
|---|---|---|---|
permissions | array | No |
{
"type": "object",
"properties": {
"permissions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"permissionId": {
"type": "string"
},
"ownerTenantId": {
"type": "string",
"description": "Owner tenant of the permission to which it belongs."
},
"friendlyId": {
"type": "string"
},
"domain": {
"type": "string"
},
"scope": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"type": "string"
},
"grants": {
"type": "string"
},
"tenants": {
"type": "string"
},
"targets": {
"type": "array",
"items": {
"type": "object",
"description": "Targets describe what the permission applies to.\nFor example if you wanted to have an admin permission and wanted the user to only have permissions on unitA and unitB\nyou would design your target like this:\nid_type = \"byUnit\"\nid = \"unitA,unitB\"\nThe actual values used are free form and determined by the application when designing their authorization model.\nSome standards we try to stick to despite the free form are:\nid_type we try and model with by{{Thing}}. The most common use case for this is byTenant (which we moved up to the base permission\nlevel, see permission.proto).\nFor ID, which is the actual value this is giving access to we recommend using:\n* - if the user should have access to everything in that Thing. so a byTenant - * permission would give access to ALL tenants.\n^ - gives access to the user's own Thing. For example - byTenant - ^ would give access to the user's own tenant.\nThis gives the ability to create a single permission that can be used by multiple roles.\nOtherwise we use a specific value, so byTenant - mytenant would give access to the \"mytenant\" tenant. This is best used for giving\naccess to someone outside of our tenant to your tenant, or if you have a list of specific things that wont change depending on who\nhas access to the permission."
}
},
"roles": {
"type": "array",
"items": {
"type": "object"
}
},
"users": {
"type": "array",
"items": {
"type": "object"
}
},
"systemLevel": {
"type": "boolean"
},
"groupIds": {
"type": "array",
"items": {
"type": "string"
}
},
"deactivated": {
"type": "boolean"
},
"creationTime": {
"type": "string",
"format": "date-time"
},
"lastUpdated": {
"type": "string",
"format": "date-time"
},
"typeFriendlyName": {
"type": "string",
"description": "Friendly name of the type of permission. Blank if not set."
},
"scopeFriendlyName": {
"type": "string",
"description": "Friendly name of the scope of the permission. Blank if not set."
},
"grantFriendlyName": {
"type": "string",
"description": "Friendly name of the grant from PERMISSION_GRANTS property. Blank if not set."
},
"grantDescription": {
"type": "string",
"description": "Description of the grant from PERMISSION_GRANTS property. Blank if not set."
}
}
}
}
}
}
default — An unexpected error response.
Content type: application/json
Schema
| Property | Type | Required | Description |
|---|---|---|---|
code | integer (int32) | No | |
message | string | No | |
details | array | No |
{
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
}
}
}
}
}