store

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserSessions map[string]*models.UserSession

Functions

func BatchInsertPhonebookEntries added in v0.4.5

func BatchInsertPhonebookEntries(ctx context.Context, entries []*PhonebookEntry) (int, int, error)

BatchInsertPhonebookEntries inserts multiple phonebook entries in a transaction.

func GetUserCapabilities added in v0.4.5

func GetUserCapabilities(username string) (map[string]bool, error)

GetUserCapabilities returns all capabilities for a given username

func GetUserDisplayInfo added in v0.4.6

func GetUserDisplayInfo(username string) (string, []string, error)

GetUserDisplayInfo returns display name and phone numbers for a given user.

func InitPersistence added in v0.4.0

func InitPersistence(dataDir string)

InitPersistence sets up the persistence file path

func InitProfiles added in v0.4.5

func InitProfiles(profilesPath, usersPath string) error

InitProfiles loads profiles and users from JSON files

func LoadSessions added in v0.4.0

func LoadSessions() error

LoadSessions loads user sessions from disk

func RemoveAllJWTTokens added in v0.4.0

func RemoveAllJWTTokens(username string) error

func RemoveJWTToken added in v0.4.0

func RemoveJWTToken(username, tokenToRemove string) error

func RevokeLegacySession added in v0.4.0

func RevokeLegacySession(username string, userSession *models.UserSession)

RevokeLegacySession deletes the session entry and revokes legacy persistent token (subtype "user") Requires that userSession.JWTTokens is empty.

func SaveSessions added in v0.4.0

func SaveSessions() error

Saves current user sessions to disk

func UserSessionInit

func UserSessionInit() map[string]*models.UserSession

Types

type PersistedSession added in v0.4.0

type PersistedSession struct {
	Username     string   `json:"username"`
	JWTTokens    []string `json:"jwt_tokens"`
	NethCTIToken string   `json:"nethcti_token"`
}

PersistedSession represents minimal session data needed for persistence

type PhonebookEntry added in v0.4.5

type PhonebookEntry struct {
	ID             int64
	OwnerID        string
	Type           string
	HomeEmail      string
	WorkEmail      string
	HomePhone      string
	WorkPhone      string
	CellPhone      string
	Fax            string
	Title          string
	Company        string
	Notes          string
	Name           string
	HomeStreet     string
	HomePOB        string
	HomeCity       string
	HomeProvince   string
	HomePostalCode string
	HomeCountry    string
	WorkStreet     string
	WorkPOB        string
	WorkCity       string
	WorkProvince   string
	WorkPostalCode string
	WorkCountry    string
	URL            string
	Extension      string
	SpeedDialNum   string
}

PhonebookEntry represents a phonebook contact from cti_phonebook table.

type ProfileData added in v0.4.5

type ProfileData struct {
	ID           string
	Name         string
	Capabilities map[string]bool
}

ProfileData represents a profile with capability map

func GetUserProfile added in v0.4.5

func GetUserProfile(username string) (*ProfileData, error)

GetUserProfile returns the profile data for a given username

type ReloadStats added in v0.4.6

type ReloadStats struct {
	ProfilesLoaded int
	UsersLoaded    int
}

ReloadStats reports in-memory counters after a reload attempt.

func ReloadProfiles added in v0.4.5

func ReloadProfiles() (*ReloadStats, error)

ReloadProfiles reloads profiles and users and returns resulting counters.

type UserEndpoints added in v0.4.6

type UserEndpoints struct {
	MainExtension map[string]struct{}
	Extension     map[string]*UserExtension
	Voicemail     map[string]struct{}
	Email         map[string]struct{}
	Cellphone     map[string]struct{}
}

UserEndpoints contains endpoint data loaded from users.json.

type UserExtension added in v0.4.6

type UserExtension struct {
	Type     string
	User     string
	Password string
}

UserExtension stores details for a single extension endpoint.

type UserProfile added in v0.4.5

type UserProfile struct {
	Username     string
	Name         string
	ProfileID    string
	Endpoints    UserEndpoints
	PhoneNumbers []string
}

UserProfile links a username to a profile

Jump to

Keyboard shortcuts

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