Documentation
¶
Index ¶
- Variables
- func AccountDisplayName(account *config.Account) string
- func AccountDisplayNameWithHost(account *config.Account) string
- func CheckBlockedBeforeConnect(client *api.Client, account *config.Account) error
- func EnsureOlmCredentials(client *api.Client, account *config.Account) (bool, error)
- func EnsureOrgAccess(client *api.Client, account *config.Account) error
- func FormatHostnameBaseURL(hostname string) string
- func PrintTable(headers []string, rows [][]string)
- func SelectOrgForm(client *api.Client, userID string) (string, error)
- func SwitchActiveClientOrg(orgID string) bool
- func UserDisplayName(user *api.User) string
Constants ¶
This section is empty.
Variables ¶
var ErrSudoRequired = errors.New("Please rerun this command as sudo. This is a one time thing for Pangolin to setup your machine.")
ErrSudoRequired is returned when the user needs to run the command as sudo for first-time setup
Functions ¶
func AccountDisplayName ¶
AccountDisplayName returns a display name for an account with precedence: email > name > username > "Account"
func AccountDisplayNameWithHost ¶
AccountDisplayNameWithHost returns a display name for an account with hostname suffix when multiple accounts might share the same email. Format: "displayName @ hostname"
func CheckBlockedBeforeConnect ¶
CheckBlockedBeforeConnect checks if the OLM is blocked before attempting to connect. This should only be called when the user attempts to connect, not during authentication. Returns an error if the account is blocked. If the check fails (network error, etc.), returns an error that the caller should log but allow the connection attempt to proceed (the server will reject if truly blocked).
func EnsureOlmCredentials ¶
EnsureOlmCredentials ensures that OLM credentials exist and are valid. It checks if OLM credentials exist locally, verifies them on the server, and creates new ones if they don't exist or are invalid.
If new ones are created, a "true" is returned to indicate we need to save the new credentials to disk.
func EnsureOrgAccess ¶
EnsureOrgAccess ensures that the user has access to the organization
func FormatHostnameBaseURL ¶
FormatHostnameBaseURL returns the hostname formatted as a base URL (with protocol, without /api/v1). This is useful for constructing URLs to the web interface.
func PrintTable ¶
PrintTable prints a column-aligned plain-text table minwidth=0, tabwidth=8, padding=2, padchar=' ', flags=0
func SelectOrgForm ¶
SelectOrgForm lists organizations for a user and prompts them to select one. It returns the selected org ID and any error. If the user has only one organization, it's automatically selected.
func SwitchActiveClientOrg ¶
SwitchActiveClientOrg checks if the OLM client is running and switches to the new org if so It returns true if a switch was attempted (regardless of success)
func UserDisplayName ¶
UserDisplayName returns a display name for a user with precedence: email > name > username > "User"
Types ¶
This section is empty.