mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor(core): reorg organization users api docs
This commit is contained in:
parent
6dd2565dca
commit
4d879fc358
4 changed files with 216 additions and 206 deletions
|
@ -2,7 +2,7 @@
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
"name": "Organization applications",
|
"name": "Organization applications",
|
||||||
"description": "Manage organization - application relationships. An application can be associated with one or more organizations in order to grant organization access to the application.\n\nCurrently, only machine-to-machine applications can be associated with organizations."
|
"description": "Manage organization - application relationships. An application can be associated with one or more organizations in order to get access to the organization resources.\n\nCurrently, only machine-to-machine applications can be associated with organizations."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
|
|
|
@ -98,210 +98,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"/api/organizations/{id}/users": {
|
|
||||||
"post": {
|
|
||||||
"summary": "Add user members to organization",
|
|
||||||
"description": "Add users as members to the specified organization with the given user IDs.",
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"properties": {
|
|
||||||
"userIds": {
|
|
||||||
"description": "An array of user IDs to be added to the organization. Organization existed users assignment will be ignored."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": "Users were added to the organization successfully."
|
|
||||||
},
|
|
||||||
"422": {
|
|
||||||
"description": "At least one of the IDs provided is not valid. For example, the organization ID or user ID does not exist."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"put": {
|
|
||||||
"summary": "Replace organization user members",
|
|
||||||
"description": "Replace all user members for the specified organization with the given users. This effectively removing all existing user memberships in the organization and adding the new users as members.",
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"properties": {
|
|
||||||
"userIds": {
|
|
||||||
"description": "An array of user IDs to replace existing users."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"204": {
|
|
||||||
"description": "Successfully replaced all users for the organization."
|
|
||||||
},
|
|
||||||
"422": {
|
|
||||||
"description": "At least one of the IDs provided is not valid. For example, the organization ID or user ID does not exist."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"get": {
|
|
||||||
"summary": "Get organization user members",
|
|
||||||
"description": "Get users that are members of the specified organization for the given query with pagination.",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "q",
|
|
||||||
"in": "query",
|
|
||||||
"description": "The query to filter users. It will match multiple fields of users, including ID, name, username, email, and phone number.\n\nIf not provided, all users will be returned."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "A list of users that are members of the organization."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/organizations/{id}/users/{userId}": {
|
|
||||||
"delete": {
|
|
||||||
"summary": "Remove user member from organization",
|
|
||||||
"description": "Remove a user's membership from the specified organization.",
|
|
||||||
"responses": {
|
|
||||||
"204": {
|
|
||||||
"description": "The user was removed from the organization members successfully."
|
|
||||||
},
|
|
||||||
"404": {
|
|
||||||
"description": "The user is not a member of the organization."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/organizations/{id}/users/roles": {
|
|
||||||
"post": {
|
|
||||||
"summary": "Assign roles to organization user members",
|
|
||||||
"description": "Assign roles to user members of the specified organization with the given data.",
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"properties": {
|
|
||||||
"userIds": {
|
|
||||||
"description": "An array of user IDs to assign roles."
|
|
||||||
},
|
|
||||||
"organizationRoleIds": {
|
|
||||||
"description": "An array of organization role IDs to assign. User existed roles assignment will be ignored."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": "Roles were assigned to organization users successfully."
|
|
||||||
},
|
|
||||||
"422": {
|
|
||||||
"description": "At least one of the IDs provided is not valid. For example, the organization ID, user ID, or organization role ID does not exist; the user is not a member of the organization."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/organizations/{id}/users/{userId}/roles": {
|
|
||||||
"get": {
|
|
||||||
"summary": "Get roles for a user in an organization",
|
|
||||||
"description": "Get roles assigned to a user in the specified organization with pagination.",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "A list of roles assigned to the user."
|
|
||||||
},
|
|
||||||
"422": {
|
|
||||||
"description": "The user is not a member of the organization."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"put": {
|
|
||||||
"summary": "Update roles for a user in an organization",
|
|
||||||
"description": "Update roles assigned to a user in the specified organization with the provided data.",
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"properties": {
|
|
||||||
"organizationRoleIds": {
|
|
||||||
"description": "An array of organization role IDs to update for the user."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"204": {
|
|
||||||
"description": "Roles were updated for the user successfully."
|
|
||||||
},
|
|
||||||
"422": {
|
|
||||||
"description": "The user is not a member of the organization; or at least one of the IDs provided is not valid. For example, the organization ID or organization role ID does not exist."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"post": {
|
|
||||||
"summary": "Assign roles to a user in an organization",
|
|
||||||
"description": "Assign roles to a user in the specified organization with the provided data.",
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"properties": {
|
|
||||||
"organizationRoleIds": {
|
|
||||||
"description": "An array of organization role IDs to assign to the user. User existed roles assignment will be ignored."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": "Roles were assigned to the user successfully."
|
|
||||||
},
|
|
||||||
"422": {
|
|
||||||
"description": "The user is not a member of the organization; or at least one of the IDs provided is not valid. For example, the organization ID or organization role ID does not exist."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/organizations/{id}/users/{userId}/roles/{roleId}": {
|
|
||||||
"delete": {
|
|
||||||
"summary": "Remove a role from a user in an organization",
|
|
||||||
"description": "Remove a role assignment from a user in the specified organization.",
|
|
||||||
"responses": {
|
|
||||||
"204": {
|
|
||||||
"description": "The role was removed from the user successfully."
|
|
||||||
},
|
|
||||||
"404": {
|
|
||||||
"description": "The user is not a member of the organization; or the user does not have the role."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/organizations/{id}/users/{userId}/scopes": {
|
|
||||||
"get": {
|
|
||||||
"summary": "Get scopes for a user in an organization tailored by the organization roles",
|
|
||||||
"description": "Get scopes assigned to a user in the specified organization tailored by the organization roles. The scopes are derived from the organization roles assigned to the user.",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "A list of scopes assigned to the user."
|
|
||||||
},
|
|
||||||
"422": {
|
|
||||||
"description": "The user is not a member of the organization."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
214
packages/core/src/routes/organization/index.users.openapi.json
Normal file
214
packages/core/src/routes/organization/index.users.openapi.json
Normal file
|
@ -0,0 +1,214 @@
|
||||||
|
{
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"name": "Organization users",
|
||||||
|
"description": "Manage organization - user relationships. A user can be a member of one or more organizations in order to get access to the organization resources.\n\nUsers can be assigned roles in organizations to grant them permissions to perform certain actions in the organization."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/api/organizations/{id}/users": {
|
||||||
|
"post": {
|
||||||
|
"summary": "Add user members to organization",
|
||||||
|
"description": "Add users as members to the specified organization with the given user IDs.",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"properties": {
|
||||||
|
"userIds": {
|
||||||
|
"description": "An array of user IDs to be added to the organization. Organization existed users assignment will be ignored."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Users were added to the organization successfully."
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "At least one of the IDs provided is not valid. For example, the organization ID or user ID does not exist."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"summary": "Replace organization user members",
|
||||||
|
"description": "Replace all user members for the specified organization with the given users. This effectively removing all existing user memberships in the organization and adding the new users as members.",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"properties": {
|
||||||
|
"userIds": {
|
||||||
|
"description": "An array of user IDs to replace existing users."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "Successfully replaced all users for the organization."
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "At least one of the IDs provided is not valid. For example, the organization ID or user ID does not exist."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"get": {
|
||||||
|
"summary": "Get organization user members",
|
||||||
|
"description": "Get users that are members of the specified organization for the given query with pagination.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "q",
|
||||||
|
"in": "query",
|
||||||
|
"description": "The query to filter users. It will match multiple fields of users, including ID, name, username, email, and phone number.\n\nIf not provided, all users will be returned."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A list of users that are members of the organization."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/organizations/{id}/users/{userId}": {
|
||||||
|
"delete": {
|
||||||
|
"summary": "Remove user member from organization",
|
||||||
|
"description": "Remove a user's membership from the specified organization.",
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "The user was removed from the organization members successfully."
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "The user is not a member of the organization."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/organizations/{id}/users/roles": {
|
||||||
|
"post": {
|
||||||
|
"summary": "Assign roles to organization user members",
|
||||||
|
"description": "Assign roles to user members of the specified organization with the given data.",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"properties": {
|
||||||
|
"userIds": {
|
||||||
|
"description": "An array of user IDs to assign roles."
|
||||||
|
},
|
||||||
|
"organizationRoleIds": {
|
||||||
|
"description": "An array of organization role IDs to assign. User existed roles assignment will be ignored."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Roles were assigned to organization users successfully."
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "At least one of the IDs provided is not valid. For example, the organization ID, user ID, or organization role ID does not exist; the user is not a member of the organization."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/organizations/{id}/users/{userId}/roles": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Get roles for a user in an organization",
|
||||||
|
"description": "Get roles assigned to a user in the specified organization with pagination.",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A list of roles assigned to the user."
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "The user is not a member of the organization."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"summary": "Update roles for a user in an organization",
|
||||||
|
"description": "Update roles assigned to a user in the specified organization with the provided data.",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"properties": {
|
||||||
|
"organizationRoleIds": {
|
||||||
|
"description": "An array of organization role IDs to update for the user."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "Roles were updated for the user successfully."
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "The user is not a member of the organization; or at least one of the IDs provided is not valid. For example, the organization ID or organization role ID does not exist."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"summary": "Assign roles to a user in an organization",
|
||||||
|
"description": "Assign roles to a user in the specified organization with the provided data.",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"properties": {
|
||||||
|
"organizationRoleIds": {
|
||||||
|
"description": "An array of organization role IDs to assign to the user. User existed roles assignment will be ignored."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "Roles were assigned to the user successfully."
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "The user is not a member of the organization; or at least one of the IDs provided is not valid. For example, the organization ID or organization role ID does not exist."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/organizations/{id}/users/{userId}/roles/{roleId}": {
|
||||||
|
"delete": {
|
||||||
|
"summary": "Remove a role from a user in an organization",
|
||||||
|
"description": "Remove a role assignment from a user in the specified organization.",
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "The role was removed from the user successfully."
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "The user is not a member of the organization; or the user does not have the role."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/organizations/{id}/users/{userId}/scopes": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Get scopes for a user in an organization tailored by the organization roles",
|
||||||
|
"description": "Get scopes assigned to a user in the specified organization tailored by the organization roles. The scopes are derived from the organization roles assigned to the user.",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A list of scopes assigned to the user."
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "The user is not a member of the organization."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -134,7 +134,7 @@ const identifiableEntityNames = Object.freeze([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/** Additional tags that cannot be inferred from the path. */
|
/** Additional tags that cannot be inferred from the path. */
|
||||||
const additionalTags = Object.freeze(['Organization applications']);
|
const additionalTags = Object.freeze(['Organization applications', 'Organization users']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach the `/swagger.json` route which returns the generated OpenAPI document for the
|
* Attach the `/swagger.json` route which returns the generated OpenAPI document for the
|
||||||
|
|
Loading…
Reference in a new issue