Documentation
¶
Index ¶
- func AddUserToGroup(groupKey, userEmail string, dbConf *db.DBConfigDef) error
- func CheckPasswordByUserId(userId, password string, identityRepo IdentityRepo) bool
- func CheckPasswordHash(password, hash string) bool
- func GetCurrentOrganizationUser(cu ContextUserManager, c context.Context) *dm.OrganizationUser
- func HashPassword(password string) (string, error)
- func ResetPassword(identityRepo IdentityRepo, secretKey string, message string, ...) error
- func SendResetPasswordEmail(emailBackend email.EmailBackend, secretKey string, user *dm.User, ...) error
- type AuthenticatedUser
- type AuthenticationInfo
- type AuthorizedUser
- type ContextUserManager
- type DBIdentityRepo
- func (repo *DBIdentityRepo) AddRoleToOrganizationUser(organizationUserId, roleKey string) error
- func (repo *DBIdentityRepo) CreateOrganization(name, slug string) (*dm.Organization, error)
- func (repo *DBIdentityRepo) CreateUser(email string, password string) (*dm.User, error)
- func (repo *DBIdentityRepo) CreateUserWithOrganization(email string, organizationName string, password string) (*dm.OrganizationUser, error)
- func (repo *DBIdentityRepo) GetAllUsers(limit int, offset int, search *string) ([]*dm.User, int)
- func (repo *DBIdentityRepo) GetOrganizationById(id string) *dm.Organization
- func (repo *DBIdentityRepo) GetOrganizationForUser(userId string, maybeOrganizationId string) (*dm.Organization, *dm.OrganizationUser)
- func (repo *DBIdentityRepo) GetOrganizationUserById(id string) *dm.OrganizationUser
- func (repo *DBIdentityRepo) GetOrganizationUsersByIds(ids []string) []*dm.OrganizationUser
- func (repo *DBIdentityRepo) GetOrganizationUsersForUsers(userIds []string) (userIdToOrgUser map[string]*dm.UserWithOrganizationUsers, err error)
- func (repo *DBIdentityRepo) GetOrganizationsByIds(ids []string) []*dm.Organization
- func (repo *DBIdentityRepo) GetUserByEmail(email string) *dm.User
- func (repo *DBIdentityRepo) GetUserById(id string) *dm.User
- func (repo *DBIdentityRepo) GetUserPassword(id string) string
- func (repo *DBIdentityRepo) GetUsersByIds(ids []string) []*dm.User
- func (repo *DBIdentityRepo) UpdateUserPassword(id string, password string) error
- func (repo *DBIdentityRepo) WithTransaction(tx *sql.Tx) db.DBRepo
- type IdentityRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddUserToGroup ¶
func AddUserToGroup(groupKey, userEmail string, dbConf *db.DBConfigDef) error
func CheckPasswordByUserId ¶
func CheckPasswordByUserId(userId, password string, identityRepo IdentityRepo) bool
func CheckPasswordHash ¶
func GetCurrentOrganizationUser ¶
func GetCurrentOrganizationUser(cu ContextUserManager, c context.Context) *dm.OrganizationUser
func HashPassword ¶
func ResetPassword ¶
func ResetPassword( identityRepo IdentityRepo, secretKey string, message string, newPassword string, ) error
func SendResetPasswordEmail ¶
func SendResetPasswordEmail( emailBackend email.EmailBackend, secretKey string, user *dm.User, identityRepo IdentityRepo, baseURL *url.URL, ) error
Types ¶
type AuthenticatedUser ¶
type AuthenticationInfo ¶
type AuthenticationInfo struct {
AuthenticatedUser *AuthenticatedUser
AuthorizedUser *AuthorizedUser
}
type AuthorizedUser ¶
type AuthorizedUser struct {
OrganizationUser *dm.OrganizationUser
}
type ContextUserManager ¶
type ContextUserManager interface {
// GetAuthenticationInfo returns the authentication info from the given context.
GetAuthenticationInfo(c context.Context) *AuthenticationInfo
// WithAuthenticationInfo returns a new context with the given authentication info.
WithAuthenticationInfo(c context.Context, authenticationInfo *AuthenticationInfo) context.Context
// SetAuthenticationInfo sets the given authentication info to the given context.
SetAuthenticationInfo(c context.Context, authenticationInfo *AuthenticationInfo)
}
type DBIdentityRepo ¶
func NewDBIdentityRepo ¶
func NewDBIdentityRepo(conn *sql.DB) *DBIdentityRepo
func (*DBIdentityRepo) AddRoleToOrganizationUser ¶
func (repo *DBIdentityRepo) AddRoleToOrganizationUser(organizationUserId, roleKey string) error
func (*DBIdentityRepo) CreateOrganization ¶
func (repo *DBIdentityRepo) CreateOrganization(name, slug string) (*dm.Organization, error)
func (*DBIdentityRepo) CreateUser ¶
func (*DBIdentityRepo) CreateUserWithOrganization ¶
func (repo *DBIdentityRepo) CreateUserWithOrganization( email string, organizationName string, password string, ) (*dm.OrganizationUser, error)
func (*DBIdentityRepo) GetAllUsers ¶
func (*DBIdentityRepo) GetOrganizationById ¶
func (repo *DBIdentityRepo) GetOrganizationById(id string) *dm.Organization
func (*DBIdentityRepo) GetOrganizationForUser ¶
func (repo *DBIdentityRepo) GetOrganizationForUser(userId string, maybeOrganizationId string) (*dm.Organization, *dm.OrganizationUser)
func (*DBIdentityRepo) GetOrganizationUserById ¶
func (repo *DBIdentityRepo) GetOrganizationUserById(id string) *dm.OrganizationUser
func (*DBIdentityRepo) GetOrganizationUsersByIds ¶
func (repo *DBIdentityRepo) GetOrganizationUsersByIds(ids []string) []*dm.OrganizationUser
func (*DBIdentityRepo) GetOrganizationUsersForUsers ¶
func (repo *DBIdentityRepo) GetOrganizationUsersForUsers(userIds []string) ( userIdToOrgUser map[string]*dm.UserWithOrganizationUsers, err error, )
func (*DBIdentityRepo) GetOrganizationsByIds ¶
func (repo *DBIdentityRepo) GetOrganizationsByIds(ids []string) []*dm.Organization
func (*DBIdentityRepo) GetUserByEmail ¶
func (repo *DBIdentityRepo) GetUserByEmail(email string) *dm.User
func (*DBIdentityRepo) GetUserById ¶
func (repo *DBIdentityRepo) GetUserById(id string) *dm.User
func (*DBIdentityRepo) GetUserPassword ¶
func (repo *DBIdentityRepo) GetUserPassword(id string) string
func (*DBIdentityRepo) GetUsersByIds ¶
func (repo *DBIdentityRepo) GetUsersByIds(ids []string) []*dm.User
func (*DBIdentityRepo) UpdateUserPassword ¶
func (repo *DBIdentityRepo) UpdateUserPassword(id string, password string) error
func (*DBIdentityRepo) WithTransaction ¶
func (repo *DBIdentityRepo) WithTransaction(tx *sql.Tx) db.DBRepo
type IdentityRepo ¶
type IdentityRepo interface {
CreateUserWithOrganization(email string, organizationName string, password string) (*dm.OrganizationUser, error)
CreateUser(email string, password string) (*dm.User, error)
AddRoleToOrganizationUser(organizationUserId string, roleKey string) error
GetUserById(id string) *dm.User
GetUsersByIds(ids []string) []*dm.User
GetUserByEmail(email string) *dm.User
// If maybeOrganizationId is not empty, it will be used as the organization ID.
// Otherwise, the implementation should guess the best organization ID for the user.
// E.g. if the user is a member of only one organization, that organization ID should be used.
// If the user is a member of multiple organizations, the implementation should return nil.
GetOrganizationForUser(userId string, maybeOrganizationId string) (*dm.Organization, *dm.OrganizationUser)
GetOrganizationUsersForUsers(userIds []string) (map[string]*dm.UserWithOrganizationUsers, error)
GetOrganizationUsersByIds(ids []string) []*dm.OrganizationUser
GetOrganizationUserById(id string) *dm.OrganizationUser
GetUserPassword(id string) string
UpdateUserPassword(id string, password string) error
// GetAllUsers returns a paginated list of users with optional search criteria.
GetAllUsers(limit int, offset int, search *string) ([]*dm.User, int)
}
Click to show internal directories.
Click to hide internal directories.