authz_loader

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoadAuthzAllowList = errors.New("failed to load authz allow list for tenantID")
	ErrTenantNotExist     = errors.New("tenantID does not exist")
	ErrEmptyTenantID      = errors.New("tenantID cannot be empty")
)

Functions

This section is empty.

Types

type AuthzLoader

type AuthzLoader[
	Resource authz.APIResourceType | authz.RepoResourceType,
	Action authz.APIAction | authz.RepoAction,
] struct {
	TenantIDs    map[authz.TenantID]struct{} // Used as a cache for reload/adding new tenants
	AuthzHandler *authz.Handler[Resource, Action]

	Auditor *auditor.Auditor
	// contains filtered or unexported fields
}

func NewAPIAuthzLoader

func NewAPIAuthzLoader(
	ctx context.Context,
	repo repo.Repo,
	config *config.Config,
) *AuthzLoader[authz.APIResourceType, authz.APIAction]

func NewAuthzLoader

func NewAuthzLoader[
	ResourceType authz.APIResourceType | authz.RepoResourceType,
	Action authz.APIAction | authz.RepoAction,
](
	ctx context.Context,
	repo repo.Repo,
	config *config.Config,
	internalRolePolicies authz.RolePolicies[constants.InternalRole, ResourceType, Action],
	businessRolePolicies authz.RolePolicies[constants.BusinessRole, ResourceType, Action],
	resourceTypeActions map[ResourceType][]Action,
) *AuthzLoader[ResourceType, Action]

func NewRepoAuthzLoader

func NewRepoAuthzLoader(
	ctx context.Context,
	repo repo.Repo,
	config *config.Config,
) *AuthzLoader[authz.RepoResourceType, authz.RepoAction]

func (*AuthzLoader[Resource, Action]) LoadTenantAllowedActions added in v0.9.0

func (am *AuthzLoader[Resource, Action]) LoadTenantAllowedActions(ctx context.Context) error

func (*AuthzLoader[Resource, Action]) ReloadTenantAllowedActions added in v0.9.0

func (am *AuthzLoader[Resource, Action]) ReloadTenantAllowedActions(ctx context.Context) error

func (*AuthzLoader[Resource, Action]) ResetBusinessUserData added in v0.9.0

func (am *AuthzLoader[Resource, Action]) ResetBusinessUserData()

func (*AuthzLoader[Resource, Action]) StartAuthzDataRefresh

func (am *AuthzLoader[Resource, Action]) StartAuthzDataRefresh(
	ctx context.Context, interval time.Duration,
)

StartAuthzDataRefresh starts a background goroutine that refreshes the authorization data periodically

Jump to

Keyboard shortcuts

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