Documentation
¶
Index ¶
- Variables
- func GetAll(string, orderBy string, offset, limit int) *gorm.DB
- func GetPermissionsForUser(uid uint) [][]string
- func GetRolesForUser(uid uint) []string
- func HashPassword(pwd string) string
- func New(db *gorm.DB, ce *casbin.Enforcer)
- func TUserAdminLogout(userId uint) bool
- func Update(v, d interface{}) error
- type Backend
- type TOauthToken
- type TPermission
- type TRole
- type TUser
- type Tenant
- type Token
Constants ¶
This section is empty.
Variables ¶
var ( Db *gorm.DB CE *casbin.Enforcer )
Functions ¶
func GetAll ¶
*
- 获取列表
- @method MGetAll
- @param {[type]} string string [description]
- @param {[type]} orderBy string [description]
- @param {[type]} relation string [description]
- @param {[type]} offset int [description]
- @param {[type]} limit int [description]
func GetPermissionsForUser ¶
func GetRolesForUser ¶
func HashPassword ¶
func TUserAdminLogout ¶
* * 用户退出登陆 * @method TUserAdminLogout * @param {[type]} ids string [description]
Types ¶
type TOauthToken ¶
type TOauthToken struct { gorm.Model Token string `gorm:"not null default '' comment('Token') VARCHAR(191)"` UserId uint `gorm:"not null default '' comment('UserId') VARCHAR(191)"` Secret string `gorm:"not null default '' comment('Secret') VARCHAR(191)"` ExpressIn int64 `gorm:"not null default 0 comment('是否是标准库') BIGINT(20)"` Revoked bool }
func (*TOauthToken) GetTOauthTokenByToken ¶
func (ot *TOauthToken) GetTOauthTokenByToken(token string)
* * 通过 token 获取 access_token 记录 * @method GetTOauthTokenByToken * @param {[type]} token string [description]
func (*TOauthToken) TOauthTokenCreate ¶
func (ot *TOauthToken) TOauthTokenCreate() *Token
* * oauth_token * @method OauthTokenCreate
func (*TOauthToken) UpdateTOauthTokenByTUserId ¶
func (ot *TOauthToken) UpdateTOauthTokenByTUserId(userId uint)
* * 通过 user_id 更新 oauth_token 记录 * @method UpdatetOauthTokenByUserId *@param {[type]} user *tOauthToken [description]
type TPermission ¶
type TPermission struct { gorm.Model Name string `gorm:"not null VARCHAR(191)"` DisplayName string `gorm:"VARCHAR(191)"` Description string `gorm:"VARCHAR(191)"` Act string `gorm:"VARCHAR(191)"` }
func GetAllTPermissions ¶
func GetAllTPermissions(name, orderBy string, offset, limit int) (permissions []*TPermission)
* * 获取所有的权限 * @method GetAllPermissions * @param {[type]} name string [description] * @param {[type]} orderBy string [description] * @param {[type]} offset int [description] * @param {[type]} limit int [description]
func NewTPermission ¶
func NewTPermission(id uint, name, act string) *TPermission
func (*TPermission) CreateTPermission ¶
func (p *TPermission) CreateTPermission() error
* * 创建 * @method CreatePermission * @param {[type]} kw string [description] * @param {[type]} cp int [description] * @param {[type]} mp int [description]
func (*TPermission) DeleteTPermissionById ¶
func (p *TPermission) DeleteTPermissionById()
* * 通过 id 删除权限 * @method DeletePermissionById
func (*TPermission) GetTPermissionById ¶
func (p *TPermission) GetTPermissionById()
* * 通过 id 获取 permission 记录 * @method GetPermissionById * @param {[type]} permission *Permission [description]
func (*TPermission) GetTPermissionByNameAct ¶
func (p *TPermission) GetTPermissionByNameAct()
* * 通过 name 获取 permission 记录 * @method GetPermissionByName * @param {[type]} permission *Permission [description]
func (*TPermission) UpdateTPermission ¶
func (p *TPermission) UpdateTPermission(pj *validates.TPermissionRequest)
* * 更新 * @method UpdatePermission * @param {[type]} kw string [description] * @param {[type]} cp int [description] * @param {[type]} mp int [description]
type TRole ¶
type TRole struct { gorm.Model Name string `gorm:"unique;not null VARCHAR(191)"` DisplayName string `gorm:"VARCHAR(191)"` Description string `gorm:"VARCHAR(191)"` }
func GetAllTRoles ¶
* * 获取所有的角色 * @method GetAllRole * @param {[type]} name string [description] * @param {[type]} orderBy string [description] * @param {[type]} offset int [description] * @param {[type]} limit int [description]
func NewTRoleByStruct ¶
func NewTRoleByStruct(rr *validates.TRoleRequest) *TRole
func (*TRole) CreateTRole ¶
* * 创建 * @method CreateRole * @param {[type]} kw string [description] * @param {[type]} cp int [description] * @param {[type]} mp int [description]
func (*TRole) DeleteTRoleById ¶
func (r *TRole) DeleteTRoleById()
* * 通过 id 删除角色 * @method DeleteRoleById
func (*TRole) GetTRoleById ¶
func (r *TRole) GetTRoleById()
* * 通过 id 获取 role 记录 * @method GetRoleById * @param {[type]} role *Role [description]
func (*TRole) GetTRoleByName ¶
func (r *TRole) GetTRoleByName()
* * 通过 name 获取 role 记录 * @method GetRoleByName * @param {[type]} role *Role [description]
func (*TRole) UpdateTRole ¶
func (r *TRole) UpdateTRole(rj *validates.TRoleRequest, permIds []uint)
* * 更新 * @method UpdateRole * @param {[type]} kw string [description] * @param {[type]} cp int [description] * @param {[type]} mp int [description]
type TUser ¶
type TUser struct { gorm.Model Name string `gorm:"not null VARCHAR(191)"` Username string `gorm:"unique;VARCHAR(191)"` Password string `gorm:"not null VARCHAR(191)"` }
func GetAllTUsers ¶
* * 获取所有的账号 * @method GetAllTUser * @param {[type]} name string [description] * @param {[type]} username string [description] * @param {[type]} orderBy string [description] * @param {[type]} offset int [description] * @param {[type]} limit int [description]
func NewTUserByStruct ¶
func NewTUserByStruct(ru *validates.CreateUpdateTUserRequest) *TUser
func (*TUser) CheckLogin ¶
* * 判断用户是否登录 * @method CheckLogin * @param {[type]} id int [description] * @param {[type]} password string [description]
func (*TUser) CreateTUser ¶
* * 创建 * @method CreateTUser * @param {[type]} kw string [description] * @param {[type]} cp int [description] * @param {[type]} mp int [description]
func (*TUser) GetTUserById ¶
func (u *TUser) GetTUserById()
func (*TUser) GetTUserByUsername ¶
func (u *TUser) GetTUserByUsername()
func (*TUser) UpdateTUser ¶
func (u *TUser) UpdateTUser(uj *validates.CreateUpdateTUserRequest)
* * 更新 * @method UpdateTUser * @param {[type]} kw string [description] * @param {[type]} cp int [description] * @param {[type]} mp int [description]