web

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddGroupingPolicyReq

type AddGroupingPolicyReq struct {
	UserId   string `json:"user_id"`
	RoleCode string `json:"role_code"`
}

type AuthorizeReq

type AuthorizeReq struct {
	UserId   string `json:"user_id"`
	Path     string `json:"path"`
	Method   string `json:"method"`
	Resource string `json:"resource"`
}

type Effect

type Effect string
const (
	// ALLOW 同意
	ALLOW Effect = "allow"
	// DENY 拒绝
	DENY Effect = "deny"
)

type GetPermissionsForRoleReq

type GetPermissionsForRoleReq struct {
	RoleCode string `json:"role_code"`
}

type GetPermissionsForUserReq

type GetPermissionsForUserReq struct {
	UserId int64 `json:"user_id"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(svc service.Service) *Handler

func (*Handler) AddGroupingPolicy

func (h *Handler) AddGroupingPolicy(ctx *gin.Context, req AddGroupingPolicyReq) (ginx.Result, error)

func (*Handler) AddPolicies

func (h *Handler) AddPolicies(ctx *gin.Context, req PolicyReq) (ginx.Result, error)

func (*Handler) Authorize

func (h *Handler) Authorize(ctx *gin.Context, req AuthorizeReq) (ginx.Result, error)

func (*Handler) GetImplicitPermissionsForUser

func (h *Handler) GetImplicitPermissionsForUser(ctx *gin.Context, req GetPermissionsForUserReq) (ginx.Result, error)

func (*Handler) GetPermissionsForRole

func (h *Handler) GetPermissionsForRole(ctx *gin.Context, req GetPermissionsForRoleReq) (ginx.Result, error)

func (*Handler) PrivateRoutes

func (h *Handler) PrivateRoutes(server *gin.Engine)

func (*Handler) UpdatePolicies

func (h *Handler) UpdatePolicies(ctx *gin.Context, req PolicyReq) (ginx.Result, error)

type Policy

type Policy struct {
	Path   string `json:"path"`
	Method string `json:"method"`
	Effect Effect `json:"effect"`
}

type PolicyReq

type PolicyReq struct {
	RoleCode string   `json:"role_code"`
	Policies []Policy `json:"policies"`
}

type RetrievePolicies

type RetrievePolicies struct {
	Policies []Policy `json:"policies"`
}

Jump to

Keyboard shortcuts

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