Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDatabaseError = errors.New("db error") ErrInternalError = errors.New("internal error") ErrNoSuchObject = errors.New("对象不存在") ErrPermissionDenied = errors.New("对象不存在或无权查看") NoAuthIdentity = AuthIdentity{ UserId: -2, Username: "noauth", DeptId: -2, RoleId: -2, RoleKey: "noauth", RoleName: "noauth", } WebIdentity = AuthIdentity{ UserId: -1, Username: "web", DeptId: -1, RoleId: -1, RoleKey: "web", RoleName: "web", } )
Functions ¶
func Permission ¶
Permission check permission of data scope
Types ¶
type AuthIdentity ¶
type AuthIdentity struct { UserId int Username string DeptId int RoleId int RoleKey string RoleName string DataScope string }
func GetIdentity ¶
func GetIdentity(c *gin.Context) *AuthIdentity
type Service ¶
type Service struct { Orm *gorm.DB Identity *AuthIdentity }
func (*Service) ConstructFromDB ¶
Click to show internal directories.
Click to hide internal directories.