Documentation ¶
Index ¶
- type Api
- type FieldRelation
- type Group
- type Menu
- type OperationLog
- type Role
- type RoleCasbin
- type User
- func (u *User) SetAvatar(avatar string)
- func (u *User) SetGivenName(givenName string)
- func (u *User) SetIntroduction(desc string)
- func (u *User) SetJobNumber(jobNum string)
- func (u *User) SetMail(mail string)
- func (u *User) SetMobile(mobile string)
- func (u *User) SetNickName(nickName string)
- func (u *User) SetPosition(position string)
- func (u *User) SetPostalAddress(address string)
- func (u *User) SetSourceUnionId(sourceUnionId string)
- func (u *User) SetSourceUserId(sourceUserId string)
- func (u *User) SetUserName(userName string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct { gorm.Model Method string `gorm:"type:varchar(20);comment:'请求方式'" json:"method"` Path string `gorm:"type:varchar(100);comment:'访问路径'" json:"path"` Category string `gorm:"type:varchar(50);comment:'所属类别'" json:"category"` Remark string `gorm:"type:varchar(100);comment:'备注'" json:"remark"` Creator string `gorm:"type:varchar(20);comment:'创建人'" json:"creator"` }
type FieldRelation ¶ added in v0.5.0
type Group ¶
type Group struct { gorm.Model GroupName string `gorm:"type:varchar(128);comment:'分组名称'" json:"groupName"` Remark string `gorm:"type:varchar(128);comment:'分组中文说明'" json:"remark"` Creator string `gorm:"type:varchar(20);comment:'创建人'" json:"creator"` GroupType string `gorm:"type:varchar(20);comment:'分组类型:cn、ou'" json:"groupType"` Users []*User `gorm:"many2many:group_users" json:"users"` ParentId uint `gorm:"default:0;comment:'父组编号(编号为0时表示根组)'" json:"parentId"` SourceDeptId string `gorm:"type:varchar(100);comment:'部门编号'" json:"sourceDeptId"` Source string `gorm:"type:varchar(20);comment:'来源:dingTalk、weCom、ldap、platform'" json:"source"` SourceDeptParentId string `gorm:"type:varchar(100);comment:'父部门编号'" json:"sourceDeptParentId"` SourceUserNum int `gorm:"default:0;comment:'部门下的用户数量,从第三方获取的数据'" json:"source_user_num"` Children []*Group `gorm:"-" json:"children"` GroupDN string `gorm:"type:varchar(255);not null;comment:'分组dn'" json:"groupDn"` // 分组在ldap的dn SyncState uint `gorm:"type:tinyint(1);default:1;comment:'同步状态:1已同步, 2未同步'" json:"syncState"` // 数据到ldap的同步状态 }
func (*Group) SetGroupName ¶ added in v0.5.0
func (*Group) SetSourceDeptId ¶ added in v0.5.0
func (*Group) SetSourceDeptParentId ¶ added in v0.5.0
type Menu ¶
type Menu struct { gorm.Model Name string `gorm:"type:varchar(50);comment:'菜单名称(英文名, 可用于国际化)'" json:"name"` Title string `gorm:"type:varchar(50);comment:'菜单标题(无法国际化时使用)'" json:"title"` Icon string `gorm:"type:varchar(50);comment:'菜单图标'" json:"icon"` Path string `gorm:"type:varchar(100);comment:'菜单访问路径'" json:"path"` Redirect string `gorm:"type:varchar(100);comment:'重定向路径'" json:"redirect"` Component string `gorm:"type:varchar(100);comment:'前端组件路径'" json:"component"` Sort uint `gorm:"type:int(3);default:999;comment:'菜单顺序(1-999)'" json:"sort"` Status uint `gorm:"type:tinyint(1);default:1;comment:'菜单状态(正常/禁用, 默认正常)'" json:"status"` Hidden uint `gorm:"type:tinyint(1);default:2;comment:'菜单在侧边栏隐藏(1隐藏,2显示)'" json:"hidden"` NoCache uint `gorm:"type:tinyint(1);default:2;comment:'菜单是否被 <keep-alive> 缓存(1不缓存,2缓存)'" json:"noCache"` AlwaysShow uint `` /* 134-byte string literal not displayed */ Breadcrumb uint `gorm:"type:tinyint(1);default:1;comment:'面包屑可见性(可见/隐藏, 默认可见)'" json:"breadcrumb"` ActiveMenu string `gorm:"type:varchar(100);comment:'在其它路由时,想在侧边栏高亮的路由'" json:"activeMenu"` ParentId uint `gorm:"default:0;comment:'父菜单编号(编号为0时表示根菜单)'" json:"parentId"` Creator string `gorm:"type:varchar(20);comment:'创建人'" json:"creator"` Children []*Menu `gorm:"-" json:"children"` // 子菜单集合 Roles []*Role `gorm:"many2many:role_menus;" json:"roles"` // 角色菜单多对多关系 }
type OperationLog ¶
type OperationLog struct { gorm.Model Username string `gorm:"type:varchar(20);comment:'用户登录名'" json:"username"` Ip string `gorm:"type:varchar(20);comment:'Ip地址'" json:"ip"` IpLocation string `gorm:"type:varchar(20);comment:'Ip所在地'" json:"ipLocation"` Method string `gorm:"type:varchar(20);comment:'请求方式'" json:"method"` Path string `gorm:"type:varchar(100);comment:'访问路径'" json:"path"` Remark string `gorm:"type:varchar(100);comment:'备注'" json:"remark"` Status int `gorm:"type:int(4);comment:'响应状态码'" json:"status"` StartTime string `gorm:"type:varchar(2048);comment:'发起时间'" json:"startTime"` TimeCost int64 `gorm:"type:int(6);comment:'请求耗时(ms)'" json:"timeCost"` UserAgent string `gorm:"type:varchar(2048);comment:'浏览器标识'" json:"userAgent"` }
type Role ¶
type Role struct { gorm.Model Name string `gorm:"type:varchar(20);not null;unique" json:"name"` Keyword string `gorm:"type:varchar(20);not null;unique" json:"keyword"` Remark string `gorm:"type:varchar(100);comment:'备注'" json:"remark"` Status uint `gorm:"type:tinyint(1);default:1;comment:'1正常, 2禁用'" json:"status"` Sort uint `` /* 200-byte string literal not displayed */ Creator string `gorm:"type:varchar(20);" json:"creator"` Users []*User `gorm:"many2many:user_roles" json:"users"` Menus []*Menu `gorm:"many2many:role_menus;" json:"menus"` // 角色菜单多对多关系 }
type RoleCasbin ¶
type RoleCasbin struct { Keyword string `json:"keyword"` // 角色关键字 Path string `json:"path"` // 访问路径 Method string `json:"method"` // 请求方式 }
角色权限规则
type User ¶
type User struct { gorm.Model Username string `gorm:"type:varchar(50);not null;unique;comment:'用户名'" json:"username"` // 用户名 Password string `gorm:"size:255;not null;comment:'用户密码'" json:"password"` // 用户密码 Nickname string `gorm:"type:varchar(50);comment:'中文名'" json:"nickname"` // 昵称 GivenName string `gorm:"type:varchar(50);comment:'花名'" json:"givenName"` // 花名,如果有的话,没有的话用昵称占位 Mail string `gorm:"type:varchar(100);comment:'邮箱'" json:"mail"` // 邮箱 JobNumber string `gorm:"type:varchar(20);comment:'工号'" json:"jobNumber"` // 工号 Mobile string `gorm:"type:varchar(15);not null;unique;comment:'手机号'" json:"mobile"` // 手机号 Avatar string `gorm:"type:varchar(255);comment:'头像'" json:"avatar"` // 头像 PostalAddress string `gorm:"type:varchar(255);comment:'地址'" json:"postalAddress"` // 地址 Departments string `gorm:"type:varchar(128);comment:'部门'" json:"departments"` // 部门 Position string `gorm:"type:varchar(128);comment:'职位'" json:"position"` // 职位 Introduction string `gorm:"type:varchar(255);comment:'个人简介'" json:"introduction"` // 个人简介 Status uint `gorm:"type:tinyint(1);default:1;comment:'状态:1在职, 2离职'" json:"status"` // 状态 Creator string `gorm:"type:varchar(20);;comment:'创建者'" json:"creator"` // 创建者 Source string `gorm:"type:varchar(50);comment:'用户来源:dingTalk、wecom、feishu、ldap、platform'" json:"source"` // 来源 DepartmentId string `gorm:"type:varchar(100);not null;comment:'部门id'" json:"departmentId"` // 部门id Roles []*Role `gorm:"many2many:user_roles" json:"roles"` // 角色 SourceUserId string `gorm:"type:varchar(100);not null;comment:'第三方用户id'" json:"sourceUserId"` // 第三方用户id SourceUnionId string `gorm:"type:varchar(100);not null;comment:'第三方唯一unionId'" json:"sourceUnionId"` // 第三方唯一unionId UserDN string `gorm:"type:varchar(255);not null;comment:'用户dn'" json:"userDn"` // 用户在ldap的dn SyncState uint `gorm:"type:tinyint(1);default:1;comment:'同步状态:1已同步, 2未同步'" json:"syncState"` // 数据到ldap的同步状态 }
func (*User) SetGivenName ¶ added in v0.5.0
func (*User) SetIntroduction ¶ added in v0.5.0
func (*User) SetJobNumber ¶ added in v0.5.0
func (*User) SetNickName ¶ added in v0.5.0
func (*User) SetPosition ¶ added in v0.5.0
func (*User) SetPostalAddress ¶ added in v0.5.0
func (*User) SetSourceUnionId ¶ added in v0.5.0
func (*User) SetSourceUserId ¶ added in v0.5.0
func (*User) SetUserName ¶ added in v0.5.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.