0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

chore(core): add api docs

This commit is contained in:
Gao Sun 2023-12-01 18:28:49 +08:00
parent 9fd49c6caa
commit 22e6c9d99e
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
17 changed files with 985 additions and 62 deletions

View file

@ -15,7 +15,7 @@
"copy:apidocs": "rsync -a -m --include '*/' --include '*.openapi.json' --exclude '*' src/routes/ build/routes/",
"build": "rm -rf build/ && tsc -p tsconfig.build.json && pnpm run copy:apidocs",
"build:test": "rm -rf build/ && tsc -p tsconfig.test.json --sourcemap && pnpm run copy:apidocs",
"lint": "eslint --ext .ts src",
"lint": "eslint --ext .ts --ext .json src",
"lint:report": "pnpm lint --format json --output-file report.json",
"dev": "rm -rf build/ && nodemon",
"start": "NODE_ENV=production node .",
@ -114,6 +114,7 @@
"eslint": "^8.44.0",
"jest": "^29.5.0",
"jest-matcher-specific-error": "^1.0.0",
"jsonc-eslint-parser": "^2.4.0",
"lint-staged": "^15.0.0",
"nock": "^13.3.1",
"node-mocks-http": "^1.12.1",
@ -154,6 +155,14 @@
"rules": {
"unicorn/filename-case": "off"
}
},
{
"files": [
"*.json",
"*.json5",
"*.jsonc"
],
"parser": "jsonc-eslint-parser"
}
]
},

View file

@ -0,0 +1,223 @@
{
"paths": {
"/api/users/{userId}": {
"get": {
"parameters": [
{
"in": "query",
"name": "includeSsoIdentities",
"description": "If it's provided with a truthy value (`true`, `1`, `yes`), each user in the response will include a `ssoIdentities` property containing a list of SSO identities associated with the user."
}
],
"responses": {
"200": {
"description": "User data for the given ID.",
"content": {
"application/json": {
"schema": {
"properties": {
"ssoIdentities": {
"description": "List of SSO identities associated with the user. Only available when the `includeSsoIdentities` query parameter is provided with a truthy value."
}
}
}
}
}
}
},
"summary": "Get user",
"description": "Get user data for the given ID."
},
"patch": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"primaryPhone": {
"description": "Updated primary phone number for the user. It should be unique across all users."
},
"primaryEmail": {
"description": "Updated primary email address for the user. It should be unique across all users."
},
"username": {
"description": "Updated username for the user. It should be unique across all users."
},
"customData": {
"description": "Custom data object to update for the given user ID. Note this will replace the entire custom data object.\n\nIf you want to perform a partial update, use the `PATCH /api/users/{userId}/custom-data` endpoint instead."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Updated user data for the given ID."
}
},
"summary": "Update user",
"description": "Update user data for the given ID. This method performs a partial update."
},
"delete": {
"responses": {
"204": {
"description": "User deleted successfully."
}
},
"summary": "Delete user",
"description": "Delete user with the given ID. Note all associated data will be deleted cascadingly."
}
},
"/api/users/{userId}/custom-data": {
"get": {
"responses": {
"200": {
"description": "Custom data in JSON for the given user ID."
}
},
"summary": "Get user custom data",
"description": "Get custom data for the given user ID."
},
"patch": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"customData": {
"description": "Partial custom data object to update for the given user ID."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Updated custom data in JSON for the given user ID."
}
},
"summary": "Update user custom data",
"description": "Update custom data for the given user ID. This method performs a partial update of the custom data object."
}
},
"/api/users": {
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"description": "User data to create a new user. All properties are optional.",
"properties": {
"primaryPhone": {
"description": "Primary phone number for the user. It should be unique across all users."
},
"primaryEmail": {
"description": "Primary email address for the user. It should be unique across all users."
},
"username": {
"description": "Username for the user. It should be unique across all users."
}
}
}
}
}
},
"responses": {
"200": {
"description": "User data for the newly created user."
}
},
"summary": "Create user",
"description": "Create a new user with the given data."
}
},
"/api/users/{userId}/password": {
"patch": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"password": {
"description": "New password for the user."
}
}
}
}
}
},
"responses": {
"200": {
"description": "User password updated successfully."
}
},
"summary": "Update user password",
"description": "Update user password for the given ID."
}
},
"/api/users/{userId}/password/verify": {
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"password": {
"description": "Password to verify."
}
}
}
}
}
},
"responses": {
"204": {
"description": "User password matches."
},
"422": {
"description": "User password does not match."
}
},
"summary": "Verify user password",
"description": "Test if the given password matches the user's password."
}
},
"/api/users/{userId}/has-password": {
"get": {
"responses": {
"200": {
"description": "The result of the check."
}
},
"summary": "Check if user has password",
"description": "Check if the user with the given ID has a password set."
}
},
"/api/users/{userId}/is-suspended": {
"patch": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"isSuspended": {
"description": "New suspension status for the user."
}
}
}
}
}
},
"responses": {
"200": {
"description": "User suspension status updated successfully."
}
},
"summary": "Update user suspension status",
"description": "Update user suspension status for the given ID."
}
}
}
}

View file

@ -0,0 +1,48 @@
{
"paths": {
"/api/users/{userId}/mfa-verifications": {
"get": {
"responses": {
"200": {
"description": "An array of MFA verifications for the user."
}
},
"summary": "Get user's MFA verifications",
"description": "Get a user's existing MFA verifications for a given user ID"
},
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"type": {
"description": "The type of MFA verification to create."
}
}
}
}
}
},
"responses": {
"200": {
"description": "The MFA verification that was created."
}
},
"summary": "Create an MFA verification for a user",
"description": "Create a new MFA verification for a given user ID"
}
},
"/api/users/{userId}/mfa-verifications/{verificationId}": {
"delete": {
"responses": {
"204": {
"description": "The MFA verification was deleted successfully."
}
},
"summary": "Delete an MFA verification for a user",
"description": "Delete an MFA verification for the user with the given verification ID. The verification ID must be associated with the given user ID."
}
}
}
}

View file

@ -0,0 +1,15 @@
{
"paths": {
"/api/users/{userId}/organizations": {
"get": {
"responses": {
"200": {
"description": "An array of organizations that the user is a member of."
}
},
"summary": "Get organizations for a user",
"description": "Get all organizations that the user is a member of. In each organization object, the user's roles in that organization are included in the `organizationRoles` array."
}
}
}
}

View file

@ -0,0 +1,71 @@
{
"paths": {
"/api/users/{userId}/roles": {
"get": {
"responses": {
"200": {
"description": "An array of API resource roles assigned to the user."
}
},
"summary": "Get roles for user",
"description": "Get API resource roles assigned to the user with pagination."
},
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"roleIds": {
"description": "An array of API resource role IDs to assign."
}
}
}
}
}
},
"responses": {
"201": {
"description": "The API resource roles has been assigned to the user."
}
},
"summary": "Assign roles to user",
"description": "Assign API resource roles to the user. The roles will be added to the existing roles."
},
"put": {
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"roleIds": {
"description": "An array of API resource role IDs to assign."
}
}
}
}
}
},
"responses": {
"200": {
"description": "The API resource roles has been updated for the user successfully."
}
},
"summary": "Update roles for user",
"description": "Update API resource roles assigned to the user. This will replace the existing roles."
}
},
"/api/users/{userId}/roles/{roleId}": {
"delete": {
"responses": {
"204": {
"description": "The API resource role has been removed from the user."
}
},
"summary": "Remove role from user",
"description": "Remove an API resource role from the user."
}
}
}
}

View file

@ -0,0 +1,15 @@
{
"paths": {
"/api/users": {
"get": {
"responses": {
"200": {
"description": "An array of users that match the given criteria."
}
},
"summary": "Get users",
"description": "Get users with filters and pagination.\n\nLogto provides a very flexible way to query users. You can filter users by almost any fields with multiple modes. To learn more about the query syntax, please refer to [Advanced user search](https://docs.logto.io/docs/recipes/manage-users/advanced-user-search/)."
}
}
}
}

View file

@ -0,0 +1,44 @@
{
"paths": {
"/api/users/{userId}/identities": {
"post": {
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"connectorId": {
"description": "The Logto connector ID."
},
"connectorData": {
"description": "A json object constructed from the url query params returned by the social platform. Typically it contains `code`, `state` and `redirectUri` fields."
}
}
}
}
}
},
"responses": {
"200": {
"description": "A new identity is linked to the user."
}
},
"summary": "Link social identity to user",
"description": "Link authenticated user identity from a social platform to a Logto user.\n\nThe usage of this API is usually coupled with `POST /connectors/:connectorId/authorization-uri`. With the help of these pair of APIs, you can implement a user profile page with the link social account feature in your application.\n\nNote: Currently due to technical limitations, this API does not support the following connectors that rely on Logto interaction session: `@logto/connector-apple`, `@logto/connector-saml`, `@logto/connector-oidc` and `@logto/connector-oauth`."
}
},
"/api/users/{userId}/identities/{target}": {
"delete": {
"parameters": [],
"responses": {
"200": {
"description": "The identity is deleted from the user."
}
},
"summary": "Delete social identity from user",
"description": "Delete a social identity from the user."
}
}
}
}

View file

@ -24,20 +24,6 @@ export default function adminUserSocialRoutes<T extends AuthedRouter>(
connectors: { getLogtoConnectorById },
} = tenant;
/**
* Link authenticated user identity from a social platform to a Logto user. The usage of this API is usually
* coupled with `POST /connectors/:connectorId/authorization-uri`. With the help of these pair of APIs, you
* can implement a user profile page with the `Link Social` feature in your application.
*
* Note: Currently due to technical limitations, this API does not support the following connectors that
* rely on Logto interaction session: `@logto/connector-apple`, `@logto/connector-saml`, `@logto/connector-oidc`
* and `@logto/connector-oauth`.
*
* @param {string} userId - The id of the Logto user
* @param {string} connectorId - The id of the connector
* @param {object} connectorData - A json object constructed from the url query params returned by the social
* platform. Typically it contains `code`, `state` and `redirectUri` fields.
*/
router.post(
'/users/:userId/identities',
koaGuard({

View file

@ -0,0 +1,70 @@
{
"paths": {
"/api/applications/{applicationId}/roles": {
"get": {
"responses": {
"200": {
"description": "An array of API resource roles assigned to the application."
}
},
"summary": "Get application API resource roles",
"description": "Get API resource roles assigned to the specified application with pagination."
},
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"roleIds": {
"description": "An array of API resource role IDs to assign."
}
}
}
}
}
},
"responses": {
"201": {
"description": "The API resource roles have been assigned to the application successfully."
}
},
"summary": "Assign API resource roles to application",
"description": "Assign API resource roles to the specified application. The API resource roles will be added to the existing API resource roles."
},
"put": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"roleIds": {
"description": "An array of API resource role IDs to update for the application."
}
}
}
}
}
},
"responses": {
"200": {
"description": "The API resource roles have been updated for the application successfully."
}
},
"summary": "Update API resource roles for application",
"description": "Update API resource roles assigned to the specified application. This will replace the existing API resource roles."
}
},
"/api/applications/{applicationId}/roles/{roleId}": {
"delete": {
"responses": {
"204": {
"description": "The API resource role has been removed from the application successfully."
}
},
"summary": "Remove a API resource role from application",
"description": "Remove a API resource role from the specified application."
}
}
}
}

View file

@ -24,7 +24,7 @@
}
},
"post": {
"summary": "Create a new application",
"summary": "Create an application",
"description": "Create a new application with the given data.",
"responses": {
"200": {
@ -38,8 +38,8 @@
},
"/api/applications/{id}": {
"get": {
"summary": "Get application by ID",
"description": "Get application details by ID.",
"summary": "Get application",
"description": "Get application details.",
"responses": {
"200": {
"description": "Details of the application."
@ -50,8 +50,8 @@
}
},
"patch": {
"summary": "Update application by ID",
"description": "Update application details by ID with the given data.",
"summary": "Update application",
"description": "Update application details with the given data.",
"requestBody": {
"content": {
"application/json": {
@ -81,8 +81,8 @@
}
},
"delete": {
"summary": "Delete application by ID",
"description": "Delete application by ID.",
"summary": "Delete application",
"description": "Delete application.",
"responses": {
"204": {
"description": "The application was deleted successfully."

View file

@ -24,7 +24,7 @@
}
},
"post": {
"summary": "Create a new hook",
"summary": "Create a hook",
"description": "Create a new hook with the given data.",
"requestBody": {
"content": {
@ -56,8 +56,8 @@
},
"/api/hooks/{id}": {
"get": {
"summary": "Get hook by ID",
"description": "Get hook details by ID.",
"summary": "Get hook",
"description": "Get hook details.",
"parameters": [
{
"name": "includeExecutionStats",
@ -72,8 +72,8 @@
}
},
"patch": {
"summary": "Update hook by ID",
"description": "Update hook details by ID with the given data.",
"summary": "Update hook",
"description": "Update hook details with the given data.",
"requestBody": {
"content": {
"application/json": {
@ -102,8 +102,8 @@
}
},
"delete": {
"summary": "Delete hook by ID",
"description": "Delete hook by ID.",
"summary": "Delete hook",
"description": "Delete hook.",
"responses": {
"204": {
"description": "The hook was deleted successfully."

View file

@ -1,12 +1,14 @@
{
"tags": [{
"name": "Organizations",
"description": "Organization is a concept that brings together multiple identities (mostly users). Logto supports multiple organizations, and each organization can have multiple users.\n\nEvery organization shares the same set (organization template) of roles and permissions. Each user can have different roles in different organizations."
}],
"tags": [
{
"name": "Organizations",
"description": "Organization is a concept that brings together multiple identities (mostly users). Logto supports multiple organizations, and each organization can have multiple users.\n\nEvery organization shares the same set (organization template) of roles and permissions. Each user can have different roles in different organizations."
}
],
"paths": {
"/api/organizations": {
"post": {
"summary": "Create a new organization",
"summary": "Create an organization",
"description": "Create a new organization with the given data.",
"requestBody": {
"content": {
@ -54,8 +56,8 @@
},
"/api/organizations/{id}": {
"get": {
"summary": "Get organization by ID",
"description": "Get organization details by ID.",
"summary": "Get organization",
"description": "Get organization details.",
"responses": {
"200": {
"description": "Details of the organization."
@ -63,8 +65,8 @@
}
},
"patch": {
"summary": "Update organization by ID",
"description": "Update organization details by ID with the given data.",
"summary": "Update organization",
"description": "Update organization details with the given data.",
"requestBody": {
"content": {
"application/json": {
@ -88,8 +90,8 @@
}
},
"delete": {
"summary": "Delete organization by ID",
"description": "Delete organization by ID.",
"summary": "Delete organization",
"description": "Delete organization.",
"responses": {
"204": {
"description": "The organization was deleted successfully."

View file

@ -1,8 +1,10 @@
{
"tags": [{
"name": "Organization roles",
"description": "Organization roles are used to define a set of organization scopes that can be assigned to users. Every organization role is a part of the organization template.\n\nOrganization roles will only be meaningful within an organization context. For example, a user may have an `admin` role for organization A, but not for organization B."
}],
"tags": [
{
"name": "Organization roles",
"description": "Organization roles are used to define a set of organization scopes that can be assigned to users. Every organization role is a part of the organization template.\n\nOrganization roles will only be meaningful within an organization context. For example, a user may have an `admin` role for organization A, but not for organization B."
}
],
"paths": {
"/api/organization-roles": {
"get": {
@ -15,7 +17,7 @@
}
},
"post": {
"summary": "Create a new organization role",
"summary": "Create an organization role",
"description": "Create a new organization role with the given data.",
"requestBody": {
"content": {
@ -45,8 +47,8 @@
},
"/api/organization-roles/{id}": {
"get": {
"summary": "Get organization role by ID",
"description": "Get organization role details by ID.",
"summary": "Get organization role",
"description": "Get organization role details.",
"responses": {
"200": {
"description": "Details of the organization role."
@ -54,8 +56,8 @@
}
},
"patch": {
"summary": "Update organization role by ID",
"description": "Update organization role details by ID with the given data.",
"summary": "Update organization role",
"description": "Update organization role details with the given data.",
"requestBody": {
"content": {
"application/json": {
@ -82,8 +84,8 @@
}
},
"delete": {
"summary": "Delete organization role by ID",
"description": "Delete organization role by ID.",
"summary": "Delete organization role",
"description": "Delete organization role.",
"responses": {
"204": {
"description": "The organization role was deleted successfully."

View file

@ -1,8 +1,10 @@
{
"tags": [{
"name": "Organization scopes",
"description": "Organization scopes (permissions) are used to define actions that can be performed on a organization. Every organization scope is a part of the organization template.\n\nOrganization scopes will only be meaningful within an organization context. For example, a user may have a `read` scope for organization A, but not for organization B."
}],
"tags": [
{
"name": "Organization scopes",
"description": "Organization scopes (permissions) are used to define actions that can be performed on a organization. Every organization scope is a part of the organization template.\n\nOrganization scopes will only be meaningful within an organization context. For example, a user may have a `read` scope for organization A, but not for organization B."
}
],
"paths": {
"/api/organization-scopes": {
"get": {
@ -15,7 +17,7 @@
}
},
"post": {
"summary": "Create a new organization scope",
"summary": "Create an organization scope",
"description": "Create a new organization scope with the given data.",
"requestBody": {
"content": {
@ -45,8 +47,8 @@
},
"/api/organization-scopes/{id}": {
"get": {
"summary": "Get organization scope by ID",
"description": "Get organization scope details by ID.",
"summary": "Get organization scope",
"description": "Get organization scope details.",
"responses": {
"200": {
"description": "The organization scope data for the given ID."
@ -54,8 +56,8 @@
}
},
"patch": {
"summary": "Update organization scope by ID",
"description": "Update organization scope details by ID with the given data.",
"summary": "Update organization scope",
"description": "Update organization scope details with the given data.",
"requestBody": {
"content": {
"application/json": {
@ -82,8 +84,8 @@
}
},
"delete": {
"summary": "Delete organization scope by ID",
"description": "Delete organization scope by ID.",
"summary": "Delete organization scope",
"description": "Delete organization scope.",
"responses": {
"204": {
"description": "The organization scope was deleted successfully."

View file

@ -0,0 +1,188 @@
{
"paths": {
"/api/resources": {
"get": {
"parameters": [
{
"in": "query",
"name": "includeScopes",
"description": "If it's provided with a truthy value (`true`, `1`, `yes`), the scopes of each resource will be included in the response."
}
],
"responses": {
"200": {
"description": "An array of resources."
}
},
"summary": "Get API resources",
"description": "Get API resources in the current tenant with pagination."
},
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"name": {
"description": "The name of the resource."
},
"indicator": {
"description": "The unique resource indicator. Should be a valid URI."
},
"accessTokenTtl": {
"description": "The access token TTL in seconds. It affects the `exp` claim of the access token granted for this resource.",
"default": 3600
}
}
}
}
}
},
"responses": {
"201": {
"description": "The created resource."
}
},
"summary": "Create an API resource",
"description": "Create an API resource in the current tenant."
}
},
"/api/resources/{id}": {
"get": {
"responses": {
"200": {
"description": "The requested resource."
}
},
"summary": "Get API resource",
"description": "Get an API resource details."
},
"patch": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"name": {
"description": "The updated name of the resource."
},
"accessTokenTtl": {
"description": "The updated access token TTL in seconds."
}
}
}
}
}
},
"responses": {
"200": {
"description": "The updated resource."
}
},
"summary": "Update API resource",
"description": "Update an API resource details with the given data. This method performs a partial update."
},
"delete": {
"parameters": [],
"responses": {
"204": {
"description": "The resource was deleted successfully."
}
},
"summary": "Delete API resource",
"description": "Delete an API resource with the given ID."
}
},
"/api/resources/{id}/is-default": {
"patch": {
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"isDefault": {
"description": "The updated value of the `isDefault` property."
}
}
}
}
}
},
"responses": {
"200": {
"description": "The updated resource."
}
},
"summary": "Set API resource as default",
"description": "Set an API resource as the default resource for the current tenant.\n\nEach tenant can have only one default API resource. If an API resource is set as default, the previously set default API resource will be set as non-default. See [this section](https://docs.logto.io/docs/references/resources/#default-api) for more information."
}
},
"/api/resources/{resourceId}/scopes": {
"get": {
"responses": {
"200": {
"description": "An array of scopes for the requested resource."
}
},
"summary": "Get API resource scopes",
"description": "Get scopes (permissions) defined for an API resource."
},
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"name": {
"description": "The name of the scope. It should be unique for the resource."
}
}
}
}
}
},
"responses": {
"201": {
"description": "The created scope."
}
},
"summary": "Create API resource scope",
"description": "Create a new scope (permission) for an API resource."
}
},
"/api/resources/{resourceId}/scopes/{scopeId}": {
"patch": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"name": {
"description": "The updated name of the scope. It should be unique for the resource."
}
}
}
}
}
},
"responses": {
"200": {
"description": "The updated scope."
}
},
"summary": "Update API resource scope",
"description": "Update an API resource scope (permission) for the given resource. This method performs a partial update."
},
"delete": {
"responses": {
"204": {
"description": "The scope was deleted successfully."
}
},
"summary": "Delete API resource scope",
"description": "Delete an API resource scope (permission) from the given resource ID."
}
}
}
}

View file

@ -0,0 +1,235 @@
{
"paths": {
"/api/roles": {
"get": {
"parameters": [
{
"in": "query",
"name": "excludeUserId",
"description": "Exclude roles assigned to a user."
},
{
"in": "query",
"name": "excludeApplicationId",
"description": "Exclude roles assigned to an application."
},
{
"in": "query",
"name": "type",
"description": "Filter by role type."
}
],
"responses": {
"200": {
"description": "An array of roles matching the filters."
}
},
"summary": "Get roles",
"description": "Get roles with filters and pagination."
},
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"name": {
"description": "The name of the role. It should be unique within the tenant."
},
"type": {
"description": "The type of the role. It cannot be changed after creation."
},
"scopeIds": {
"description": "The initial API resource scopes assigned to the role."
}
}
}
}
}
},
"responses": {
"200": {
"description": "The created role."
}
},
"summary": "Create a role",
"description": "Create a new role with the given data."
}
},
"/api/roles/{id}": {
"get": {
"responses": {
"200": {
"description": "Details of the role."
}
},
"summary": "Get role",
"description": "Get role details."
},
"patch": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"name": {
"description": "The name of the role. It should be unique within the tenant."
}
}
}
}
}
},
"responses": {
"200": {
"description": "The updated role."
}
},
"summary": "Update role",
"description": "Update role details. This method performs a partial update."
},
"delete": {
"responses": {
"204": {
"description": "The role was deleted."
}
},
"summary": "Delete role",
"description": "Delete a role with the given ID."
}
},
"/api/roles/{id}/users": {
"get": {
"responses": {
"200": {
"description": "An array of users who have the role assigned."
}
},
"summary": "Get role users",
"description": "Get users who have the role assigned with pagination."
},
"post": {
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"userIds": {
"description": "An array of user IDs to be assigned."
}
}
}
}
}
},
"responses": {
"201": {
"description": "The role was assigned to the users successfully."
}
},
"summary": "Assign role to users",
"description": "Assign a role to a list of users. The role must have the type `User`."
}
},
"/api/roles/{id}/users/{userId}": {
"delete": {
"responses": {
"204": {
"description": "The role was removed from the user."
}
},
"summary": "Remove role from user",
"description": "Remove the role from a user with the given ID."
}
},
"/api/roles/{id}/applications": {
"get": {
"responses": {
"200": {
"description": "An array of applications that have the role assigned."
}
},
"summary": "Get role applications",
"description": "Get applications that have the role assigned with pagination."
},
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"applicationIds": {
"description": "An array of application IDs to be assigned."
}
}
}
}
}
},
"responses": {
"201": {
"description": "The role was assigned to the applications successfully."
}
},
"summary": "Assign role to applications",
"description": "Assign a role to a list of applications. The role must have the type `Application`."
}
},
"/api/roles/{id}/applications/{applicationId}": {
"delete": {
"responses": {
"204": {
"description": "The role was removed from the application."
}
},
"summary": "Remove role from application",
"description": "Remove the role from an application with the given ID."
}
},
"/api/roles/{id}/scopes": {
"get": {
"responses": {
"200": {
"description": "An array of API resource scopes linked with the role."
}
},
"summary": "Get role scopes",
"description": "Get API resource scopes (permissions) linked with a role."
},
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"scopeIds": {
"description": "An array of API resource scope IDs to be linked."
}
}
}
}
}
},
"responses": {
"200": {
"description": "The role was linked to the scopes successfully."
}
},
"summary": "Link scopes to role",
"description": "Link a list of API resource scopes (permissions) to a role. The original linked scopes will be kept."
}
},
"/api/roles/{id}/scopes/{scopeId}": {
"delete": {
"responses": {
"204": {
"description": "The API resource scope was unlinked from the role."
}
},
"summary": "Unlink scope from role",
"description": "Unlink an API resource scope (permission) from a role with the given ID."
}
}
}
}

View file

@ -3386,6 +3386,9 @@ importers:
jest-matcher-specific-error:
specifier: ^1.0.0
version: 1.0.0
jsonc-eslint-parser:
specifier: ^2.4.0
version: 2.4.0
lint-staged:
specifier: ^15.0.0
version: 15.0.2
@ -15319,6 +15322,16 @@ packages:
hasBin: true
dev: true
/jsonc-eslint-parser@2.4.0:
resolution: {integrity: sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies:
acorn: 8.10.0
eslint-visitor-keys: 3.4.1
espree: 9.6.0
semver: 7.5.4
dev: true
/jsonc-parser@3.2.0:
resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==}
dev: true