Documentation ¶
Index ¶
- Constants
- Variables
- func AddAccess(role, res string, perm uint16, args ...string) (acc *db.Access, err error)
- func AddMenuToParent(menu, parent *db.Menu) (err error)
- func CountRows(tableName string, excludeDeleted bool) int
- func GetNextWorkday(t time.Time) (time.Time, bool)
- func GetUserInfo(user *db.User) map[string]interface{}
- func GetUserRoles(user *db.User) (roles []string, err error)
- func IsHoliday(date string) bool
- func NewMenu(path, title, icon string) *db.Menu
- func QueryPermissions(roles ...string) *xorm.Session
- func SetCalendarY2019(cal *calendar.Calendar) *calendar.Calendar
- func SetCalendarY2020(cal *calendar.Calendar) *calendar.Calendar
- func TruncTable(tableName string) error
- type CronTimerCluster
- type GroupSummary
- type Permission
- type UserAuth
- func (a UserAuth) GetAnonymousOpenUrls() []string
- func (a UserAuth) GetLimitedBlackListUrls() []string
- func (a UserAuth) GetLimitedWhiteListUrls() []string
- func (a UserAuth) GetRegularPermissions(roles []string) (perms []auth.IPermission)
- func (a UserAuth) GetSuperPermissions(roles []string) (perms []auth.IPermission)
- func (a UserAuth) GetUserRoles() (roles []string, err error)
- func (a UserAuth) GetUserType() (utype usertype.UserType, err error)
- func (a UserAuth) IsStaticResourceUrl(url string) bool
- type UserWithGroup
Constants ¶
View Source
const ( ROLE_NAME_SUPER = "superuser" // 超级管理员 ROLE_NAME_LIMITED = "limited" // 受限用户 URL_PREFIX_IMAGE = "/images" // 静态图片网址 )
Variables ¶
View Source
var (
WeekEndType = calendar.W_MON_FRI // 双休
)
Functions ¶
func GetUserInfo ¶
func GetUserInfo(user *db.User) map[string]interface{}
func GetUserRoles ¶
func QueryPermissions ¶
Types ¶
type CronTimerCluster ¶
type CronTimerCluster struct { cron.CronTimer `json:",inline" xorm:"extends"` *base.ClusterMixin `json:"-" xorm:"-"` }
func NewCronTimerCluster ¶
func NewCronTimerCluster() *CronTimerCluster
func (CronTimerCluster) ResetTable ¶
func (m CronTimerCluster) ResetTable(curr string, trunc bool) error
func (CronTimerCluster) TableName ¶
func (m CronTimerCluster) TableName() string
type GroupSummary ¶
type GroupSummary struct { Title string `json:"title" xorm:"notnull default '' comment('名称') VARCHAR(50)"` Remark string `json:"remark" xorm:"comment('说明备注') TEXT"` }
func (GroupSummary) TableName ¶
func (GroupSummary) TableName() string
type Permission ¶
type UserAuth ¶
func (UserAuth) GetLimitedBlackListUrls ¶
获取受限用户黑名单中的的网址,与白名单二选一
func (UserAuth) GetLimitedWhiteListUrls ¶
获取受限用户白名单中的的网址,不再检查正常用户权限,与黑名单二选一
func (UserAuth) GetRegularPermissions ¶
func (a UserAuth) GetRegularPermissions(roles []string) (perms []auth.IPermission)
获取正常用户权限可访问的网址
func (UserAuth) GetSuperPermissions ¶
func (a UserAuth) GetSuperPermissions(roles []string) (perms []auth.IPermission)
获取超级用户权限可访问的网址,不再检查正常用户权限
func (UserAuth) GetUserType ¶
用户分类,无法区分内部用户和普通用户
func (UserAuth) IsStaticResourceUrl ¶
是否静态资源网址
type UserWithGroup ¶
type UserWithGroup struct { db.User `json:",inline" xorm:"extends"` PrinGroup *GroupSummary `json:",inline" xorm:"extends"` ViceGroup *GroupSummary `json:",inline" xorm:"extends"` }
Click to show internal directories.
Click to hide internal directories.