Documentation ¶
Index ¶
- Constants
- Variables
- type Organization
- type OrganizationRepository
- type OrganizationRepositoryImpl
- func (o OrganizationRepositoryImpl) All() ([]Organization, error)
- func (o OrganizationRepositoryImpl) Delete(organizationId string)
- func (o OrganizationRepositoryImpl) FindById(organizationIdOrName string) (*Organization, error)
- func (o OrganizationRepositoryImpl) Save(org *Organization) error
- func (o OrganizationRepositoryImpl) Update(org Organization)
- func (o OrganizationRepositoryImpl) UserHasOrganization(userId string, organizationId string) (bool, error)
- type OrganizationType
- type OrganizationUser
- type User
- func (u User) GetArbitrary() map[string]string
- func (u User) GetAttemptCount() int
- func (u User) GetConfirmSelector() string
- func (u User) GetConfirmVerifier() string
- func (u User) GetConfirmed() bool
- func (u User) GetEmail() string
- func (u User) GetLastAttempt() time.Time
- func (u User) GetLocked() time.Time
- func (u User) GetOAuth2AccessToken() (token string)
- func (u User) GetOAuth2Expiry() (expiry time.Time)
- func (u User) GetOAuth2Provider() (provider string)
- func (u User) GetOAuth2RefreshToken() (refreshToken string)
- func (u User) GetOAuth2UID() (uid string)
- func (u User) GetPID() string
- func (u User) GetPassword() string
- func (u User) GetRecoverExpiry() time.Time
- func (u User) GetRecoverSelector() string
- func (u User) GetRecoverVerifier() string
- func (u User) GetRecoveryCodes() string
- func (u User) GetSMSPhoneNumber() string
- func (u User) GetSMSPhoneNumberSeed() string
- func (u User) GetTOTPSecretKey() string
- func (u User) IsOAuth2User() bool
- func (u *User) PutArbitrary(values map[string]string)
- func (u *User) PutAttemptCount(attempts int)
- func (u *User) PutConfirmSelector(confirmSelector string)
- func (u *User) PutConfirmVerifier(confirmVerifier string)
- func (u *User) PutConfirmed(confirmed bool)
- func (u *User) PutEmail(email string)
- func (u *User) PutLastAttempt(last time.Time)
- func (u *User) PutLocked(locked time.Time)
- func (u *User) PutOAuth2AccessToken(token string)
- func (u *User) PutOAuth2Expiry(expiry time.Time)
- func (u *User) PutOAuth2Provider(provider string)
- func (u *User) PutOAuth2RefreshToken(refreshToken string)
- func (u *User) PutOAuth2UID(uid string)
- func (u *User) PutPID(pid string)
- func (u *User) PutPassword(password string)
- func (u *User) PutRecoverExpiry(expiry time.Time)
- func (u *User) PutRecoverSelector(token string)
- func (u *User) PutRecoverVerifier(token string)
- func (u *User) PutRecoveryCodes(key string)
- func (u *User) PutSMSPhoneNumber(key string)
- func (u *User) PutTOTPSecretKey(key string)
- type UserStore
- func (s *UserStore) AddRememberToken(_ context.Context, pid, token string) error
- func (s *UserStore) Create(_ context.Context, user authboss.User) error
- func (s *UserStore) DelRememberTokens(_ context.Context, pid string) error
- func (s *UserStore) GetUserObject(pid string) (*User, error)
- func (s *UserStore) Load(_ context.Context, key string) (user authboss.User, err error)
- func (s *UserStore) LoadByConfirmSelector(_ context.Context, selector string) (user authboss.ConfirmableUser, err error)
- func (s *UserStore) LoadByRecoverSelector(_ context.Context, selector string) (user authboss.RecoverableUser, err error)
- func (s *UserStore) New(_ context.Context) authboss.User
- func (s *UserStore) NewFromOAuth2(_ context.Context, provider string, details map[string]string) (authboss.OAuth2User, error)
- func (s *UserStore) Save(_ context.Context, user authboss.User) error
- func (s *UserStore) SaveOAuth2(_ context.Context, user authboss.OAuth2User) error
- func (s *UserStore) UseRememberToken(_ context.Context, token string) error
Constants ¶
const ( OrganizationTypePersonal OrganizationType = "personal" OrganizationTypeTeam = "team" OrganizationTypeBusiness = "business" )
Variables ¶
var (
ErrDuplicateEmail = errors.New("duplicate email")
)
Functions ¶
This section is empty.
Types ¶
type Organization ¶
type Organization struct { ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid()" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `sql:"index" json:"deleted_at"` Name string `json:"name" gorm:"index:idx_name,unique;not_null"` Type OrganizationType `json:"type"` Users []*User `json:"-" gorm:"many2many:organization_users;"` // Features for the organization AllowAutoCreateWorkspace bool `json:"allow_auto_create_workspace"` DefaultAgentId uuid.UUID `json:"default_agent_id"` }
type OrganizationRepository ¶
type OrganizationRepository interface { Save(org *Organization) error Update(org Organization) Delete(organizationId string) FindById(organizationId string) (*Organization, error) UserHasOrganization(userId string, organizationId string) (bool, error) All() ([]Organization, error) }
func NewOrganizationRepository ¶
func NewOrganizationRepository(db *gorm.DB) OrganizationRepository
type OrganizationRepositoryImpl ¶
func (OrganizationRepositoryImpl) All ¶
func (o OrganizationRepositoryImpl) All() ([]Organization, error)
func (OrganizationRepositoryImpl) Delete ¶
func (o OrganizationRepositoryImpl) Delete(organizationId string)
func (OrganizationRepositoryImpl) FindById ¶
func (o OrganizationRepositoryImpl) FindById(organizationIdOrName string) (*Organization, error)
func (OrganizationRepositoryImpl) Save ¶
func (o OrganizationRepositoryImpl) Save(org *Organization) error
func (OrganizationRepositoryImpl) Update ¶
func (o OrganizationRepositoryImpl) Update(org Organization)
func (OrganizationRepositoryImpl) UserHasOrganization ¶ added in v1.6.0
func (o OrganizationRepositoryImpl) UserHasOrganization(userId string, organizationId string) (bool, error)
type OrganizationType ¶ added in v1.6.0
type OrganizationType string
type OrganizationUser ¶ added in v1.1.0
type User ¶ added in v1.0.3
type User struct { ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid()" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `sql:"index" json:"deleted_at"` Email string `gorm:"index:idx_email,unique"` Password string `gorm:"column:password"` Active bool `gorm:"column:active"` // Confirm ConfirmSelector string `gorm:"column:confirm_selector"` ConfirmVerifier string `gorm:"column:confirm_verifier"` Confirmed bool `gorm:"column:confirmed"` // Lock AttemptCount int `gorm:"column:attempt_count"` LastAttempt time.Time `gorm:"column:last_attempt"` Locked time.Time `gorm:"column:locked"` // Recover RecoverSelector string `gorm:"column:recover_selector"` RecoverVerifier string `gorm:"column:recover_verifier"` RecoverTokenExpiry time.Time `gorm:"column:recover_token_expiry"` // OAuth2 OAuth2UID string `gorm:"column:oauth2_uid"` OAuth2Provider string `gorm:"column:oauth2_provider"` OAuth2AccessToken string `gorm:"column:oauth2_access_token"` OAuth2RefreshToken string `gorm:"column:oauth2_refresh_token"` OAuth2Expiry time.Time `gorm:"column:oauth2_expiry"` // 2fa TOTPSecretKey string `gorm:"column:totp_secret_key"` SMSPhoneNumber string `gorm:"column:sms_phone_number"` SMSSeedPhoneNumber string `gorm:"column:sms_seed_phone_number"` RecoveryCodes string `gorm:"column:recovery_codes"` Organizations []*Organization `gorm:"many2many:organization_users;"` }
func (User) GetArbitrary ¶ added in v1.0.3
GetArbitrary from user
func (User) GetAttemptCount ¶ added in v1.0.3
GetAttemptCount from user
func (User) GetConfirmSelector ¶ added in v1.0.3
GetConfirmSelector from user
func (User) GetConfirmVerifier ¶ added in v1.0.3
GetConfirmVerifier from user
func (User) GetLastAttempt ¶ added in v1.0.3
GetLastAttempt from user
func (User) GetOAuth2AccessToken ¶ added in v1.0.3
GetOAuth2AccessToken from user
func (User) GetOAuth2Expiry ¶ added in v1.0.3
GetOAuth2Expiry from user
func (User) GetOAuth2Provider ¶ added in v1.0.3
GetOAuth2Provider from user
func (User) GetOAuth2RefreshToken ¶ added in v1.0.3
GetOAuth2RefreshToken from user
func (User) GetOAuth2UID ¶ added in v1.0.3
GetOAuth2UID from user
func (User) GetRecoverExpiry ¶ added in v1.0.3
GetRecoverExpiry from user
func (User) GetRecoverSelector ¶ added in v1.0.3
GetRecoverSelector from user
func (User) GetRecoverVerifier ¶ added in v1.0.3
GetRecoverVerifier from user
func (User) GetRecoveryCodes ¶ added in v1.0.3
GetRecoveryCodes from user
func (User) GetSMSPhoneNumber ¶ added in v1.0.3
GetSMSPhoneNumber from user
func (User) GetSMSPhoneNumberSeed ¶ added in v1.0.3
GetSMSPhoneNumberSeed from user
func (User) GetTOTPSecretKey ¶ added in v1.0.3
GetTOTPSecretKey from user
func (User) IsOAuth2User ¶ added in v1.0.3
IsOAuth2User returns true if the user was created with oauth2
func (*User) PutArbitrary ¶ added in v1.0.3
func (*User) PutAttemptCount ¶ added in v1.0.3
PutAttemptCount into user
func (*User) PutConfirmSelector ¶ added in v1.0.3
func (*User) PutConfirmVerifier ¶ added in v1.0.3
PutConfirmVerifier into user
func (*User) PutConfirmed ¶ added in v1.0.3
func (*User) PutLastAttempt ¶ added in v1.0.3
PutLastAttempt into user
func (*User) PutOAuth2AccessToken ¶ added in v1.0.3
PutOAuth2AccessToken into user
func (*User) PutOAuth2Expiry ¶ added in v1.0.3
PutOAuth2Expiry into user
func (*User) PutOAuth2Provider ¶ added in v1.0.3
PutOAuth2Provider into user
func (*User) PutOAuth2RefreshToken ¶ added in v1.0.3
PutOAuth2RefreshToken into user
func (*User) PutOAuth2UID ¶ added in v1.0.3
PutOAuth2UID into user
func (*User) PutPassword ¶ added in v1.0.3
func (*User) PutRecoverExpiry ¶ added in v1.0.3
PutRecoverExpiry into user
func (*User) PutRecoverSelector ¶ added in v1.0.3
PutRecoverSelector into user
func (*User) PutRecoverVerifier ¶ added in v1.0.3
PutRecoverVerifier into user
func (*User) PutRecoveryCodes ¶ added in v1.0.3
PutRecoveryCodes into user
func (*User) PutSMSPhoneNumber ¶ added in v1.0.3
PutSMSPhoneNumber into user
func (*User) PutTOTPSecretKey ¶ added in v1.0.3
PutTOTPSecretKey into user