middleware

package
v0.0.0-...-add256a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Casbin

func Casbin() iris.Handler

Casbin Casbin 权鉴中间件

func Check

func Check(tenantId consts.TenantId, r *http.Request, userId string) (bool, error)

Check checks the username, request's method and path and returns true if permission grandted otherwise false.

func CheckProjectPerm

func CheckProjectPerm(tenantId consts.TenantId, r *http.Request, userId uint) (bool, error)

func CreateOplog

func CreateOplog(tenantId consts.TenantId, ol model.Oplog) error

CreateOplog

func FindInId

func FindInId(tenantId consts.TenantId, ids []string) (roles []v1.RoleResp, error error)

func FindUserById

func FindUserById(tenantId consts.TenantId, id uint) (user v1.UserResp, err error)

func FindUserDetailById

func FindUserDetailById(tenantId consts.TenantId, id uint) (user v1.UserResp, err error)

func GetSysRoles

func GetSysRoles(tenantId consts.TenantId, users ...*v1.UserResp)

func InitCheck

func InitCheck() iris.Handler

InitCheck 初始化检测中间件

func IsAdminUser

func IsAdminUser(tenantId consts.TenantId, id uint) (ret bool, err error)

func JwtHandler

func JwtHandler() iris.Handler

func OpenCheck

func OpenCheck() iris.Handler

func OperationRecord

func OperationRecord() iris.Handler

OperationRecord 操作日志中间件

func ProjectPerm

func ProjectPerm() iris.Handler

ProjectPerm 项目权限权鉴中间件

Types

type BaseModel

type BaseModel struct {
	ID        uint       `gorm:"primary_key" sql:"type:INT(10) UNSIGNED NOT NULL" json:"id"`
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`

	Deleted  bool `json:"-" gorm:"default:false"`
	Disabled bool `json:"disabled,omitempty" gorm:"default:false"`
}

type ProjectMemberModel

type ProjectMemberModel struct {
	BaseModel

	ProjectId     uint `json:"projectId"`
	ProjectRoleId uint `json:"projectRoleId"`
	UserId        uint `json:"userId"`
}

func GetUserCurrentRole

func GetUserCurrentRole(tenantId consts.TenantId, userId uint) (data ProjectMemberModel, err error)

func (ProjectMemberModel) TableName

func (ProjectMemberModel) TableName() string

type ProjectPermModel

type ProjectPermModel struct {
	BaseModel
	Name        string `gorm:"index:perm_index,unique;not null ;type:varchar(200)" json:"name" validate:"required,gte=4,lte=50"`
	DisplayName string `gorm:"type:varchar(256)" json:"displayName"`
	Description string `gorm:"type:varchar(256)" json:"description"`
	Act         string `gorm:"index:perm_index;type:varchar(50)" json:"act" validate:"required"`
}

func GetProjectPerm

func GetProjectPerm(tenantId consts.TenantId, path, method string) (res ProjectPermModel, err error)

func (ProjectPermModel) TableName

func (ProjectPermModel) TableName() string

type ProjectRolePermModel

type ProjectRolePermModel struct {
	BaseModel
	v1.ProjectRolePermBase
}

func GetProjectRolePerm

func GetProjectRolePerm(tenantId consts.TenantId, roleId, permId uint) (data ProjectRolePermModel, err error)

func (ProjectRolePermModel) TableName

func (ProjectRolePermModel) TableName() string

type SysRole

type SysRole struct {
	BaseModel
	v1.RoleBase
}

func (SysRole) TableName

func (SysRole) TableName() string

type SysUser

type SysUser struct {
	BaseModel

	v1.UserBase

	Password string              `gorm:"type:varchar(250)" json:"password" validate:"required"`
	Vcode    string              `json:"vcode"`
	Profile  SysUserProfileModel `gorm:"foreignKey:user_id"`

	RoleIds []uint `gorm:"-" json:"role_ids"`
}

func (SysUser) TableName

func (SysUser) TableName() string

type SysUserProfileModel

type SysUserProfileModel struct {
	BaseModel

	Phone         string `json:"phone"`
	CurrProjectId uint   `json:"currProjectId"`

	UserId uint `json:"userId"`
}

func (SysUserProfileModel) TableName

func (SysUserProfileModel) TableName() string

Jump to

Keyboard shortcuts

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