2021-10-05 12:35:09 +00:00
|
|
|
package sso
|
|
|
|
|
2021-10-05 15:25:48 +00:00
|
|
|
// MailMapper is for connecting users to email accounts.
|
|
|
|
type MailMapper interface {
|
|
|
|
GetAssociatedAccounts() []*EmailAccount
|
|
|
|
NewAccount(newemail EmailAccount) error
|
|
|
|
DeleteAccount(address string) error
|
|
|
|
HasAccess(address string) bool
|
|
|
|
}
|
|
|
|
|
2021-10-05 12:35:09 +00:00
|
|
|
// EmailStorage represents where emails are stored for an EmailAccount.
|
|
|
|
type EmailStorage uint8
|
|
|
|
|
|
|
|
//goland:noinspection GoUnusedConst
|
|
|
|
const (
|
|
|
|
// MailDirStorage uses traditional Maildir format to store emails.
|
|
|
|
MailDirStorage EmailStorage = iota
|
|
|
|
// BitcaskMailStorage bitcask to store emails. (unimplemented)
|
|
|
|
BitcaskMailStorage
|
|
|
|
// PostgresMailStorage uses Postgresql to store emails. (unimplemented)
|
|
|
|
PostgresMailStorage
|
|
|
|
// TemporaryMailStorage stores temporary, disposable emails. (unimplemented)
|
|
|
|
TemporaryMailStorage
|
|
|
|
)
|
|
|
|
|
|
|
|
// EmailAccount represents an email inbox owned by a User. Aims to be partially compatible with Dovecot.
|
|
|
|
type EmailAccount struct {
|
|
|
|
// Domain is the internal email domain associated with this Maildir.
|
|
|
|
Domain string `json:"domain"`
|
2021-10-05 15:25:48 +00:00
|
|
|
// FriendlyName is the name shown by default when sending emails.
|
|
|
|
FriendlyName string `json:"friendly_name"`
|
2021-10-05 12:35:09 +00:00
|
|
|
// Quota is the maximum amount of email allowed to be stored in bytes. A quota of 0 means no quota.
|
|
|
|
Quota int `json:"quota"`
|
|
|
|
// Type represents the type of EmailStorage an email account uses.
|
|
|
|
Type EmailStorage `json:"storage"`
|
|
|
|
// DomainAdmin determines if the user has administrative permissions of the parent Domain.
|
|
|
|
DomainAdmin bool `json:"isadmin"`
|
|
|
|
|
|
|
|
// MaildirDetails represents an EmailAccount's maildir if applicable.
|
|
|
|
MaildirDetails Maildir `json:"maildir,omitempty"`
|
|
|
|
|
|
|
|
// BitcaskDetails represents an EmailAccount's BitcaskStore if applicable.
|
|
|
|
BitcaskDetails BitcaskStore `json:"bitcaskdb,omitempty"`
|
|
|
|
// BoltDetails represents an EmailAccount's BitcaskStore if applicable.
|
|
|
|
BoltDetails BoltStore `json:"boltdb,omitempty"`
|
|
|
|
}
|