Documentation ¶
Index ¶
- func GetCustomDeptFromCtx(ctx context.Context) ([]uint64, error)
- func GetFilterFieldFromCtx(ctx context.Context) (string, error)
- func GetRoleCustomDeptDataPermRedisKey(roleCodes []string) string
- func GetRoleScopeDataPermRedisKey(roleCodes []string) string
- func GetScopeFromCtx(ctx context.Context) (uint8, error)
- func GetSubDeptDataPermRedisKey(departmentId uint64) string
- func GetSubDeptFromCtx(ctx context.Context) ([]uint64, error)
- func WithCustomDeptContext(ctx context.Context, deptIds string) context.Context
- func WithFilterFieldContext(ctx context.Context, filterField string) context.Context
- func WithScopeContext(ctx context.Context, scope string) context.Context
- func WithSubDeptContext(ctx context.Context, deptIds string) context.Context
- type DataPermKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCustomDeptFromCtx ¶
GetCustomDeptFromCtx returns custom department ids from context
func GetFilterFieldFromCtx ¶
GetFilterFieldFromCtx returns filter field from context
func GetRoleCustomDeptDataPermRedisKey ¶
GetRoleCustomDeptDataPermRedisKey returns the key to store role custom department data into redis
func GetRoleScopeDataPermRedisKey ¶
GetRoleScopeDataPermRedisKey returns the key to store role data scope into redis
func GetScopeFromCtx ¶
GetScopeFromCtx returns data scope from context.
func GetSubDeptDataPermRedisKey ¶
GetSubDeptDataPermRedisKey returns the key to store sub department data into redis
func GetSubDeptFromCtx ¶
GetSubDeptFromCtx returns sub department ids from context
func WithCustomDeptContext ¶
WithCustomDeptContext returns context with custom department ids
func WithFilterFieldContext ¶
WithFilterFieldContext returns context with filter field
func WithScopeContext ¶
WithScopeContext returns context with data scope
Types ¶
type DataPermKey ¶
type DataPermKey string
const ( // ScopeKey is the key to store data scope ScopeKey DataPermKey = "data-perm-scope" // CustomDeptKey is the key to store custom department ids CustomDeptKey DataPermKey = "data-perm-custom-dept" // SubDeptKey is the key to store sub department ids SubDeptKey DataPermKey = "data-perm-sub-dept" // FilterFieldKey is the key to store filter field FilterFieldKey DataPermKey = "data-perm-filter-field" )