behaviours

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PolicyBehaviour

func PolicyBehaviour(ctx context.Context, request Policy, next mediatr.Next) (any, error)

Types

type AllowReason

type AllowReason interface {
	ImplementsAllowReason()
	GetReasonType() string
	IsServiceUserReason() bool
}

type AllowedByAnyone

type AllowedByAnyone struct{}

func NewAllowedByAnyone

func NewAllowedByAnyone() AllowedByAnyone

func (AllowedByAnyone) GetReasonType

func (a AllowedByAnyone) GetReasonType() string

func (AllowedByAnyone) ImplementsAllowReason

func (a AllowedByAnyone) ImplementsAllowReason()

func (AllowedByAnyone) IsServiceUserReason

func (a AllowedByAnyone) IsServiceUserReason() bool

func (AllowedByAnyone) String

func (a AllowedByAnyone) String() string

type AllowedByOwnership

type AllowedByOwnership struct{}

func NewAllowedByOwnership

func NewAllowedByOwnership() AllowedByOwnership

func (AllowedByOwnership) GetReasonType

func (a AllowedByOwnership) GetReasonType() string

func (AllowedByOwnership) ImplementsAllowReason

func (a AllowedByOwnership) ImplementsAllowReason()

func (AllowedByOwnership) IsServiceUserReason

func (a AllowedByOwnership) IsServiceUserReason() bool

func (AllowedByOwnership) String

func (a AllowedByOwnership) String() string

type AllowedByPermission

type AllowedByPermission struct {
	Permission  permissions.Permission
	SourceRoles []roles.Role
}

func NewAllowedByPermission

func NewAllowedByPermission(permission permissions.Permission, sourceRoles []roles.Role) AllowedByPermission

func (AllowedByPermission) GetReasonType

func (a AllowedByPermission) GetReasonType() string

func (AllowedByPermission) ImplementsAllowReason

func (a AllowedByPermission) ImplementsAllowReason()

func (AllowedByPermission) IsServiceUserReason

func (a AllowedByPermission) IsServiceUserReason() bool

func (AllowedByPermission) String

func (a AllowedByPermission) String() string

type AuditLogger

type AuditLogger interface {
	Log(ctx context.Context, policy Policy, policyResult PolicyResult, response any) error
}

type Policy

type Policy interface {
	IsAllowed(ctx context.Context) (PolicyResult, error)
	GetRequestName() string
	LogResponse() bool
	LogRequest() bool
}

type PolicyResult

type PolicyResult struct {
	// contains filtered or unexported fields
}

func Allowed

func Allowed(userId uuid.UUID, virtualServerId uuid.UUID, reason AllowReason) PolicyResult

func Denied

func Denied(userId uuid.UUID, virtualServerId uuid.UUID) PolicyResult

func PermissionBasedPolicy

func PermissionBasedPolicy(ctx context.Context, permission permissions.Permission) (PolicyResult, error)

func (PolicyResult) IsAllowed

func (p PolicyResult) IsAllowed() bool

func (PolicyResult) Reason

func (p PolicyResult) Reason() AllowReason

func (PolicyResult) UserId

func (p PolicyResult) UserId() uuid.UUID

func (PolicyResult) VirtualServerId

func (p PolicyResult) VirtualServerId() uuid.UUID

Jump to

Keyboard shortcuts

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