middleware

package
v3.0.7-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BK_CC_EVENT    string = "event"
	BK_CC_MODEL    string = "model"
	BK_CC_AUDIT    string = "audit"
	BK_CC_RESOURCE string = "resource"
)
View Source
const (
	BK_CC_UPDATE     string = "update"
	BK_CC_DELETE     string = "delete"
	BK_CC_CREATE     string = "create"
	BK_CC_SEARCH     string = "search"
	BK_CC_HOSTUPDATE string = "hostupdate"
	BK_CC_HOSTTRANS  string = "hosttrans"
	BK_CC_TOPOUPDATE string = "topoupdate"
	BK_CC_CUSTOMAPI  string = "customapi"
	BK_CC_PROCCONFIG string = "proconfig"
)
View Source
const (
	BK_APP_SEARCH    = "biz/search"
	BK_SET_SEARCH    = "set/search"
	BK_MODULE_SEARCH = "module/search"
	BK_INST_SEARCH   = "inst/search"
	BK_HOSTS_SEARCH  = "hosts/search"
	BK_HOSTS_SNAP    = "hosts/snapshot"
	BK_HOSTS_HIS     = "hosts/history"
	BK_TOPO_MODEL    = "topo/model"
)

bk search

View Source
const (
	BK_INSTS  string = "inst"
	BK_TOPO   string = "topo"
	BK_SET    string = "set"
	BK_MODULE string = "module"
)

bk topo

View Source
const BK_CC_CLASSIFIC string = "object/classifications"
View Source
const BK_CC_HOST_FAVORITES string = "favorites"
View Source
const BK_CC_MAINTAINERS string = "bk_biz_maintainer"
View Source
const BK_CC_OBJECT_ATTR string = "object/attr/search"
View Source
const BK_CC_PRIVI_PATTERN string = "topo/privilege/user/detail"
View Source
const BK_CC_USER_CUSTOM string = "usercustom"
View Source
const BK_HOST_TRANS = "hosts/modules"

host trans pattern

View Source
const BK_HOST_UPDATE string = "hosts/batch"

host update string

View Source
const BK_OBJECT_ATT_GROUP = "objectatt/group/property/owner"
View Source
const BK_PROC_S string = "proc"

proc manage pattern

View Source
const BK_USER_API_S string = "userapi"

user api pattern

Variables

View Source
var APIAddr func() string
View Source
var BK_CC_AUDIT_PRE = []string{"audit"}
View Source
var BK_CC_EVENT_PRE = []string{"event"}
View Source
var BK_CC_MODEL_PRE = []string{"object", "objects"}
View Source
var BK_CC_SYSCONFIG = []string{"event", "model", "audit"}

Functions

func Cors

func Cors() gin.HandlerFunc

func ValidLogin

func ValidLogin(params ...string) gin.HandlerFunc

ValidLogin valid the user login status

func ValidPrivilege

func ValidPrivilege() gin.HandlerFunc

func ValidResAccess

func ValidResAccess(pathArr []string, c *gin.Context) bool

ValidResAccess valid resource access privilege

Types

type AppResult

type AppResult struct {
	Count int                      `json:"count"`
	Info  []map[string]interface{} `json:"info"`
}

type LoginResult

type LoginResult struct {
	Message string
	Code    string
	Result  bool
	Data    interface{}
}

type Privilege

type Privilege struct {
	UserName string
	APIAddr  string
	OwnerID  string
	// contains filtered or unexported fields
}

func NewPrivilege

func NewPrivilege(userName, APIAddr, ownerID, language string) (*Privilege, error)

func (*Privilege) GetAppRole

func (p *Privilege) GetAppRole() []string

GetAppRole get app role

func (*Privilege) GetRolePrivilege

func (p *Privilege) GetRolePrivilege(objID string, role string) []string

GetRolePrivilege get role privilege

func (*Privilege) GetUserPrivilegeApp

func (p *Privilege) GetUserPrivilegeApp(appRole []string) map[int64][]string

GetUserPrivilegeApp get user privilege app

func (*Privilege) GetUserPrivilegeConfig

func (p *Privilege) GetUserPrivilegeConfig() (map[string][]string, []string)

GetUserPrivilegeConfig get user privilege config

type RoleAppResult

type RoleAppResult struct {
	Result  bool                     `json:"result"`
	Code    int                      `json:"bk_error_code"`
	Message interface{}              `json:"bk_error_msg"`
	Data    []map[string]interface{} `json:"data"`
}

type RolePriResult

type RolePriResult struct {
	Result  bool        `json:"result"`
	Code    int         `json:"bk_error_code"`
	Message interface{} `json:"bk_error_msg"`
	Data    []string    `json:"data"`
}

type SearchAppResult

type SearchAppResult struct {
	Result  bool        `json:"result"`
	Code    int         `json:"bk_error_code"`
	Message interface{} `json:"bk_error_msg"`
	Data    AppResult   `json:"data"`
}

Jump to

Keyboard shortcuts

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