acl

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package acl provides the ACL (Access Control List) execution engine. ACLs filter available options in ticket forms based on current context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Service)

Option configures the service.

func WithLogger

func WithLogger(l *log.Logger) Option

WithLogger sets a custom logger.

type Service

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

Service evaluates ACLs to filter available options.

func NewService

func NewService(db *sql.DB, opts ...Option) *Service

NewService creates a new ACL service.

func (*Service) FilterActions

func (s *Service) FilterActions(
	ctx context.Context,
	aclCtx *models.ACLContext,
	actions []string,
) ([]string, error)

FilterActions evaluates ACLs and filters available actions. This is a convenience method for filtering action buttons.

func (*Service) FilterOptions

func (s *Service) FilterOptions(
	ctx context.Context,
	aclCtx *models.ACLContext,
	returnType, returnSubType string,
	options map[int]string,
) (map[int]string, error)

FilterOptions evaluates ACLs and filters the available options. Parameters:

  • ctx: context for database operations
  • aclCtx: current ticket/user context for matching
  • returnType: what to filter (e.g., "Ticket", "Action")
  • returnSubType: specific field to filter (e.g., "State", "Queue", "Priority")
  • options: map of ID -> name for available options

Returns filtered map of ID -> name.

func (*Service) RefreshCache

func (s *Service) RefreshCache(ctx context.Context) error

RefreshCache reloads valid ACLs from the database.

Jump to

Keyboard shortcuts

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