Documentation ¶
Index ¶
- Variables
- type GormResolver
- func (g GormResolver) AddRolePerm(roleId uint, permId uint) error
- func (g GormResolver) CreatePerm(permInfo role.PermInfo) error
- func (g GormResolver) CreatePermInBatch(perms []role.PermInfo) error
- func (g GormResolver) CreateRole(roleInfo role.RoleInfo) error
- func (g GormResolver) CreateRoleInBatch(roles []role.RoleInfo) error
- func (g GormResolver) CreateRolePermBatch(roleInfo role.RoleInfo, perms []role.PermInfo) error
- func (g GormResolver) GetPerm(permId uint) (role.PermInfo, error)
- func (g GormResolver) GetPermInBatch(ids []uint, tag string) ([]role.PermInfo, error)
- func (g GormResolver) GetRole(roleId uint) (role.RoleInfo, error)
- func (g GormResolver) GetRoleByCode(code string) (role.RoleInfo, error)
- func (g GormResolver) GetRoleInBatch(roleIds []uint) ([]role.RoleInfo, error)
- func (g GormResolver) ListAllPerms(tag string) ([]role.PermInfo, error)
- func (g GormResolver) ListAllRole() ([]role.RoleInfo, error)
- func (g GormResolver) ListPerms(option role.PageOption) ([]role.PermInfo, error)
- func (g GormResolver) ListRole(option role.PageOption) ([]role.RoleInfo, error)
- func (g GormResolver) ListRolePerms(roleId uint) ([]role.PermGroup, error)
- func (g GormResolver) MatchPerm(name, obj, act, group, tag string) (role.PermInfo, error)
- func (g GormResolver) RemovePerm(permId uint) error
- func (g GormResolver) RemoveRole(roleId uint) error
- func (g GormResolver) RemoveRolePerm(roleId uint, permId uint) error
- func (g GormResolver) ResolveAny(permObj string, permAct string, roles ...string) error
- func (g GormResolver) UpdatePerm(permInfo role.PermInfo) error
- func (g GormResolver) UpdateRole(roleInfo role.RoleInfo) error
- func (g GormResolver) UpdateRolePermBatch(roleId uint, tag string, newPermIds []uint) error
- type Resolver
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type GormResolver ¶
type GormResolver struct {
// contains filtered or unexported fields
}
func NewGormResolver ¶
func NewGormResolver(db *gorm.DB) GormResolver
func (GormResolver) AddRolePerm ¶
func (g GormResolver) AddRolePerm(roleId uint, permId uint) error
func (GormResolver) CreatePerm ¶
func (g GormResolver) CreatePerm(permInfo role.PermInfo) error
func (GormResolver) CreatePermInBatch ¶
func (g GormResolver) CreatePermInBatch(perms []role.PermInfo) error
func (GormResolver) CreateRole ¶
func (g GormResolver) CreateRole(roleInfo role.RoleInfo) error
func (GormResolver) CreateRoleInBatch ¶
func (g GormResolver) CreateRoleInBatch(roles []role.RoleInfo) error
func (GormResolver) CreateRolePermBatch ¶
func (GormResolver) GetPermInBatch ¶
func (GormResolver) GetRoleByCode ¶
func (g GormResolver) GetRoleByCode(code string) (role.RoleInfo, error)
func (GormResolver) GetRoleInBatch ¶
func (g GormResolver) GetRoleInBatch(roleIds []uint) ([]role.RoleInfo, error)
func (GormResolver) ListAllPerms ¶
func (g GormResolver) ListAllPerms(tag string) ([]role.PermInfo, error)
func (GormResolver) ListAllRole ¶
func (g GormResolver) ListAllRole() ([]role.RoleInfo, error)
func (GormResolver) ListPerms ¶
func (g GormResolver) ListPerms(option role.PageOption) ([]role.PermInfo, error)
func (GormResolver) ListRole ¶
func (g GormResolver) ListRole(option role.PageOption) ([]role.RoleInfo, error)
func (GormResolver) ListRolePerms ¶
func (g GormResolver) ListRolePerms(roleId uint) ([]role.PermGroup, error)
func (GormResolver) MatchPerm ¶
func (g GormResolver) MatchPerm(name, obj, act, group, tag string) (role.PermInfo, error)
func (GormResolver) RemovePerm ¶
func (g GormResolver) RemovePerm(permId uint) error
func (GormResolver) RemoveRole ¶
func (g GormResolver) RemoveRole(roleId uint) error
func (GormResolver) RemoveRolePerm ¶
func (g GormResolver) RemoveRolePerm(roleId uint, permId uint) error
func (GormResolver) ResolveAny ¶
func (g GormResolver) ResolveAny(permObj string, permAct string, roles ...string) error
func (GormResolver) UpdatePerm ¶
func (g GormResolver) UpdatePerm(permInfo role.PermInfo) error
func (GormResolver) UpdateRole ¶
func (g GormResolver) UpdateRole(roleInfo role.RoleInfo) error
func (GormResolver) UpdateRolePermBatch ¶
func (g GormResolver) UpdateRolePermBatch(roleId uint, tag string, newPermIds []uint) error
type Resolver ¶
type Resolver interface { GetPerm(permId uint) (role.PermInfo, error) GetPermInBatch(permIds []uint, tag string) ([]role.PermInfo, error) MatchPerm(name, obj, act, group, tag string) (role.PermInfo, error) CreatePerm(permInfo role.PermInfo) error CreatePermInBatch(permInfo []role.PermInfo) error ListPerms(option role.PageOption) ([]role.PermInfo, error) ListAllPerms(tag string) ([]role.PermInfo, error) UpdatePerm(permInfo role.PermInfo) error RemovePerm(permId uint) error GetRole(roleId uint) (role.RoleInfo, error) GetRoleInBatch(roleIds []uint) ([]role.RoleInfo, error) GetRoleByCode(code string) (role.RoleInfo, error) ListRole(option role.PageOption) ([]role.RoleInfo, error) ListAllRole() ([]role.RoleInfo, error) CreateRole(roleInfo role.RoleInfo) error CreateRoleInBatch(roleInfo []role.RoleInfo) error UpdateRole(roleInfo role.RoleInfo) error RemoveRole(roleId uint) error // ListRolePerms list all permissions belonging to specified role ListRolePerms(roleId uint) ([]role.PermGroup, error) // AddRolePerm add new permission to specified role AddRolePerm(roleId uint, permId uint) error // RemoveRolePerm remove specified permission from specified role RemoveRolePerm(roleId uint, permId uint) error // UpdateRolePermBatch update specified role permissions in batch // it will add and remove some permissions to make the records sync with the incoming permIds // if there are some permissions not in permission record which is result of ListAllPerms, it will return error UpdateRolePermBatch(roleId uint, tag string, permIds []uint) error CreateRolePermBatch(roles role.RoleInfo, perms []role.PermInfo) error // ResolveAny judge specified role if any role is able to access permObj by the way of permAct ResolveAny(permObj string, permAct string, roles ...string) error }
Click to show internal directories.
Click to hide internal directories.