datapermctx

package
v1.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCustomDeptFromCtx

func GetCustomDeptFromCtx(ctx context.Context) ([]uint64, error)

GetCustomDeptFromCtx returns custom department ids from context

func GetFilterFieldFromCtx

func GetFilterFieldFromCtx(ctx context.Context) (string, error)

GetFilterFieldFromCtx returns filter field from context

func GetRoleCustomDeptDataPermRedisKey

func GetRoleCustomDeptDataPermRedisKey(roleCodes []string) string

GetRoleCustomDeptDataPermRedisKey returns the key to store role custom department data into redis

func GetRoleScopeDataPermRedisKey

func GetRoleScopeDataPermRedisKey(roleCodes []string) string

GetRoleScopeDataPermRedisKey returns the key to store role data scope into redis

func GetScopeFromCtx

func GetScopeFromCtx(ctx context.Context) (uint8, error)

GetScopeFromCtx returns data scope from context.

func GetSubDeptDataPermRedisKey

func GetSubDeptDataPermRedisKey(departmentId uint64) string

GetSubDeptDataPermRedisKey returns the key to store sub department data into redis

func GetSubDeptFromCtx

func GetSubDeptFromCtx(ctx context.Context) ([]uint64, error)

GetSubDeptFromCtx returns sub department ids from context

func GetTenantRoleCustomDeptDataPermRedisKey added in v1.5.0

func GetTenantRoleCustomDeptDataPermRedisKey(roleCodes []string, tenantId uint64) string

GetTenantRoleCustomDeptDataPermRedisKey returns the key to store tenant's role custom department data into redis

func GetTenantRoleScopeDataPermRedisKey added in v1.5.0

func GetTenantRoleScopeDataPermRedisKey(roleCodes []string, tenantId uint64) string

GetTenantRoleScopeDataPermRedisKey returns the key to store tenant's role data scope into redis

func GetTenantSubDeptDataPermRedisKey added in v1.5.0

func GetTenantSubDeptDataPermRedisKey(departmentId uint64, tenantId uint64) string

GetTenantSubDeptDataPermRedisKey returns the key to store tenant's sub department data into redis

func WithCustomDeptContext

func WithCustomDeptContext(ctx context.Context, deptIds string) context.Context

WithCustomDeptContext returns context with custom department ids

func WithFilterFieldContext

func WithFilterFieldContext(ctx context.Context, filterField string) context.Context

WithFilterFieldContext returns context with filter field

func WithScopeContext

func WithScopeContext(ctx context.Context, scope string) context.Context

WithScopeContext returns context with data scope

func WithSubDeptContext

func WithSubDeptContext(ctx context.Context, deptIds string) context.Context

WithSubDeptContext returns context with sub department ids

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL