Documentation
¶
Overview ¶
Package access applies context-scoped policies and row-level access controls.
Index ¶
- func SoftDeleteColumn(table *schema.Table) *schema.Column
- func WithContext(parent context.Context, value Context) context.Context
- func WithPolicy(parent context.Context, policy Policy) context.Context
- type Context
- type Engine
- type FieldValue
- type MissingContextError
- type Operation
- type Policy
- type PolicyLevel
- type Predicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithContext ¶
WithContext stores access metadata in a parent context.
Types ¶
type Context ¶
type Context struct {
UserID any
CompanyID any
TenantID any
OrganizationID any
WorkspaceID any
WarehouseID any
Values map[string]any
Policy Policy
}
Context carries request-scoped access information for policy evaluation.
type FieldValue ¶
FieldValue represents a field assignment generated by access policy evaluation.
type MissingContextError ¶ added in v0.1.1
type MissingContextError struct {
Base *dormerrors.AccessError
Operation Operation
Field string
Reason string
}
MissingContextError reports a required access context value that was absent.
func (*MissingContextError) Error ¶ added in v0.1.1
func (e *MissingContextError) Error() string
func (*MissingContextError) Is ¶ added in v0.1.1
func (e *MissingContextError) Is(target error) bool
func (*MissingContextError) Unwrap ¶ added in v0.3.0
func (e *MissingContextError) Unwrap() error
type Operation ¶
type Operation string
Operation identifies the access engine operation being evaluated.
type Policy ¶ added in v0.1.1
type Policy struct {
Level PolicyLevel
}
Policy describes the active access policy for a request.
func IgnoreCompany ¶ added in v0.1.1
func IgnoreCompany() Policy
IgnoreCompany disables company-level filtering.
func IgnoreRLS ¶ added in v0.1.1
func IgnoreRLS() Policy
IgnoreRLS disables row-level security policies except soft delete.
func PolicyFromContext ¶ added in v0.1.1
PolicyFromContext extracts the current policy from a context.
func (Policy) AllowsScope ¶ added in v0.1.1
AllowsScope reports whether a scoped column is active under the policy.
func (Policy) EnforcesAudit ¶ added in v0.1.1
EnforcesAudit reports whether audit field injection remains active.
func (Policy) EnforcesSoftDelete ¶ added in v0.1.1
EnforcesSoftDelete reports whether soft delete remains active.
func (Policy) IsDefault ¶ added in v0.1.1
IsDefault reports whether the policy is the default policy.
func (Policy) IsSystem ¶ added in v0.1.1
IsSystem reports whether the policy disables all policy enforcement.
type PolicyLevel ¶ added in v0.1.1
type PolicyLevel string
PolicyLevel identifies a row-level access policy mode.
const ( PolicyLevelDefault PolicyLevel = "default" PolicyLevelIgnoreCompany PolicyLevel = "ignore_company" PolicyLevelIgnoreRLS PolicyLevel = "ignore_rls" PolicyLevelSystem PolicyLevel = "system" )