Documentation
¶
Index ¶
- type AccountManager
- func (acm *AccountManager[T]) Delete(ctx context.Context, uid string) (bool, error)
- func (acm *AccountManager[T]) Disable(ctx context.Context, uid string) error
- func (acm *AccountManager[T]) Enable(ctx context.Context, uid string) error
- func (acm *AccountManager[T]) Get(ctx context.Context, uid string) (*UserAccount[T], error)
- func (acm *AccountManager[T]) GetAccount(ctx context.Context, user *models.User) (account *T, err error)
- func (acm *AccountManager[T]) New(ctx context.Context, newUser *UserAccount[T]) (*UserAccount[T], error)
- type UserAccount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountManager ¶
type AccountManager[T any] struct { // The Datatype that is managing the additional information for the account DT datastore.Datatype[T] // The User Manager (third-party) that is responsible for the management of the user Users cloudy.UserManager // Function that retrieves the account it from the user object (like the email or upn) GetAccountId func(ctx context.Context, User *models.User) string // Function that can take an account and generate / augment all the necessary information // in the user. For instance. If the primary place to store the user name is in the Account // then this method would copy the name from the account to the user when it changes. // that way the user account is always correct. // The bool return indicated if any changes were made that need to be saved SyncUserToAccount func(ctx context.Context, Account *T, User *models.User) (bool, error) // Opposite of the SyncUserToAccount function // The bool return indicated if any changes were made that need to be saved SyncAccountToUser func(ctx context.Context, Account *T, User *models.User) (bool, error) // Determines if this manager should create missing accounts. If the missing account creation // is enabled then when a user is found without an account then the account will be created, // synced with the user and then saved CreateMissingAccount bool // Opposite of the SyncUserToAccount function // The bool return indicated if any changes were made that need to be saved NewAccount func(ctx context.Context, User *models.User) (*T, error) // OnEnable (Optional) Called after the user manager enables a user, this is a hook // to do extra processing on the account OnEnable func(ctx context.Context, Account *T, User *models.User) error // OnDisable (Optional) Called after the user manager disables a user, this is a hook // to do extra processing on the account OnDisable func(ctx context.Context, Account *T, User *models.User) error }
An AccountManager is a composite manager that handles the use case of having an identity store (like AWS cognito) and a locally managed user database for more enhanced information This manager helps tie both together.
func (*AccountManager[T]) Disable ¶
func (acm *AccountManager[T]) Disable(ctx context.Context, uid string) error
func (*AccountManager[T]) Enable ¶
func (acm *AccountManager[T]) Enable(ctx context.Context, uid string) error
func (*AccountManager[T]) Get ¶
func (acm *AccountManager[T]) Get(ctx context.Context, uid string) (*UserAccount[T], error)
Retrieves a specific user account.
func (*AccountManager[T]) GetAccount ¶
func (*AccountManager[T]) New ¶
func (acm *AccountManager[T]) New(ctx context.Context, newUser *UserAccount[T]) (*UserAccount[T], error)
Creates a new User account. This is created in the Data store and the third party system
type UserAccount ¶
Click to show internal directories.
Click to hide internal directories.