Documentation
¶
Index ¶
Constants ¶
View Source
const (
TopicAuthorization string = "auth_authorization"
)
View Source
const (
TopicResource string = "auth_resource"
)
View Source
const (
TopicUser string = "auth_user"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
type Authorization struct {
m.PrimaryKey
ResourceId int `json:"resourceId" db:"resourceId" db_omit:"update" db_default:"0"`
UserId int `json:"userId" db:"userId" db_omit:"update" db_default:"0"`
IsOwner bool `json:"isOwner" db:"isOwner" db_omit:"update" db_default:"0"`
IsHeritable bool `json:"isHeritable" db:"isHeritable" db_default:"0"`
IsUpdatable bool `json:"isUpdatable" db:"isUpdatable" db_default:"0"`
IsDeletable bool `json:"isDeletable" db:"isDeletable" db_default:"0"`
Operations string `json:"operations" db:"operations" db_type:"VARCHAR(4096)" db_default:"''"`
Resource Resource `json:"resource" db_skip:"true"`
}
type Model ¶
type Model interface {
GetResource(resourceCode, resourceType string) (*Resource, error)
GetUser(userCode, userType string) (*User, error)
GetAuthorization(userCode, userType, resourceCode, resourceType string) (*Authorization, error)
GetAuthorizationList(userCode, userType string) ([]*Authorization, error)
GetAuthorizationListByResourceType(userCode, userType, resourceType string) ([]*Authorization, error)
GetUserListByResource(resourceCode, resourceType string) ([]*User, error)
CreateUser(userCode, userType, parentCode, parentType string) error
CreateResource(userCode, userType, resourceCode, resourceType, parentCode, parentType string) error
CreateAuthorization(userCode, userType, resourceCode, resourceType, operations string,
isHeritable, isUpdatable, isDeletable bool) error
DeleteUser(userCode, userType string) error
DeleteResource(resourceCode, resourceType string) error
DeleteAuthorization(userCode, userType, resourceCode, resourceType string) error
}
type Resource ¶
type Resource struct {
m.PrimaryKey
ResourceCode string `json:"resourceCode" db:"resourceCode" db_omit:"update" db_type:"VARCHAR(64)" db_default:"''"`
ResourceType string `json:"resourceType" db:"resourceType" db_omit:"update" db_type:"VARCHAR(64)" db_default:"''"`
ParentId int `json:"parentId" db:"parentId" db_omit:"update" db_default:"0"`
}
type User ¶
type User struct {
m.PrimaryKey
UserCode string `json:"userCode" db:"userCode" db_type:"VARCHAR(64)" db_omit:"update" db_default:"''"`
UserType string `json:"userType" db:"userType" db_type:"VARCHAR(64)" db_omit:"update" db_default:"''"`
ParentId int `json:"parentId" db:"parentId" db_omit:"update" db_default:"0"`
}
type UserWithAuthorization ¶
type UserWithAuthorization struct {
User
AuthorizationMap map[int]*Authorization `json:"authorizationMap"`
}
Click to show internal directories.
Click to hide internal directories.