Documentation
¶
Index ¶
- Variables
- func BatchInsertPhonebookEntries(ctx context.Context, entries []*PhonebookEntry) (int, int, error)
- func GetUserCapabilities(username string) (map[string]bool, error)
- func InitPersistence(dataDir string)
- func InitProfiles(profilesPath, usersPath string) error
- func LoadSessions() error
- func ReloadProfiles() error
- func RemoveAllJWTTokens(username string) error
- func RemoveJWTToken(username, tokenToRemove string) error
- func RevokeLegacySession(username string, userSession *models.UserSession)
- func SaveSessions() error
- func UserSessionInit() map[string]*models.UserSession
- type PersistedSession
- type PhonebookEntry
- type ProfileData
- type UserProfile
Constants ¶
This section is empty.
Variables ¶
var UserSessions map[string]*models.UserSession
Functions ¶
func BatchInsertPhonebookEntries ¶ added in v0.4.5
BatchInsertPhonebookEntries inserts multiple phonebook entries in a transaction.
func GetUserCapabilities ¶ added in v0.4.5
GetUserCapabilities returns all capabilities for a given username
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
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 ReloadProfiles ¶ added in v0.4.5
func ReloadProfiles() error
ReloadProfiles reloads profiles and users from JSON files, keeping old data on failure
func RemoveAllJWTTokens ¶ added in v0.4.0
func RemoveJWTToken ¶ added in v0.4.0
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 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
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 UserProfile ¶ added in v0.4.5
UserProfile links a username to a profile