fully implement acl backend and interface

This commit is contained in:
2025-12-21 22:18:29 +02:00
parent 85f8ac60e7
commit e9d8877fbf
15 changed files with 1567 additions and 166 deletions

View File

@@ -10,7 +10,7 @@
"application/json"
],
"tags": [
"resources"
"acl/resources"
],
"summary": "Get all resources",
"responses": {
@@ -52,7 +52,7 @@
"application/json"
],
"tags": [
"resources"
"acl/resources"
],
"summary": "Create resource",
"parameters": [
@@ -100,7 +100,7 @@
"application/json"
],
"tags": [
"resources"
"acl/resources"
],
"summary": "Get resource by ID",
"parameters": [
@@ -145,7 +145,7 @@
"application/json"
],
"tags": [
"resources"
"acl/resources"
],
"summary": "Delete resource",
"parameters": [
@@ -196,7 +196,7 @@
"application/json"
],
"tags": [
"resources"
"acl/resources"
],
"summary": "Update resource",
"parameters": [
@@ -258,7 +258,7 @@
"application/json"
],
"tags": [
"roles"
"acl/roles"
],
"summary": "Get all roles",
"responses": {
@@ -300,7 +300,7 @@
"application/json"
],
"tags": [
"roles"
"acl/roles"
],
"summary": "Create role",
"parameters": [
@@ -348,7 +348,7 @@
"application/json"
],
"tags": [
"roles"
"acl/roles"
],
"summary": "Get role by ID",
"parameters": [
@@ -393,7 +393,7 @@
"application/json"
],
"tags": [
"roles"
"acl/roles"
],
"summary": "Delete role",
"parameters": [
@@ -407,8 +407,8 @@
}
],
"responses": {
"200": {
"description": "OK"
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
@@ -444,7 +444,7 @@
"application/json"
],
"tags": [
"roles"
"acl/roles"
],
"summary": "Update role",
"parameters": [
@@ -500,13 +500,175 @@
}
}
},
"/api/acl/roles/{roleId}/resources": {
"get": {
"produces": [
"application/json"
],
"tags": [
"acl/roles"
],
"summary": "Get role resources",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Role ID",
"name": "roleId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/api_acladmin.getRoleResource"
}
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"acl/roles"
],
"summary": "Assign resource to role",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Role ID",
"name": "roleId",
"in": "path",
"required": true
},
{
"description": "Resource",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_acladmin.assignResourceToRoleRequest"
}
}
],
"responses": {
"201": {
"description": "Created"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
}
},
"/api/acl/roles/{roleId}/resources/{resId}": {
"delete": {
"produces": [
"application/json"
],
"tags": [
"acl/roles"
],
"summary": "Remove resource from role",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Role ID",
"name": "roleId",
"in": "path",
"required": true
},
{
"type": "integer",
"example": 1,
"description": "Resource ID",
"name": "resId",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
}
},
"/api/acl/roles/{roleId}/users": {
"get": {
"produces": [
"application/json"
],
"tags": [
"roles"
"acl/roles"
],
"summary": "Get role users",
"parameters": [
@@ -552,6 +714,165 @@
}
}
}
},
"/api/acl/users/{userId}/roles": {
"get": {
"produces": [
"application/json"
],
"tags": [
"acl/users"
],
"summary": "Get user roles by user ID",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "User ID",
"name": "userId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api_acladmin.getUserRole"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"acl/users"
],
"summary": "Assign role to user",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "User ID",
"name": "userId",
"in": "path",
"required": true
},
{
"description": "Role ID",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_acladmin.assignRoleToUserRequest"
}
}
],
"responses": {
"201": {
"description": "Created"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
}
},
"/api/acl/users/{userId}/roles/{roleId}": {
"delete": {
"produces": [
"application/json"
],
"tags": [
"acl/users"
],
"summary": "Remove role from user",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "User ID",
"name": "userId",
"in": "path",
"required": true
},
{
"type": "integer",
"example": 1,
"description": "Role ID",
"name": "roleId",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
}
}
},
"definitions": {
@@ -580,6 +901,24 @@
}
}
},
"api_acladmin.assignResourceToRoleRequest": {
"type": "object",
"properties": {
"resourceId": {
"type": "integer",
"example": 1
}
}
},
"api_acladmin.assignRoleToUserRequest": {
"type": "object",
"properties": {
"roleId": {
"type": "integer",
"example": 1
}
}
},
"api_acladmin.createResourceRequest": {
"type": "object",
"properties": {
@@ -637,6 +976,19 @@
}
}
},
"api_acladmin.getRoleResource": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "*"
}
}
},
"api_acladmin.getRoleResponse": {
"type": "object",
"properties": {
@@ -653,20 +1005,33 @@
"api_acladmin.getRoleUser": {
"type": "object",
"properties": {
"userEmail": {
"email": {
"type": "string",
"example": "admin@triggerssmith.com"
},
"userId": {
"id": {
"type": "integer",
"example": 1
},
"userName": {
"username": {
"type": "string",
"example": "admin"
}
}
},
"api_acladmin.getUserRole": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "*"
}
}
},
"api_acladmin.updateResourceRequest": {
"type": "object",
"properties": {