Documentation ¶
Index ¶
- Variables
- func CheckUserAccess(teamNames []string, u *User) bool
- func CreateTeam(name string, user ...*User) error
- func DeleteToken(token string) error
- func GetTeamsNames(teams []Team) []string
- func ReleaseApp(user *User) error
- func ReserveApp(user *User) error
- type AuthenticationFailure
- type Key
- type Team
- type Token
- type User
- func (u *User) AddKey(key Key) error
- func (u *User) AllowedApps() ([]string, error)
- func (u *User) CheckPassword(password string) error
- func (u *User) Create() error
- func (u *User) CreateToken(password string) (*Token, error)
- func (u *User) FindKey(key Key) (Key, int)
- func (u *User) HasKey(key Key) bool
- func (u *User) HashPassword()
- func (u *User) IsAdmin() bool
- func (u *User) ListKeys() (map[string]string, error)
- func (u *User) RemoveKey(key Key) error
- func (u *User) ResetPassword(token string) error
- func (u *User) StartPasswordReset() error
- func (u *User) Teams() ([]Team, error)
- func (u *User) Update() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidTeamName = errors.New("Invalid team name") ErrTeamAlreadyExists = errors.New("Team already exists") )
View Source
var ErrInvalidToken = errors.New("Invalid token")
View Source
var ErrUserNotFound = stderrors.New("User not found")
Functions ¶
func CheckUserAccess ¶
func CreateTeam ¶
func DeleteToken ¶
func GetTeamsNames ¶
func ReleaseApp ¶
ReleaseApp releases an app from the user list, releasing the quota spot for another app.
func ReserveApp ¶
ReserveApp reserves an app for the user, reserving it in the database. It's used to reserve the app in the user quota, returning an error when there isn't any space available.
Types ¶
type AuthenticationFailure ¶
type AuthenticationFailure struct{}
func (AuthenticationFailure) Error ¶
func (AuthenticationFailure) Error() string
type Token ¶
type Token struct { Token string `json:"token"` Creation time.Time `json:"creation"` Expires time.Duration `json:"expires"` UserEmail string `json:"email"` AppName string `json:"app"` }
func CreateApplicationToken ¶
type User ¶
func GetUserByEmail ¶
func (*User) AllowedApps ¶
func (*User) CheckPassword ¶
func (*User) HashPassword ¶
func (u *User) HashPassword()
func (*User) ResetPassword ¶
ResetPassword actually resets the password of the user. It needs the token string. The new password will be a random string, that will be then sent to the user email.
func (*User) StartPasswordReset ¶
StartPasswordReset starts the password reset process, creating a new token and mailing it to the user.
The token should then be used to finish the process, through the ResetPassword function.
Click to show internal directories.
Click to hide internal directories.