acl

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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