Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
GetObject(ctx context.Context, key string, value interface{}) error
SetObject(ctx context.Context, key string, value interface{}, expiration time.Duration) error
Delete(ctx context.Context, key string) error
}
Cache is the subset of the cache service used for policy caching.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service reads org policies, caches them in Redis (5-min TTL), and provides typed accessors for enforcement. Per D16 the effective policy is `org ∩ platform`; platform policies are injected via the PlatformPolicy field.
func New ¶
New constructs the PolicyService. cache may be nil (no caching, every call hits the DB) — useful for tests.
func (*Service) GetEffectivePolicy ¶
func (s *Service) GetEffectivePolicy(ctx context.Context, orgID string) (*types.OrgPolicyValues, error)
GetEffectivePolicy returns the org's policy intersected with the platform policy. When the org has no policy set, returns the platform policy alone. When neither is set, returns an empty (unrestricted) values struct.
func (*Service) InvalidateCache ¶
InvalidateCache evicts the cached policy for an org. Called after SetOrgPolicy or DeleteOrgPolicy so the next read picks up the change immediately.
func (*Service) SetPlatformPolicy ¶
func (s *Service) SetPlatformPolicy(p types.OrgPolicyValues)
SetPlatformPolicy sets the platform-wide policy floor. Per D16 the effective policy is the intersection of org and platform: org can only restrict further, never loosen. Called once at startup from instance settings.