{"openapi":"3.0.1","info":{"title":"Permission Service API","description":"This is the updated API documentation for the Permission Service.","contact":{"name":"Support Team","url":"https://example.com","email":"support@example.com"},"license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0"},"version":"1.0.0"},"servers":[{"url":"/","description":"API Gateway"}],"tags":[{"name":"Roles","description":"Operations related to role"},{"name":"Permissions","description":"Operations related to permissions"},{"name":"User Roles","description":"Operations related to user roles"},{"name":"Roles","description":"Operations related to roles"}],"paths":{"/api/v1/user-role/update-user-role":{"put":{"tags":["User Roles"],"summary":"Update user role","description":"Update a user's assigned role.","operationId":"updateUserRole","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRoleRequestBody"}}},"required":true},"responses":{"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"200":{"description":"User role updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/role/update/{id}":{"put":{"tags":["Roles"],"summary":"Update role data","description":"Update role based on the provided id, request body.","operationId":"updateRole","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleRequestBody"}}},"required":true},"responses":{"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"404":{"description":"Role not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"200":{"description":"Role updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"400":{"description":"Bad request - role name already exists, invalid role ID, or validation errors","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/role/status/change/{id}":{"put":{"tags":["Roles"],"summary":"Change role status","description":"Change role based on the provided id, request body.","operationId":"roleStatusChange","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"400":{"description":"Invalid role ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"404":{"description":"Role not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"200":{"description":"Role status changed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/permission/update/{id}":{"put":{"tags":["Permissions"],"summary":"Update permission data","description":"Update permission based on the provided id, request body.","operationId":"updatePermission","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionRequestBody"}}},"required":true},"responses":{"404":{"description":"Permission not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"200":{"description":"Permission updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"400":{"description":"Bad request - validation errors, invalid ID, or duplicate name","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/permission/status/change/{id}":{"put":{"tags":["Permissions"],"summary":"Change permission status","description":"Change old permission based on the provided id.","operationId":"permissionStatusChange","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Permission status change successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/user-role/assign-user-role":{"post":{"tags":["User Roles"],"summary":"Assign role to user","description":"Assign a role to a specific user.","operationId":"assignUserRole","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRoleRequestBody"}}},"required":true},"responses":{"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"201":{"description":"Role assigned to user successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/role/create":{"post":{"tags":["Roles"],"summary":"Create role","description":"Create role based on the provided request body.","operationId":"createRole","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleRequestBody"}}},"required":true},"responses":{"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"201":{"description":"Role created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"400":{"description":"Bad request - Role name already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/permission/create":{"post":{"tags":["Permissions"],"summary":"Create a new permission","description":"Creates a new permission based on the provided request body.","operationId":"createPermission","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionRequestBody"}}},"required":true},"responses":{"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"400":{"description":"Bad request - validation errors or duplicate name","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"201":{"description":"Permission created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/user-role/paginated":{"get":{"tags":["User Roles"],"summary":"Get user roles with pagination","description":"Get user roles with pagination support.","operationId":"getAllUserRolesPaginated","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":0}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":10}},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","default":"userId"}},{"name":"sortDir","in":"query","required":false,"schema":{"type":"string","default":"asc"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"roleId","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"User roles fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"400":{"description":"Invalid pagination parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/user-role/get-user-role-fast/{user_id}":{"get":{"tags":["User Roles"],"summary":"Get user role by user ID (Fast)","description":"Get user role data quickly without external service calls.","operationId":"getUserRoleByIdFast","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"200":{"description":"User role fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"404":{"description":"User role not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/user-role/get-user-role-by-user-id/{user_id}":{"get":{"tags":["User Roles"],"summary":"Get user role by user ID","description":"Get user role details for a specific user.","operationId":"getUserRoleById","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"200":{"description":"User role fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/role/{id}":{"get":{"tags":["Roles"],"summary":"Get role by id","description":"Get a specific role by its ID.","operationId":"getRoleById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Role fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"404":{"description":"Role not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/role/test":{"get":{"tags":["role-controller"],"operationId":"test","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/MyApiResponseObject"}}}}}}},"/api/v1/role/test-security":{"get":{"tags":["Roles"],"summary":"Test security configuration","description":"This endpoint tests if security is properly configured.","operationId":"testSecurity","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string"}}}}}}},"/api/v1/role/paginated":{"get":{"tags":["Roles"],"summary":"Get roles with pagination","description":"Get roles with pagination support.","operationId":"getAllRolesPaginated","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":0}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":10}},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","default":"name"}},{"name":"sortDir","in":"query","required":false,"schema":{"type":"string","default":"asc"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Roles fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"400":{"description":"Invalid pagination parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/role/details/{id}":{"get":{"tags":["Roles"],"summary":"Get role by id with details","description":"Get a specific role by its ID with detailed information including permissions and users.","operationId":"getRoleByIdWithDetails","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"200":{"description":"Role with details fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"404":{"description":"Role not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/role/all":{"get":{"tags":["Roles"],"summary":"Get all roles","description":"Get all roles.","operationId":"getAllRoles","responses":{"200":{"description":"Roles fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/role/active-order":{"get":{"tags":["Roles"],"summary":"Get all roles ordered by active status","description":"Get all roles with active roles first.","operationId":"getAllRolesByActiveStatus","responses":{"200":{"description":"Roles fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/permission/test":{"get":{"tags":["permission-controller"],"operationId":"testEndpoint","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}}}}},"/api/v1/permission/paginated":{"get":{"tags":["Permissions"],"summary":"Get permissions with pagination","description":"Get permissions with pagination support.","operationId":"getAllPermissionsPaginated","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":0}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":10}},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","default":"name"}},{"name":"sortDir","in":"query","required":false,"schema":{"type":"string","default":"asc"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Permissions fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"400":{"description":"Invalid pagination parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/permission/all":{"get":{"tags":["Permissions"],"summary":"Get all permissions","description":"Get all permissions.","operationId":"getAllPermissions","responses":{"200":{"description":"Permissions fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}},"/api/v1/permission/all/{status}":{"get":{"tags":["Permissions"],"summary":"Get all permissions by status","description":"Get all permission based on the provided status.","operationId":"getPermissionByStatus","parameters":[{"name":"status","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Permissions fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyApiResponse"}}}}}}}},"components":{"schemas":{"UserRoleRequestBody":{"required":["role_id","user_id"],"type":"object","properties":{"role_id":{"type":"string"},"user_id":{"type":"string"}}},"MyApiResponse":{"type":"object","properties":{"error":{"type":"boolean","description":"Error flag"},"statusCode":{"type":"integer","description":"HTTP status code","format":"int32"},"data":{"type":"object","description":"Response data"},"message":{"type":"string","description":"Response message"}}},"RoleRequestBody":{"required":["name","permissions"],"type":"object","properties":{"name":{"type":"string"},"permissions":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["ACTIVE","INACTIVE"]}}},"PermissionRequestBody":{"required":["description","name"],"type":"object","properties":{"name":{"type":"string"},"key":{"pattern":"^[A-Z_]+$","type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","INACTIVE"]},"create":{"type":"boolean"},"read":{"type":"boolean"},"update":{"type":"boolean"},"delete":{"type":"boolean"},"validPermission":{"type":"boolean"}}},"MyApiResponseObject":{"type":"object","properties":{"error":{"type":"boolean","description":"Error flag"},"statusCode":{"type":"integer","description":"HTTP status code","format":"int32"},"data":{"type":"object","description":"Response data"},"message":{"type":"string","description":"Response message"}}}}}}