Documentation
¶
Index ¶
- Variables
- type AttrDB
- type AttrGroupUUID
- type AttrIntersection1
- type AttrIntersection2
- type AttrPermissionIdentity
- type AttrPermissionName
- type AttrRoleName
- type AttrTablePrefix
- type Edge
- func (*Edge) AutoMigrate() error
- func (*Edge) Bind(roleUUID uuid.UUID, intersections map[string][]string) error
- func (*Edge) CheckAllRolesPermission(intersection1, intersection2, identity string, roleUUIDs ...uuid.UUID) (bool, error)
- func (*Edge) CheckInRolesPermission(intersection1, intersection2, identity string, roleUUIDs ...uuid.UUID) (bool, error)
- func (*Edge) CheckNotInRolesPermission(intersection1, intersection2, identity string, roleUUIDs ...uuid.UUID) (bool, error)
- func (*Edge) CheckPermission(intersection1, intersection2, identity string) (bool, error)
- func (*Edge) CheckRolePermission(intersection1, intersection2, identity string, roleUUID uuid.UUID) (bool, error)
- func (*Edge) DB() *gorm.DB
- func (*Edge) GetByIntersection1(intersection1 string) ([]*Edge, error)
- func (*Edge) Once(options ...EdgeAttributer) *Edge
- func (*Edge) Set(options ...EdgeAttributer) *Edge
- func (*Edge) TableName() string
- type EdgeAttributer
- type Group
- type Permission
- func (Permission) DB() *gorm.DB
- func (my Permission) Destroy() error
- func (Permission) New(attrs ...PermissionAttributer) Permission
- func (my Permission) Set(attrs ...PermissionAttributer) Permission
- func (my Permission) Store(options ...PermissionAttributer) error
- func (Permission) TableName() string
- func (my Permission) Update(options ...PermissionAttributer) error
- type PermissionAttributer
- type Role
- func (Role) DB() *gorm.DB
- func (my Role) Destroy() error
- func (my Role) GetDotsByUUID(edgeUUID uuid.UUID) ([]Permission, error)
- func (my Role) GetDotsByUUIDs(edgeUUIDs []uuid.UUID) ([]Permission, error)
- func (Role) New(attrs ...RoleAttributer) Role
- func (my Role) Set(attrs ...RoleAttributer) Role
- func (my Role) Store(options ...RoleAttributer) error
- func (Role) TableName() string
- func (my Role) Update(attrs ...RoleAttributer) error
- type RoleAttributer
Constants ¶
This section is empty.
Variables ¶
View Source
var APP struct { Edge Edge Group Group Role Role Permission Permission }
Functions ¶
This section is empty.
Types ¶
type AttrGroupUUID ¶
type AttrGroupUUID struct {
// contains filtered or unexported fields
}
func (AttrGroupUUID) Register ¶
func (my AttrGroupUUID) Register(triangle *Edge)
type AttrIntersection1 ¶
type AttrIntersection1 struct {
// contains filtered or unexported fields
}
func (AttrIntersection1) Register ¶
func (my AttrIntersection1) Register(triangle *Edge)
type AttrIntersection2 ¶
type AttrIntersection2 struct {
// contains filtered or unexported fields
}
func (AttrIntersection2) Register ¶
func (my AttrIntersection2) Register(triangle *Edge)
type AttrPermissionIdentity ¶
type AttrPermissionIdentity struct {
// contains filtered or unexported fields
}
func (AttrPermissionIdentity) Register ¶
func (my AttrPermissionIdentity) Register(permission *Permission)
type AttrPermissionName ¶
type AttrPermissionName struct {
// contains filtered or unexported fields
}
func (AttrPermissionName) Register ¶
func (my AttrPermissionName) Register(permission *Permission)
type AttrRoleName ¶
type AttrRoleName struct {
// contains filtered or unexported fields
}
func (AttrRoleName) Register ¶
func (my AttrRoleName) Register(role *Role)
type AttrTablePrefix ¶
type AttrTablePrefix struct {
// contains filtered or unexported fields
}
func (AttrTablePrefix) Register ¶
func (my AttrTablePrefix) Register(triangle *Edge)
type Edge ¶
type Edge struct {
RoleUUID uuid.UUID `gorm:"column:role_uuid;type:char(36);not null;primaryKey;comment:组UUID;" json:"roleUUID"`
Role *Role `gorm:"foreignKey:role_uuid;references:uuid;" json:"role"`
Intersection1 string `gorm:"column:intersection1;type:varchar(255);not null;primaryKey;comment:交点1;" json:"intersection1"`
Intersection2 string `gorm:"column:intersection2;type:varchar(255);not null;primaryKey;comment:交点2;" json:"intersection2"`
// contains filtered or unexported fields
}
func (*Edge) AutoMigrate ¶
func (*Edge) CheckAllRolesPermission ¶
func (*Edge) CheckInRolesPermission ¶
func (*Edge) CheckNotInRolesPermission ¶
func (*Edge) CheckPermission ¶
func (*Edge) CheckRolePermission ¶
func (*Edge) GetByIntersection1 ¶
func (*Edge) Once ¶
func (*Edge) Once(options ...EdgeAttributer) *Edge
func (*Edge) Set ¶
func (*Edge) Set(options ...EdgeAttributer) *Edge
type EdgeAttributer ¶
type EdgeAttributer interface {
Register(triangle *Edge)
}
func DB ¶
func DB(db *gorm.DB) EdgeAttributer
func GroupUUID ¶
func GroupUUID(face uuid.UUID) EdgeAttributer
func Intersection1 ¶
func Intersection1(intersection1 string) EdgeAttributer
func Intersection2 ¶
func Intersection2(intersection2 string) EdgeAttributer
func TablePrefix ¶
func TablePrefix(tablePrefix string) EdgeAttributer
type Group ¶
type Group struct {
RoleUUID uuid.UUID `gorm:"type:char(36);not null;primaryKey;comment:角色UUID;" json:"roleUUID"`
Role *Role `gorm:"foreignKey:role_uuid;references:uuid;" json:"role"`
PermissionUUID uuid.UUID `gorm:"type:char(36);not null;primaryKey;comment:权限UUID;" json:"permissionUUID"`
Permission *Permission `gorm:"foreignKey:permission_uuid;references:uuid;" json:"permission"`
}
func (Group) BindPermissions ¶
func (Group) BindPermissions(edge *Role, dots []*Permission) error
type Permission ¶
type Permission struct {
ID uint64 `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `gorm:"type:datetime;not null;default:CURRENT_TIMESTAMP;comment:新建时间" json:"createdAt"`
UpdatedAt time.Time `gorm:"type:datetime;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间" json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"deletedAt"`
UUID uuid.UUID `gorm:"type:char(36);not null;unique;comment:uuid;" json:"uuid"`
Name string `gorm:"type:varchar(50);not null;uniqueIndex;comment:权限名称" json:"name"`
Identity string `gorm:"type:varchar(255);not null;uniqueIndex;comment:权限标识" json:"identity"`
Faces []*Group `gorm:"foreignKey:dot_uuid;references:uuid;" json:"dot"`
}
func (Permission) DB ¶
func (Permission) DB() *gorm.DB
func (Permission) Destroy ¶
func (my Permission) Destroy() error
func (Permission) New ¶
func (Permission) New(attrs ...PermissionAttributer) Permission
func (Permission) Set ¶
func (my Permission) Set(attrs ...PermissionAttributer) Permission
func (Permission) Store ¶
func (my Permission) Store(options ...PermissionAttributer) error
func (Permission) TableName ¶
func (Permission) TableName() string
func (Permission) Update ¶
func (my Permission) Update(options ...PermissionAttributer) error
type PermissionAttributer ¶
type PermissionAttributer interface {
Register(permission *Permission)
}
func PermissionIdentity ¶
func PermissionIdentity(identity string) PermissionAttributer
func PermissionName ¶
func PermissionName(name string) PermissionAttributer
type Role ¶
type Role struct {
ID uint `gorm:"primaryKey;" json:"id"`
CreatedAt time.Time `gorm:"type:datetime;not null;default:CURRENT_TIMESTAMP;comment:新建时间" json:"createdAt"`
UpdatedAt time.Time `gorm:"type:datetime;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间" json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"deletedAt"`
UUID uuid.UUID `gorm:"type:char(36);not null;unique;comment:uuid;" json:"uuid"`
Name string `gorm:"type:varchar(255);not null;unique;comment:角色名称" json:"name"`
Groups []*Group `gorm:"foreignKey:group_uuid;references:uuid;" json:"groups"`
RBACs []*Edge `gorm:"foreignKey:group_uuid;references:uuid;" json:"rbacs"`
}
func (Role) GetDotsByUUID ¶
func (my Role) GetDotsByUUID(edgeUUID uuid.UUID) ([]Permission, error)
func (Role) GetDotsByUUIDs ¶
func (my Role) GetDotsByUUIDs(edgeUUIDs []uuid.UUID) ([]Permission, error)
func (Role) New ¶
func (Role) New(attrs ...RoleAttributer) Role
func (Role) Set ¶
func (my Role) Set(attrs ...RoleAttributer) Role
func (Role) Store ¶
func (my Role) Store(options ...RoleAttributer) error
func (Role) Update ¶
func (my Role) Update(attrs ...RoleAttributer) error
type RoleAttributer ¶
type RoleAttributer interface {
Register(role *Role)
}
func RoleName ¶
func RoleName(name string) RoleAttributer
Click to show internal directories.
Click to hide internal directories.