answer_private

package module
v0.0.0-...-5d6c031 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

Answer Privacy Plugin

This plugin filters Answer API responses so users only see answers they created. It inspects the answer detail and answer list API responses and removes any answers whose user_info.id does not match the current authenticated user.

Behavior

  • GET /answer/api/v1/answer/info
    • Returns the answer only when the requesting user is the answer author or the question author.
    • Otherwise responds with 403 and an empty data payload.
  • GET /answer/api/v1/answer/page
    • Filters the response list to contain only answers created by the current user or answers attached to the current user's questions.

Configuration

Enable or disable the plugin from the Answer plugin settings. The default is enabled.

Important Notes

This plugin registers middleware on authenticated routes. If your Answer deployment exposes answer routes to unauthenticated users, you should require login for answer APIs or move these routes into authenticated groups in your Answer build so the middleware can run.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Info embed.FS

Functions

This section is empty.

Types

type AnswerPrivate

type AnswerPrivate struct {
	Config *Config
}

func (*AnswerPrivate) ConfigFields

func (a *AnswerPrivate) ConfigFields() []plugin.ConfigField

func (*AnswerPrivate) ConfigReceiver

func (a *AnswerPrivate) ConfigReceiver(config []byte) error

func (*AnswerPrivate) Info

func (a *AnswerPrivate) Info() plugin.Info

func (*AnswerPrivate) RegisterAuthAdminRouter

func (a *AnswerPrivate) RegisterAuthAdminRouter(*gin.RouterGroup)

func (*AnswerPrivate) RegisterAuthUserRouter

func (a *AnswerPrivate) RegisterAuthUserRouter(r *gin.RouterGroup)

func (*AnswerPrivate) RegisterUnAuthRouter

func (a *AnswerPrivate) RegisterUnAuthRouter(*gin.RouterGroup)

type Config

type Config struct {
	Enabled bool `json:"enabled"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL