This commit is contained in:
2026-02-11 17:46:22 +03:00
commit eacfacb13b
266 changed files with 51337 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
package authz
import "context"
type scopeKey string
const (
CtxDeptCodesKey scopeKey = "authz.dept_codes"
CtxPiyasaCodesKey scopeKey = "authz.piyasa_codes"
)
func WithDeptCodes(ctx context.Context, codes []string) context.Context {
return context.WithValue(ctx, CtxDeptCodesKey, codes)
}
func WithPiyasaCodes(ctx context.Context, codes []string) context.Context {
return context.WithValue(ctx, CtxPiyasaCodesKey, codes)
}
func GetDeptCodesFromCtx(ctx context.Context) []string {
if v := ctx.Value(CtxDeptCodesKey); v != nil {
if codes, ok := v.([]string); ok {
return codes
}
}
return nil
}
func GetPiyasaCodesFromCtx(ctx context.Context) []string {
if v := ctx.Value(CtxPiyasaCodesKey); v != nil {
if codes, ok := v.([]string); ok {
return codes
}
}
return nil
}