Documentation
¶
Index ¶
- func CheckCacheTimeout()
- func GetAllTokenExpiredTime() map[string]time.Time
- func GetPermissionName(component string, method string, path string) (string, error)
- func GetResourceName(component string, path string) (string, error)
- func SetCache(token string, user *User, ttl time.Duration)
- type Cache
- type Permission
- type Resource
- type Role
- type User
- func (user *User) CheckPassword(password string) bool
- func (user *User) CopyPartialUserDataForComponent(component string) *User
- func (user *User) HasChildPermission(component string, method string, path string) bool
- func (user *User) HasPermission(component string, method string, path string) bool
- func (user *User) HasResource(component string, path string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCacheTimeout ¶
func CheckCacheTimeout()
func GetAllTokenExpiredTime ¶
func GetPermissionName ¶
Types ¶
type Permission ¶
type Permission struct {
Name string
Component string
Method string
Path string // Path is hierarchy
}
func CreatePermission ¶
func CreatePermission(component string, method string, path string) (*Permission, error)
func (*Permission) HasChildPermission ¶
func (permission *Permission) HasChildPermission(component string, method string, path string) bool
Check whether user has the target permission node or child permission node of the target permission node along the tree
func (*Permission) HasPermission ¶
func (permission *Permission) HasPermission(component string, method string, path string) bool
type Role ¶
type Role struct {
Name string
PermissionSlice []*Permission
Description string
}
func (*Role) HasChildPermission ¶
Check whether user has the target permission node or child permission node of the target permission node along the tree
type User ¶
type User struct {
Name string
EncodedPassword string
RoleSlice []*Role
ResourceSlice []*Resource
Description string
MetaDataMap map[string]string // Used to store user's data which doesn't need to check password
ExpiredTime *time.Time
Disabled bool
}
func CreateUser ¶
func (*User) CheckPassword ¶
func (*User) CopyPartialUserDataForComponent ¶
func (*User) HasChildPermission ¶
Check whether user has the target permission node or child permission node of the target permission node along the tree. This doesn't mean user has permission to access the parent permission node in the tree but just is able to bypass the parent permission node in order to go down to the target child permission node in the tree.
func (*User) HasPermission ¶
Click to show internal directories.
Click to hide internal directories.