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": {
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -17,6 +17,18 @@ definitions:
|
||||
example: https://api.triggerssmith.com/errors/role-not-found
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.assignResourceToRoleRequest:
|
||||
properties:
|
||||
resourceId:
|
||||
example: 1
|
||||
type: integer
|
||||
type: object
|
||||
api_acladmin.assignRoleToUserRequest:
|
||||
properties:
|
||||
roleId:
|
||||
example: 1
|
||||
type: integer
|
||||
type: object
|
||||
api_acladmin.createResourceRequest:
|
||||
properties:
|
||||
key:
|
||||
@@ -56,6 +68,15 @@ definitions:
|
||||
example: html.view
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.getRoleResource:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
name:
|
||||
example: '*'
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.getRoleResponse:
|
||||
properties:
|
||||
id:
|
||||
@@ -67,16 +88,25 @@ definitions:
|
||||
type: object
|
||||
api_acladmin.getRoleUser:
|
||||
properties:
|
||||
userEmail:
|
||||
email:
|
||||
example: admin@triggerssmith.com
|
||||
type: string
|
||||
userId:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
userName:
|
||||
username:
|
||||
example: admin
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.getUserRole:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
name:
|
||||
example: '*'
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateResourceRequest:
|
||||
properties:
|
||||
key:
|
||||
@@ -136,7 +166,7 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Get all resources
|
||||
tags:
|
||||
- resources
|
||||
- acl/resources
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -168,7 +198,7 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Create resource
|
||||
tags:
|
||||
- resources
|
||||
- acl/resources
|
||||
/api/acl/resources/{resourceId}:
|
||||
delete:
|
||||
parameters:
|
||||
@@ -201,7 +231,7 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Delete resource
|
||||
tags:
|
||||
- resources
|
||||
- acl/resources
|
||||
get:
|
||||
parameters:
|
||||
- description: Resource ID
|
||||
@@ -231,7 +261,7 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Get resource by ID
|
||||
tags:
|
||||
- resources
|
||||
- acl/resources
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -273,7 +303,7 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Update resource
|
||||
tags:
|
||||
- resources
|
||||
- acl/resources
|
||||
/api/acl/roles:
|
||||
get:
|
||||
produces:
|
||||
@@ -300,7 +330,7 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Get all roles
|
||||
tags:
|
||||
- roles
|
||||
- acl/roles
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -332,7 +362,7 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Create role
|
||||
tags:
|
||||
- roles
|
||||
- acl/roles
|
||||
/api/acl/roles/{roleId}:
|
||||
delete:
|
||||
parameters:
|
||||
@@ -345,8 +375,8 @@ paths:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
"204":
|
||||
description: No Content
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
@@ -365,7 +395,7 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Delete role
|
||||
tags:
|
||||
- roles
|
||||
- acl/roles
|
||||
get:
|
||||
parameters:
|
||||
- description: Role ID
|
||||
@@ -395,7 +425,7 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Get role by ID
|
||||
tags:
|
||||
- roles
|
||||
- acl/roles
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -437,7 +467,115 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Update role
|
||||
tags:
|
||||
- roles
|
||||
- acl/roles
|
||||
/api/acl/roles/{roleId}/resources:
|
||||
get:
|
||||
parameters:
|
||||
- description: Role ID
|
||||
example: 1
|
||||
in: path
|
||||
name: roleId
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
items:
|
||||
$ref: '#/definitions/api_acladmin.getRoleResource'
|
||||
type: array
|
||||
type: array
|
||||
"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'
|
||||
summary: Get role resources
|
||||
tags:
|
||||
- acl/roles
|
||||
post:
|
||||
parameters:
|
||||
- description: Role ID
|
||||
example: 1
|
||||
in: path
|
||||
name: roleId
|
||||
required: true
|
||||
type: integer
|
||||
- description: Resource
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.assignResourceToRoleRequest'
|
||||
produces:
|
||||
- application/json
|
||||
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'
|
||||
summary: Assign resource to role
|
||||
tags:
|
||||
- acl/roles
|
||||
/api/acl/roles/{roleId}/resources/{resId}:
|
||||
delete:
|
||||
parameters:
|
||||
- description: Role ID
|
||||
example: 1
|
||||
in: path
|
||||
name: roleId
|
||||
required: true
|
||||
type: integer
|
||||
- description: Resource ID
|
||||
example: 1
|
||||
in: path
|
||||
name: resId
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
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'
|
||||
summary: Remove resource from role
|
||||
tags:
|
||||
- acl/roles
|
||||
/api/acl/roles/{roleId}/users:
|
||||
get:
|
||||
parameters:
|
||||
@@ -472,5 +610,111 @@ paths:
|
||||
$ref: '#/definitions/api_acladmin.ProblemDetails'
|
||||
summary: Get role users
|
||||
tags:
|
||||
- roles
|
||||
- acl/roles
|
||||
/api/acl/users/{userId}/roles:
|
||||
get:
|
||||
parameters:
|
||||
- description: User ID
|
||||
example: 1
|
||||
in: path
|
||||
name: userId
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/api_acladmin.getUserRole'
|
||||
type: array
|
||||
"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'
|
||||
summary: Get user roles by user ID
|
||||
tags:
|
||||
- acl/users
|
||||
post:
|
||||
parameters:
|
||||
- description: User ID
|
||||
example: 1
|
||||
in: path
|
||||
name: userId
|
||||
required: true
|
||||
type: integer
|
||||
- description: Role ID
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.assignRoleToUserRequest'
|
||||
produces:
|
||||
- application/json
|
||||
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'
|
||||
summary: Assign role to user
|
||||
tags:
|
||||
- acl/users
|
||||
/api/acl/users/{userId}/roles/{roleId}:
|
||||
delete:
|
||||
parameters:
|
||||
- description: User ID
|
||||
example: 1
|
||||
in: path
|
||||
name: userId
|
||||
required: true
|
||||
type: integer
|
||||
- description: Role ID
|
||||
example: 1
|
||||
in: path
|
||||
name: roleId
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
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'
|
||||
summary: Remove role from user
|
||||
tags:
|
||||
- acl/users
|
||||
swagger: "2.0"
|
||||
|
||||
Reference in New Issue
Block a user