Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

update custom_sidebar

aichy126910484013c60
diff --git a/docs/docs.go b/docs/docs.go
index 616e5c28..dc3e84eb 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -662,6 +662,77 @@ const docTemplate = `{
}
}
},
+ "/answer/admin/api/setting/privileges": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "GetPrivilegesConfig get privileges config",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "GetPrivilegesConfig get privileges config",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetPrivilegesConfigResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update privileges config",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update privileges config",
+ "parameters": [
+ {
+ "description": "config",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdatePrivilegesConfigReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
"/answer/admin/api/setting/smtp": {
"get": {
"security": [
@@ -5780,6 +5851,17 @@ const docTemplate = `{
}
},
"definitions": {
+ "constant.Privilege": {
+ "type": "object",
+ "properties": {
+ "label": {
+ "type": "string"
+ },
+ "value": {
+ "type": "integer"
+ }
+ }
+ },
"handler.RespBody": {
"type": "object",
"properties": {
@@ -6681,6 +6763,20 @@ const docTemplate = `{
}
}
},
+ "schema.GetPrivilegesConfigResp": {
+ "type": "object",
+ "properties": {
+ "options": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.PrivilegeOption"
+ }
+ },
+ "selected_level": {
+ "type": "integer"
+ }
+ }
+ },
"schema.GetRankPersonalWithPageResp": {
"type": "object",
"properties": {
@@ -7368,6 +7464,20 @@ const docTemplate = `{
}
}
},
+ "schema.PrivilegeOption": {
+ "type": "object",
+ "properties": {
+ "level": {
+ "type": "integer"
+ },
+ "privileges": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/constant.Privilege"
+ }
+ }
+ }
+ },
"schema.QuestionAdd": {
"type": "object",
"required": [
@@ -7809,6 +7919,10 @@ const docTemplate = `{
"custom_header": {
"type": "string",
"maxLength": 65536
+ },
+ "custom_sidebar": {
+ "type": "string",
+ "maxLength": 65536
}
}
},
@@ -7830,6 +7944,10 @@ const docTemplate = `{
"custom_header": {
"type": "string",
"maxLength": 65536
+ },
+ "custom_sidebar": {
+ "type": "string",
+ "maxLength": 65536
}
}
},
@@ -8420,6 +8538,19 @@ const docTemplate = `{
}
}
},
+ "schema.UpdatePrivilegesConfigReq": {
+ "type": "object",
+ "required": [
+ "level"
+ ],
+ "properties": {
+ "level": {
+ "type": "integer",
+ "maximum": 3,
+ "minimum": 1
+ }
+ }
+ },
"schema.UpdateSMTPConfigReq": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index d015d8c2..e5bb8b3c 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -650,6 +650,77 @@
}
}
},
+ "/answer/admin/api/setting/privileges": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "GetPrivilegesConfig get privileges config",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "GetPrivilegesConfig get privileges config",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetPrivilegesConfigResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update privileges config",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update privileges config",
+ "parameters": [
+ {
+ "description": "config",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdatePrivilegesConfigReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
"/answer/admin/api/setting/smtp": {
"get": {
"security": [
@@ -5768,6 +5839,17 @@
}
},
"definitions": {
+ "constant.Privilege": {
+ "type": "object",
+ "properties": {
+ "label": {
+ "type": "string"
+ },
+ "value": {
+ "type": "integer"
+ }
+ }
+ },
"handler.RespBody": {
"type": "object",
"properties": {
@@ -6669,6 +6751,20 @@
}
}
},
+ "schema.GetPrivilegesConfigResp": {
+ "type": "object",
+ "properties": {
+ "options": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.PrivilegeOption"
+ }
+ },
+ "selected_level": {
+ "type": "integer"
+ }
+ }
+ },
"schema.GetRankPersonalWithPageResp": {
"type": "object",
"properties": {
@@ -7356,6 +7452,20 @@
}
}
},
+ "schema.PrivilegeOption": {
+ "type": "object",
+ "properties": {
+ "level": {
+ "type": "integer"
+ },
+ "privileges": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/constant.Privilege"
+ }
+ }
+ }
+ },
"schema.QuestionAdd": {
"type": "object",
"required": [
@@ -7797,6 +7907,10 @@
"custom_header": {
"type": "string",
"maxLength": 65536
+ },
+ "custom_sidebar": {
+ "type": "string",
+ "maxLength": 65536
}
}
},
@@ -7818,6 +7932,10 @@
"custom_header": {
"type": "string",
"maxLength": 65536
+ },
+ "custom_sidebar": {
+ "type": "string",
+ "maxLength": 65536
}
}
},
@@ -8408,6 +8526,19 @@
}
}
},
+ "schema.UpdatePrivilegesConfigReq": {
+ "type": "object",
+ "required": [
+ "level"
+ ],
+ "properties": {
+ "level": {
+ "type": "integer",
+ "maximum": 3,
+ "minimum": 1
+ }
+ }
+ },
"schema.UpdateSMTPConfigReq": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 7010d1f3..2f0c90e3 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1,4 +1,11 @@
definitions:
+ constant.Privilege:
+ properties:
+ label:
+ type: string
+ value:
+ type: integer
+ type: object
handler.RespBody:
properties:
code:
@@ -631,6 +638,15 @@ definitions:
version:
type: string
type: object
+ schema.GetPrivilegesConfigResp:
+ properties:
+ options:
+ items:
+ $ref: '#/definitions/schema.PrivilegeOption'
+ type: array
+ selected_level:
+ type: integer
+ type: object
schema.GetRankPersonalWithPageResp:
properties:
answer_id:
@@ -1126,6 +1142,15 @@ definitions:
content:
type: string
type: object
+ schema.PrivilegeOption:
+ properties:
+ level:
+ type: integer
+ privileges:
+ items:
+ $ref: '#/definitions/constant.Privilege'
+ type: array
+ type: object
schema.QuestionAdd:
properties:
content:
@@ -1438,6 +1463,9 @@ definitions:
custom_header:
maxLength: 65536
type: string
+ custom_sidebar:
+ maxLength: 65536
+ type: string
type: object
schema.SiteCustomCssHTMLResp:
properties:
@@ -1453,6 +1481,9 @@ definitions:
custom_header:
maxLength: 65536
type: string
+ custom_sidebar:
+ maxLength: 65536
+ type: string
type: object
schema.SiteGeneralReq:
properties:
@@ -1860,6 +1891,15 @@ definitions:
required:
- plugin_slug_name
type: object
+ schema.UpdatePrivilegesConfigReq:
+ properties:
+ level:
+ maximum: 3
+ minimum: 1
+ type: integer
+ required:
+ - level
+ type: object
schema.UpdateSMTPConfigReq:
properties:
encryption:
@@ -2596,6 +2636,47 @@ paths:
summary: get role list
tags:
- admin
+ /answer/admin/api/setting/privileges:
+ get:
+ description: GetPrivilegesConfig get privileges config
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.GetPrivilegesConfigResp'
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: GetPrivilegesConfig get privileges config
+ tags:
+ - admin
+ put:
+ description: update privileges config
+ parameters:
+ - description: config
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.UpdatePrivilegesConfigReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: update privileges config
+ tags:
+ - admin
/answer/admin/api/setting/smtp:
get:
description: GetSMTPConfig get smtp config
diff --git a/internal/schema/siteinfo_schema.go b/internal/schema/siteinfo_schema.go
index 276be1df..a0167de4 100644
--- a/internal/schema/siteinfo_schema.go
+++ b/internal/schema/siteinfo_schema.go
@@ -114,10 +114,11 @@ type SiteLoginReq struct {
// SiteCustomCssHTMLReq site custom css html
type SiteCustomCssHTMLReq struct {
- CustomHead string `validate:"omitempty,gt=0,lte=65536" json:"custom_head"`
- CustomCss string `validate:"omitempty,gt=0,lte=65536" json:"custom_css"`
- CustomHeader string `validate:"omitempty,gt=0,lte=65536" json:"custom_header"`
- CustomFooter string `validate:"omitempty,gt=0,lte=65536" json:"custom_footer"`
+ CustomHead string `validate:"omitempty,gt=0,lte=65536" json:"custom_head"`
+ CustomCss string `validate:"omitempty,gt=0,lte=65536" json:"custom_css"`
+ CustomHeader string `validate:"omitempty,gt=0,lte=65536" json:"custom_header"`
+ CustomFooter string `validate:"omitempty,gt=0,lte=65536" json:"custom_footer"`
+ CustomSideBar string `validate:"omitempty,gt=0,lte=65536" json:"custom_sidebar"`
}
// SiteThemeReq site theme config