fully implement acl backend and interface
This commit is contained in:
397
docs/docs.go
397
docs/docs.go
@@ -21,7 +21,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"resources"
|
||||
"acl/resources"
|
||||
],
|
||||
"summary": "Get all resources",
|
||||
"responses": {
|
||||
@@ -63,7 +63,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"resources"
|
||||
"acl/resources"
|
||||
],
|
||||
"summary": "Create resource",
|
||||
"parameters": [
|
||||
@@ -111,7 +111,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"resources"
|
||||
"acl/resources"
|
||||
],
|
||||
"summary": "Get resource by ID",
|
||||
"parameters": [
|
||||
@@ -156,7 +156,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"resources"
|
||||
"acl/resources"
|
||||
],
|
||||
"summary": "Delete resource",
|
||||
"parameters": [
|
||||
@@ -207,7 +207,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"resources"
|
||||
"acl/resources"
|
||||
],
|
||||
"summary": "Update resource",
|
||||
"parameters": [
|
||||
@@ -269,7 +269,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"roles"
|
||||
"acl/roles"
|
||||
],
|
||||
"summary": "Get all roles",
|
||||
"responses": {
|
||||
@@ -311,7 +311,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"roles"
|
||||
"acl/roles"
|
||||
],
|
||||
"summary": "Create role",
|
||||
"parameters": [
|
||||
@@ -359,7 +359,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"roles"
|
||||
"acl/roles"
|
||||
],
|
||||
"summary": "Get role by ID",
|
||||
"parameters": [
|
||||
@@ -404,7 +404,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"roles"
|
||||
"acl/roles"
|
||||
],
|
||||
"summary": "Delete role",
|
||||
"parameters": [
|
||||
@@ -418,8 +418,8 @@ const docTemplate = `{
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
@@ -455,7 +455,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"roles"
|
||||
"acl/roles"
|
||||
],
|
||||
"summary": "Update role",
|
||||
"parameters": [
|
||||
@@ -511,13 +511,175 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/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": [
|
||||
@@ -563,6 +725,165 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/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": {
|
||||
@@ -591,6 +912,24 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
@@ -648,6 +987,19 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"api_acladmin.getRoleResource": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
"api_acladmin.getRoleResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -664,20 +1016,33 @@ const docTemplate = `{
|
||||
"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": {
|
||||
|
||||
Reference in New Issue
Block a user