Documentation
¶
Index ¶
- Variables
- func AddPermForRole(id uint, perms [][]string) error
- func AuthorityNameScope(name string) func(db *gorm.DB) *gorm.DB
- func AuthorityTypeScope(authorityType int) func(db *gorm.DB) *gorm.DB
- func Copy(id uint, req *AuthorityRequest) (uint, error)
- func CopyAuthority(ctx *gin.Context)
- func Create(req *AuthorityRequest) (uint, error)
- func CreateAuthority(ctx *gin.Context)
- func DeleteAuthority(ctx *gin.Context)
- func GetAdminAuthorityList(ctx *gin.Context)
- func GetAdminRoleName() string
- func GetAuthorityList(ctx *gin.Context)
- func GetGeneralAuthorityList(ctx *gin.Context)
- func GetMigration() *gormigrate.Migration
- func GetRoleIds() ([]uint, error)
- func GetTenancyAuthorityList(ctx *gin.Context)
- func Group(group *gin.RouterGroup)
- func IsAdminRole(id uint) error
- func Update(id uint, req *Authority) error
- func UpdateAuthority(ctx *gin.Context)
- type Authority
- type AuthorityCollection
- type AuthorityRequest
- type BaseAuthority
- type BaseMenu
- type PageResponse
- type ReqPaginate
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRoleNameInvalide = errors.New("角色名称已经被使用")
View Source
var Source = new(source)
Functions ¶
func AuthorityNameScope ¶
AuthorityNameScope 根据 name 查询 - name 名称
func AuthorityTypeScope ¶
AuthorityTypeScope 根据 type 查询 - authorityType 角色类型
func GetAdminAuthorityList ¶
GetAdminAuthorityList 分页获取管理角色列表
func GetGeneralAuthorityList ¶
GetGeneralAuthorityList 分页获取用户角色列表
func GetMigration ¶
func GetMigration() *gormigrate.Migration
func GetRoleIds ¶
func GetTenancyAuthorityList ¶
GetTenancyAuthorityList 分页获取商户角色列表
func Group ¶
func Group(group *gin.RouterGroup)
func IsAdminRole ¶
Types ¶
type Authority ¶
type Authority struct { gorm.Model BaseAuthority Menus []BaseMenu `json:"menus" gorm:"many2many:authority_menus;"` Children []Authority `json:"children" gorm:"-"` Perms [][]string `json:"perms" gorm:"-"` }
func GetSources ¶
type AuthorityCollection ¶
type AuthorityCollection []Authority
type AuthorityRequest ¶
type AuthorityRequest struct {
BaseAuthority
}
type BaseAuthority ¶
type BaseAuthority struct { AuthorityName string `json:"authorityName" gorm:"comment:角色名" binding:"required"` AuthorityType int `json:"authorityType" gorm:"comment:角色类型"` ParentId uint `json:"parentId" gorm:"default:0;comment:父角色ID"` DefaultRouter string `json:"defaultRouter" gorm:"comment:默认菜单;default:dashboard"` }
type BaseMenu ¶
type BaseMenu struct { gorm.Model Pid uint `gorm:"index:pid;column:pid;type:int unsigned;not null;default:0" json:"pid"` // 父级id Path string `gorm:"column:path;type:varchar(512);not null" json:"path"` // 路径 Icon string `gorm:"column:icon;type:varchar(32);default:''" json:"icon"` // 图标 MenuName string `gorm:"column:menu_name;type:varchar(128);not null;default:''" json:"menu_name"` // 按钮名 Route string `gorm:"column:route;type:varchar(64);not null" json:"route"` // 路由名称 Params string `gorm:"column:params;type:varchar(128);not null;default:''" json:"params"` // 参数 Sort int8 `gorm:"column:sort;type:tinyint;not null;default:0" json:"sort"` // 排序 Hidden int `gorm:"column:hidden;type:tinyint unsigned;not null;default:1" json:"hidden"` // 是否显示 IsTenancy int `gorm:"column:is_tenancy;type:tinyint unsigned;not null;default:1" json:"is_tenancy"` // 模块,1 平台, 2商户 IsMenu int `gorm:"column:is_menu;type:tinyint unsigned;not null;default:1" json:"is_menu"` // 类型,1菜单 2 权限 Authoritys []Authority `json:"authoritys" gorm:"many2many:authority_menus;"` Children []BaseMenu `json:"children" gorm:"-"` }
type PageResponse ¶
type PageResponse struct {
Item []*Response
}
Paginate 分页
type ReqPaginate ¶
Click to show internal directories.
Click to hide internal directories.