Documentation ¶
Index ¶
- func GetPermissionActionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetPermissionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetPermissionResourceDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetRolePermissionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetUserDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetUserRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- type Permission
- type PermissionAction
- type PermissionActions
- type PermissionResource
- type PermissionResources
- type Permissions
- type Role
- type RolePermission
- type RolePermissions
- type Roles
- type SchemaPermission
- type SchemaPermissionAction
- type SchemaPermissionResource
- type SchemaRole
- type SchemaRolePermission
- type SchemaUser
- type User
- type UserRole
- type UserRoles
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPermissionActionDB ¶
GetPermissionActionDB - Get permission action storage
func GetPermissionDB ¶
GetPermissionDB - Get permission storage
func GetPermissionResourceDB ¶
GetPermissionResourceDB - Get permission resource storage
func GetRolePermissionDB ¶
GetRolePermissionDB - Get the role permission associative storage
Types ¶
type Permission ¶
type Permission struct { entity.Model UUID string `gorm:"column:record_id;size:36;index;"` // Record internal code Name *string `gorm:"column:name;size:50;index;"` // Permission name Sequence *int `gorm:"column:sequence;index;"` // Sort value Icon *string `gorm:"column:icon;size:255;"` // Permission icon Router *string `gorm:"column:router;size:255;"` // Access routing Hidden *int `gorm:"column:hidden;index;"` // Hide permission (0: don't hide 1: hide) ParentID *string `gorm:"column:parent_id;size:36;index;"` // Parent inner code ParentPath *string `gorm:"column:parent_path;size:518;index;"` // Parent path Creator *string `gorm:"column:creator;size:36;"` // Creator }
Permission - Permission entity
func (Permission) String ¶
func (a Permission) String() string
func (Permission) ToSchemaPermission ¶
func (a Permission) ToSchemaPermission() *schema.Permission
ToSchemaPermission - Convert to permission object
type PermissionAction ¶
type PermissionAction struct { entity.Model PermissionID string `gorm:"column:permission_id;size:36;index;"` // Permission ID Code string `gorm:"column:code;size:50;index;"` // Action number Name string `gorm:"column:name;size:50;"` // Action name }
PermissionAction - Permission action associated entity
func (PermissionAction) TableName ¶
func (a PermissionAction) TableName() string
TableName - Table Name
func (PermissionAction) ToSchemaPermissionAction ¶
func (a PermissionAction) ToSchemaPermissionAction() *schema.PermissionAction
ToSchemaPermissionAction - Convert to permission action object
type PermissionActions ¶
type PermissionActions []*PermissionAction
PermissionActions - Permission action associated entity list
func (PermissionActions) GetByPermissionID ¶
func (a PermissionActions) GetByPermissionID(permissionID string) []*schema.PermissionAction
GetByPermissionID - Get permission action list based on permission ID
func (PermissionActions) ToMap ¶
func (a PermissionActions) ToMap() map[string]*PermissionAction
ToMap - Convert to key-value mapping
func (PermissionActions) ToSchemaPermissionActions ¶
func (a PermissionActions) ToSchemaPermissionActions() []*schema.PermissionAction
ToSchemaPermissionActions - Convert to permission action list
type PermissionResource ¶
type PermissionResource struct { entity.Model PermissionID string `gorm:"column:permission_id;size:36;index;"` // Permission ID Code string `gorm:"column:code;size:50;index;"` // Resource number Name string `gorm:"column:name;size:50;"` // Resource Name Method string `gorm:"column:method;size:50;"` // Request method Path string `gorm:"column:path;size:255;"` // Request path }
PermissionResource - Permission resource associated entity
func (PermissionResource) TableName ¶
func (a PermissionResource) TableName() string
TableName - Table Name
func (PermissionResource) ToSchemaPermissionResource ¶
func (a PermissionResource) ToSchemaPermissionResource() *schema.PermissionResource
ToSchemaPermissionResource - Convert to permission resource object
type PermissionResources ¶
type PermissionResources []*PermissionResource
PermissionResources - Permission resource associated entity list
func (PermissionResources) GetByPermissionID ¶
func (a PermissionResources) GetByPermissionID(permissionID string) []*schema.PermissionResource
GetByPermissionID - Get permission resource list according to permission ID
func (PermissionResources) ToMap ¶
func (a PermissionResources) ToMap() map[string]*PermissionResource
ToMap - Convert to key-value mapping
func (PermissionResources) ToSchemaPermissionResources ¶
func (a PermissionResources) ToSchemaPermissionResources() []*schema.PermissionResource
ToSchemaPermissionResources - Convert to permission resource list
type Permissions ¶
type Permissions []*Permission
Permissions - Permission entity list
func (Permissions) ToSchemaPermissions ¶
func (a Permissions) ToSchemaPermissions() []*schema.Permission
ToSchemaPermissions - Convert to permission object list
type Role ¶
type Role struct { entity.Model UUID string `gorm:"column:record_id;size:36;index;"` // Record internal code Name *string `gorm:"column:name;size:100;index;"` // Role Name Sequence *int `gorm:"column:sequence;index;"` // Sort value Memo *string `gorm:"column:memo;size:200;"` // Remarks Creator *string `gorm:"column:creator;size:36;"` // Creator }
Role - Role entity
func (Role) ToSchemaRole ¶
ToSchemaRole - Convert to a role object
type RolePermission ¶
type RolePermission struct { entity.Model RoleID string `gorm:"column:role_id;size:36;index;"` // Role inner code PermissionID string `gorm:"column:permission_id;size:36;index;"` // Permission internal code Action *string `gorm:"column:action;size:2048;"` // Action permissions (multiple separated by commas) Resource *string `gorm:"column:resource;size:2048;"` // Resource permissions (multiple separated by commas) }
RolePermission - Role permission associated entity
func (RolePermission) ToSchemaRolePermission ¶
func (a RolePermission) ToSchemaRolePermission() *schema.RolePermission
ToSchemaRolePermission - Convert to a role permission object
type RolePermissions ¶
type RolePermissions []*RolePermission
RolePermissions - Role permission associated entity list
func (RolePermissions) GetByRoleID ¶
func (a RolePermissions) GetByRoleID(roleID string) []*schema.RolePermission
GetByRoleID - Get a list of role permission objects based on the role ID
func (RolePermissions) ToMap ¶
func (a RolePermissions) ToMap() map[string]*RolePermission
ToMap - Convert to key-value mapping
func (RolePermissions) ToSchemaRolePermissions ¶
func (a RolePermissions) ToSchemaRolePermissions() []*schema.RolePermission
ToSchemaRolePermissions - Convert to a list of role permission objects
type Roles ¶
type Roles []*Role
Roles - List of role entities
func (Roles) ToSchemaRoles ¶
ToSchemaRoles - Convert to a list of role objects
type SchemaPermission ¶
type SchemaPermission schema.Permission
SchemaPermission - Permission object
func (SchemaPermission) ToPermission ¶
func (a SchemaPermission) ToPermission() *Permission
ToPermission - Convert to permission entity
func (SchemaPermission) ToPermissionActions ¶
func (a SchemaPermission) ToPermissionActions() []*PermissionAction
ToPermissionActions - Convert to permission action list
func (SchemaPermission) ToPermissionResources ¶
func (a SchemaPermission) ToPermissionResources() []*PermissionResource
ToPermissionResources - Convert to permission resource list
type SchemaPermissionAction ¶
type SchemaPermissionAction schema.PermissionAction
SchemaPermissionAction Permission action object
func (SchemaPermissionAction) ToPermissionAction ¶
func (a SchemaPermissionAction) ToPermissionAction(permissionID string) *PermissionAction
ToPermissionAction - Convert to permission action entity
type SchemaPermissionResource ¶
type SchemaPermissionResource schema.PermissionResource
SchemaPermissionResource - Permission resource object
func (SchemaPermissionResource) ToPermissionResource ¶
func (a SchemaPermissionResource) ToPermissionResource(permissionID string) *PermissionResource
ToPermissionResource - Convert to permission resource entity
type SchemaRole ¶
SchemaRole - Role object
func (SchemaRole) ToRolePermissions ¶
func (a SchemaRole) ToRolePermissions() []*RolePermission
ToRolePermissions - Convert to role permission entity list
type SchemaRolePermission ¶
type SchemaRolePermission schema.RolePermission
SchemaRolePermission - Role permission object
func (SchemaRolePermission) ToRolePermission ¶
func (a SchemaRolePermission) ToRolePermission(roleID string) *RolePermission
ToRolePermission - Convert to role permission entity
type SchemaUser ¶
SchemaUser - User object
func (SchemaUser) ToUserRoles ¶
func (a SchemaUser) ToUserRoles() []*UserRole
ToUserRoles - Convert to user role association list
type User ¶
type User struct { entity.Model UUID string `gorm:"column:record_id;size:36;index;"` // Record internal code UserName *string `gorm:"column:user_name;size:64;index;"` // UserName RealName *string `gorm:"column:real_name;size:64;index;"` // RealName Password *string `gorm:"column:password;size:40;"` // Password (sha1 (md5 (plain text)) encryption) Email *string `gorm:"column:email;not null;unique"` // Email Phone *string `gorm:"column:phone;size:20;index;"` // Phone Status *int `gorm:"column:status;index;"` // Status (1: Enable 2: Disable) Creator *string `gorm:"column:creator;size:36;"` // Creator }
User - User entity
func (User) ToSchemaUser ¶
ToSchemaUser - Convert to user object
type UserRole ¶
type UserRole struct { entity.Model UserUUID string `gorm:"column:user_uuid;size:36;index;"` // User ID RoleID string `gorm:"column:role_id;size:36;index;"` // Role ID }
UserRole - User role association entity
func (UserRole) ToSchemaUserRole ¶
ToSchemaUserRole - Convert to user role object
type UserRoles ¶
type UserRoles []*UserRole
UserRoles - User role association list
func (UserRoles) GetByUserUUID ¶
GetByUserUUID - Get the list of user role objects based on the user ID
func (UserRoles) ToSchemaUserRoles ¶
ToSchemaUserRoles - Convert to a list of user role objects