Documentation ¶
Index ¶
- Variables
- func Init(p InitParams) (*User, *Team, error)
- func MockGenerateVerificationCode(code string) func()
- func MockNow(t time.Time) func()
- func ValidatePasswordFormat(pass string) error
- type Auth
- type BcryptPasswordEncoder
- type Builder
- func (b *Builder) Auths(auths []Auth) *Builder
- func (b *Builder) Build() (*User, error)
- func (b *Builder) Email(email string) *Builder
- func (b *Builder) EncodedPassword(p EncodedPassword) *Builder
- func (b *Builder) ID(id ID) *Builder
- func (b *Builder) Lang(lang language.Tag) *Builder
- func (b *Builder) LangFrom(lang string) *Builder
- func (b *Builder) MustBuild() *User
- func (b *Builder) Name(name string) *Builder
- func (b *Builder) NewID() *Builder
- func (b *Builder) PasswordPlainText(p string) *Builder
- func (b *Builder) PasswordReset(pr *PasswordReset) *Builder
- func (b *Builder) Team(team TeamID) *Builder
- func (b *Builder) Theme(t Theme) *Builder
- func (b *Builder) Verification(v *Verification) *Builder
- type EncodedPassword
- type ID
- type InitParams
- type Members
- func (m *Members) ContainsUser(u ID) bool
- func (m *Members) Count() int
- func (m *Members) Fixed() bool
- func (m *Members) GetRole(u ID) Role
- func (m *Members) IsOnlyOwner(u ID) bool
- func (m *Members) Join(u ID, role Role) error
- func (m *Members) Leave(u ID) error
- func (m *Members) Members() map[ID]Role
- func (m *Members) UpdateRole(u ID, role Role) error
- func (m *Members) UsersByRole(role Role) []ID
- type MockPasswordEncoder
- type NoopPasswordEncoder
- type PasswordEncoder
- type PasswordReset
- type Role
- type Team
- type TeamBuilder
- func (b *TeamBuilder) Build() (*Team, error)
- func (b *TeamBuilder) ID(id TeamID) *TeamBuilder
- func (b *TeamBuilder) Members(members map[ID]Role) *TeamBuilder
- func (b *TeamBuilder) MustBuild() *Team
- func (b *TeamBuilder) Name(name string) *TeamBuilder
- func (b *TeamBuilder) NewID() *TeamBuilder
- func (b *TeamBuilder) Personal(p bool) *TeamBuilder
- type TeamID
- type TeamIDList
- type TeamList
- type Theme
- type User
- func (u *User) AddAuth(a Auth) bool
- func (u *User) Auths() []Auth
- func (u *User) ClearAuths()
- func (u *User) ContainAuth(a Auth) bool
- func (u *User) Email() string
- func (u *User) GetAuthByProvider(provider string) *Auth
- func (u *User) HasAuthProvider(p string) bool
- func (u *User) ID() ID
- func (u *User) Lang() language.Tag
- func (u *User) MatchPassword(pass string) (bool, error)
- func (u *User) Name() string
- func (u *User) Password() []byte
- func (u *User) PasswordReset() *PasswordReset
- func (u *User) RemoveAuth(a Auth) bool
- func (u *User) RemoveAuthByProvider(provider string) bool
- func (u *User) SetPassword(pass string) error
- func (u *User) SetPasswordReset(pr *PasswordReset)
- func (u *User) SetVerification(v *Verification)
- func (u *User) Team() TeamID
- func (u *User) Theme() Theme
- func (u *User) UpdateEmail(email string) error
- func (u *User) UpdateLang(lang language.Tag)
- func (u *User) UpdateName(name string)
- func (u *User) UpdateTeam(team TeamID)
- func (u *User) UpdateTheme(t Theme)
- func (u *User) Verification() *Verification
- type Verification
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserAlreadyJoined = errors.New("user already joined") ErrCannotModifyPersonalTeam = errors.New("personal team cannot be modified") ErrTeamWithProjects = errors.New("target team still has some project") ErrTargetUserNotInTheTeam = errors.New("target user does not exist in the team") )
View Source
var ( DefaultPasswordEncoder PasswordEncoder = &BcryptPasswordEncoder{} ErrEncodingPassword = errors.New("encoding password") ErrInvalidPassword = errors.New("invalid password") ErrPasswordLength = errors.New("password at least 8 characters") ErrPasswordUpper = errors.New("password should have upper case letters") ErrPasswordLower = errors.New("password should have lower case letters") ErrPasswordNumber = errors.New("password should have numbers") )
View Source
var ( // RoleOwner is a role who can have full controll of project RoleOwner = Role("owner") // RoleWriter is a role who can read and write project RoleWriter = Role("writer") // RoleReader is a role who can read project RoleReader = Role("reader") ErrInvalidRole = errors.New("invalid role") )
View Source
var (
ErrInvalidEmail = errors.New("invalid email")
)
View Source
var ErrInvalidID = id.ErrInvalidID
View Source
var GenerateVerificationCode = generateCode
View Source
var IDFrom = id.UserIDFrom
View Source
var IDFromRef = id.UserIDFromRef
View Source
var MustID = id.MustUserID
View Source
var MustTeamID = id.MustTeamID
View Source
var NewID = id.NewUserID
View Source
var NewTeamID = id.NewTeamID
View Source
var Now = time.Now
View Source
var TeamIDFrom = id.TeamIDFrom
View Source
var TeamIDFromRef = id.TeamIDFromRef
Functions ¶
func MockGenerateVerificationCode ¶ added in v0.6.0
func MockGenerateVerificationCode(code string) func()
func ValidatePasswordFormat ¶ added in v0.6.0
Types ¶
type BcryptPasswordEncoder ¶ added in v0.6.0
type BcryptPasswordEncoder struct{}
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) EncodedPassword ¶ added in v0.6.0
func (b *Builder) EncodedPassword(p EncodedPassword) *Builder
func (*Builder) PasswordPlainText ¶ added in v0.6.0
func (*Builder) PasswordReset ¶ added in v0.6.0
func (b *Builder) PasswordReset(pr *PasswordReset) *Builder
func (*Builder) Verification ¶ added in v0.6.0
func (b *Builder) Verification(v *Verification) *Builder
type EncodedPassword ¶ added in v0.6.0
type EncodedPassword []byte
func MustEncodedPassword ¶ added in v0.6.0
func MustEncodedPassword(pass string) EncodedPassword
func NewEncodedPassword ¶ added in v0.6.0
func NewEncodedPassword(pass string) (EncodedPassword, error)
func (EncodedPassword) Clone ¶ added in v0.6.0
func (p EncodedPassword) Clone() EncodedPassword
type InitParams ¶
type Members ¶
type Members struct {
// contains filtered or unexported fields
}
func CopyMembers ¶
func NewFixedMembers ¶
func NewMembers ¶
func NewMembers() *Members
func NewMembersWith ¶
func (*Members) ContainsUser ¶
func (*Members) IsOnlyOwner ¶
func (*Members) UsersByRole ¶
type MockPasswordEncoder ¶ added in v0.6.0
type MockPasswordEncoder struct{ Mock []byte }
type NoopPasswordEncoder ¶ added in v0.6.0
type NoopPasswordEncoder struct{}
type PasswordEncoder ¶ added in v0.6.0
type PasswordReset ¶ added in v0.6.0
func NewPasswordReset ¶ added in v0.6.0
func NewPasswordReset() *PasswordReset
func PasswordResetFrom ¶ added in v0.6.0
func PasswordResetFrom(token string, createdAt time.Time) *PasswordReset
func (*PasswordReset) Clone ¶ added in v0.6.0
func (pr *PasswordReset) Clone() *PasswordReset
func (*PasswordReset) Validate ¶ added in v0.6.0
func (pr *PasswordReset) Validate(token string) bool
type Team ¶
type Team struct {
// contains filtered or unexported fields
}
func (*Team) IsPersonal ¶
type TeamBuilder ¶
type TeamBuilder struct {
// contains filtered or unexported fields
}
func NewTeam ¶
func NewTeam() *TeamBuilder
func (*TeamBuilder) Build ¶
func (b *TeamBuilder) Build() (*Team, error)
func (*TeamBuilder) ID ¶
func (b *TeamBuilder) ID(id TeamID) *TeamBuilder
func (*TeamBuilder) Members ¶
func (b *TeamBuilder) Members(members map[ID]Role) *TeamBuilder
func (*TeamBuilder) MustBuild ¶
func (b *TeamBuilder) MustBuild() *Team
func (*TeamBuilder) Name ¶
func (b *TeamBuilder) Name(name string) *TeamBuilder
func (*TeamBuilder) NewID ¶
func (b *TeamBuilder) NewID() *TeamBuilder
func (*TeamBuilder) Personal ¶
func (b *TeamBuilder) Personal(p bool) *TeamBuilder
type TeamIDList ¶ added in v0.6.0
type TeamIDList = id.TeamIDList
type TeamList ¶ added in v0.6.0
type TeamList []*Team
func (TeamList) FilterByID ¶ added in v0.6.0
func (TeamList) FilterByUserRole ¶ added in v0.6.0
func (TeamList) FilterByUserRoleIncluding ¶ added in v0.6.0
type User ¶
type User struct {
// contains filtered or unexported fields
}
func (*User) ClearAuths ¶
func (u *User) ClearAuths()
func (*User) ContainAuth ¶
func (*User) GetAuthByProvider ¶ added in v0.6.0
func (*User) HasAuthProvider ¶ added in v0.6.0
func (*User) MatchPassword ¶ added in v0.6.0
func (*User) PasswordReset ¶ added in v0.6.0
func (u *User) PasswordReset() *PasswordReset
func (*User) RemoveAuth ¶
func (*User) RemoveAuthByProvider ¶
func (*User) SetPassword ¶ added in v0.6.0
func (*User) SetPasswordReset ¶ added in v0.6.0
func (u *User) SetPasswordReset(pr *PasswordReset)
func (*User) SetVerification ¶ added in v0.6.0
func (u *User) SetVerification(v *Verification)
func (*User) UpdateEmail ¶
func (*User) UpdateLang ¶
func (*User) UpdateName ¶
func (*User) UpdateTeam ¶
func (*User) UpdateTheme ¶
func (*User) Verification ¶ added in v0.6.0
func (u *User) Verification() *Verification
type Verification ¶ added in v0.6.0
type Verification struct {
// contains filtered or unexported fields
}
func NewVerification ¶ added in v0.6.0
func NewVerification() *Verification
func VerificationFrom ¶ added in v0.6.0
func VerificationFrom(c string, e time.Time, b bool) *Verification
func (*Verification) Code ¶ added in v0.6.0
func (v *Verification) Code() string
func (*Verification) Expiration ¶ added in v0.6.0
func (v *Verification) Expiration() time.Time
func (*Verification) IsExpired ¶ added in v0.6.0
func (v *Verification) IsExpired() bool
func (*Verification) IsVerified ¶ added in v0.6.0
func (v *Verification) IsVerified() bool
func (*Verification) SetVerified ¶ added in v0.6.0
func (v *Verification) SetVerified(b bool)
Click to show internal directories.
Click to hide internal directories.