services

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PermissionService

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

PermissionService handles permission checking for tickets and queues.

func NewPermissionService

func NewPermissionService(db *sql.DB) *PermissionService

NewPermissionService creates a new permission service.

func (*PermissionService) CanAddNote

func (s *PermissionService) CanAddNote(userID int, ticketID int64) (bool, error)

CanAddNote checks if a user can add notes to tickets in a queue. Requires 'note' or 'rw' permission.

func (*PermissionService) CanBeOwner

func (s *PermissionService) CanBeOwner(userID int, queueID int) (bool, error)

CanBeOwner checks if a user can be assigned as owner in a queue. Requires 'owner' or 'rw' permission.

func (*PermissionService) CanChangePriority

func (s *PermissionService) CanChangePriority(userID int, ticketID int64) (bool, error)

CanChangePriority checks if a user can change priority of tickets in a queue. Requires 'priority' or 'rw' permission.

func (*PermissionService) CanCreate

func (s *PermissionService) CanCreate(userID int, queueID int) (bool, error)

CanCreate checks if a user can create tickets in a queue. Requires 'create' or 'rw' permission.

func (*PermissionService) CanMoveInto

func (s *PermissionService) CanMoveInto(userID int, queueID int) (bool, error)

CanMoveInto checks if a user can move tickets into a queue. Requires 'move_into' or 'rw' permission.

func (*PermissionService) CanReadQueue

func (s *PermissionService) CanReadQueue(userID int, queueID int) (bool, error)

CanReadQueue checks if a user has at least read (ro) permission on a specific queue.

func (*PermissionService) CanReadTicket

func (s *PermissionService) CanReadTicket(userID int, ticketID int64) (bool, error)

CanReadTicket checks if a user has at least read (ro) permission on a ticket's queue. Returns true if the user has 'ro' OR 'rw' permission on the queue's group.

func (*PermissionService) CanWriteQueue

func (s *PermissionService) CanWriteQueue(userID int, queueID int) (bool, error)

CanWriteQueue checks if a user has write (rw) permission on a specific queue.

func (*PermissionService) CanWriteTicket

func (s *PermissionService) CanWriteTicket(userID int, ticketID int64) (bool, error)

CanWriteTicket checks if a user has write (rw) permission on a ticket's queue. Returns true if the user has 'rw' permission on the queue's group.

func (*PermissionService) CustomerCanAccessQueue

func (s *PermissionService) CustomerCanAccessQueue(customerLogin string, queueID int) (bool, error)

CustomerCanAccessQueue checks if a customer (by login) has access to a queue via group_customer_user. This is in addition to company-based access (customer_id on ticket).

func (*PermissionService) CustomerCanAccessTicket

func (s *PermissionService) CustomerCanAccessTicket(customerLogin, customerCompanyID string, ticketID int64) (bool, error)

CustomerCanAccessTicket checks if a customer can access a specific ticket. Access is granted if: 1. The ticket belongs to the customer's company (customer_id matches), OR 2. The customer user has explicit group access to the ticket's queue, OR 3. The customer's company has explicit group access to the ticket's queue

func (*PermissionService) CustomerCompanyCanAccessQueue

func (s *PermissionService) CustomerCompanyCanAccessQueue(customerID string, queueID int) (bool, error)

CustomerCompanyCanAccessQueue checks if a customer's company has access to a queue via group_customer.

func (*PermissionService) GetUserQueuePermissions

func (s *PermissionService) GetUserQueuePermissions(userID int) (map[int]string, error)

GetUserQueuePermissions returns all queues and permission levels for a user. Map key is queue_id, value is the highest permission level ('rw' > 'ro').

func (*PermissionService) HasPermission

func (s *PermissionService) HasPermission(userID int, queueID int, permKey string) (bool, error)

HasPermission checks if a user has a specific permission on a queue. Returns true if user has the exact permission OR has 'rw' (which supersedes all).

func (*PermissionService) HasTicketPermission

func (s *PermissionService) HasTicketPermission(userID int, ticketID int64, permKey string) (bool, error)

HasTicketPermission checks if a user has a specific permission on a ticket's queue.

func (*PermissionService) IsInGroup

func (s *PermissionService) IsInGroup(userID int, groupName string) (bool, error)

IsInGroup checks if a user is a member of a group by group name. Used for administrative access checks (e.g., "admin" group for MCP execute_sql).

Directories

Path Synopsis
Package acl provides the ACL (Access Control List) execution engine.
Package acl provides the ACL (Access Control List) execution engine.
Package adapter provides service adapters for database operations.
Package adapter provides service adapters for database operations.
Package database provides database service interfaces and implementations.
Package database provides database service interfaces and implementations.
Package escalation provides SLA escalation calculation and management.
Package escalation provides SLA escalation calculation and management.
Package genericagent provides the Generic Agent execution engine.
Package genericagent provides the Generic Agent execution engine.
Package k8s provides Kubernetes environment detection and integration.
Package k8s provides Kubernetes environment detection and integration.
Package registry provides service registration and lifecycle management.
Package registry provides service registration and lifecycle management.
Package scheduler provides task scheduling and job management.
Package scheduler provides task scheduling and job management.
Package ticket provides ticket domain models and business logic.
Package ticket provides ticket domain models and business logic.
Package ticketattributerelations provides management of ticket attribute relationships.
Package ticketattributerelations provides management of ticket attribute relationships.
Package user provides user domain models and management.
Package user provides user domain models and management.

Jump to

Keyboard shortcuts

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