Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrID = errs.NewValidation().Add("id", "Invalid")
ErrID el id del documento es invalido
View Source
var ErrLogin = errs.NewValidation().Add("login", "invalid")
ErrLogin el login es invalido
View Source
var ErrPassword = errs.NewValidation().Add("password", "invalid")
ErrPassword el password es invalido
Functions ¶
This section is empty.
Types ¶
type DbUserIdFilter ¶
type DbUserLoginFilter ¶
type DbUserLoginFilter struct {
Login string `bson:"login"`
}
type DbUserUpdateDocument ¶
type DbUserUpdateDocument struct {
Set DbUserUpdateDocumentBody `bson:"$set"`
}
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id"` Name string `bson:"name" validate:"required,min=1,max=100"` Login string `bson:"login" validate:"required,min=5,max=100"` Password string `bson:"password" validate:"required"` Permissions []string `bson:"permissions"` Enabled bool `bson:"enabled"` Created time.Time `bson:"created"` Updated time.Time `bson:"updated"` }
User data structure
func (*User) SetPasswordText ¶
SetPasswordText Asigna la contraseña en modo texto, la encripta
type UserData ¶
type UserData struct { Id string `json:"id"` Name string `json:"name"` Permissions []string `json:"permissions"` Login string `json:"login"` Enabled bool `json:"enabled"` }
func NewUserData ¶
type UserRepository ¶
type UserRepository interface { Insert(usr *User) (*User, error) Update(usr *User) (*User, error) FindAll() ([]*User, error) FindByID(userID string) (*User, error) FindByLogin(login string) (*User, error) }
func NewUserRepository ¶
func NewUserRepository( log log.LogRusEntry, collection db.Collection, ) UserRepository
type UserService ¶
type UserService interface { ChangePassword(userID string, current string, newPassword string) error Disable(userID string) error Enable(userID string) error FindById(userID string) (*UserData, error) FindAllUsers() ([]*UserData, error) Grant(userID string, permissions []string) error Granted(userID string, permission string) bool Revoke(userID string, permissions []string) error New(login string, name string, password string) (result *UserData, err error) SignIn(login string, password string) (user *UserData, err error) }
func NewUserService ¶
func NewUserService(userRepository UserRepository) UserService
Click to show internal directories.
Click to hide internal directories.