user

package
v0.0.0-...-4515e61 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2019 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const CreatedEventID event.ID = "user_created"

CreatedEventID of an user object

View Source
const DeletedEventID event.ID = "user_deleted"

DeletedEventID of an user object

View Source
const PasswordSetEventID event.ID = "user_password_set"

PasswordSetEventID of an user object

View Source
const UpdatedEventID event.ID = "user_updated"

UpdatedEventID of an user object

Variables

View Source
var ErrNotFound = errors.New("user not found")

ErrNotFound is returned if an user object was not found

Functions

func MakeCreateEndpoint

func MakeCreateEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeCreateEndpoint for the user service API-Path: /users

func MakeDeleteEndpoint

func MakeDeleteEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeDeleteEndpoint for the user service API-Path: /users/{uuid}

func MakeGetByGameSerialHashEndpoint

func MakeGetByGameSerialHashEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeGetByGameSerialHashEndpoint for the user service API-Path: /users/hash/{hash}

func MakeGetEndpoint

func MakeGetEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeGetEndpoint for the user service API-Path: /users/{uuid}

func MakeGetRolesEndpoint

func MakeGetRolesEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeGetRolesEndpoint for the user service API-Endpoint: GET /users/{uuid}/roles

func MakeSetRolesEndpoint

func MakeSetRolesEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeSetRolesEndpoint for the user service API-Endpoint: PATCH /users/{uuid}/roles

func MakeUpdateEndpoint

func MakeUpdateEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc

MakeUpdateEndpoint for the user service API-Path: /users/{uuid}

func NewGRPCServer

func NewGRPCServer(m Manager) pb.ManagerServer

NewGRPCServer for user management

Types

type Complete

type Complete interface {
	Identifier
	Incomplete
}

Complete user object

type CompletePassword

type CompletePassword interface {
	Hash() []byte
}

CompletePassword of a user. In general, this password interface is returned only by the regarding repository and thus, is only created by it.

type CreatedEvent

type CreatedEvent struct {
	Meta *event.PayloadMeta `json:"meta"`
	Data Complete           `json:"data"`
}

CreatedEvent of an user object

type DeletedEvent

type DeletedEvent struct {
	Meta *event.PayloadMeta `json:"meta"`
	Data Identifier         `json:"data"`
}

DeletedEvent of an user object

type GRPCServer

type GRPCServer struct {
	// contains filtered or unexported fields
}

GRPCServer for external user management

func (*GRPCServer) CheckUserPassword

func (s *GRPCServer) CheckUserPassword(ctx context.Context, req *pb.CheckUserPasswordRequest) (*empty.Empty, error)

CheckUserPassword if the given password matches

func (*GRPCServer) CreateUser

func (s *GRPCServer) CreateUser(ctx context.Context, req *pb.CreateUserRequest) (*pb.User, error)

CreateUser in the database

func (*GRPCServer) DeleteUser

func (s *GRPCServer) DeleteUser(ctx context.Context, req *pb.DeleteUserRequest) (*empty.Empty, error)

DeleteUser from the database

func (*GRPCServer) GetUser

func (s *GRPCServer) GetUser(ctx context.Context, req *pb.GetUserRequest) (*pb.User, error)

GetUser from the user database

func (*GRPCServer) GetUserByGameSerialHash

func (s *GRPCServer) GetUserByGameSerialHash(ctx context.Context, req *pb.GetUserByGameSerialHashRequest) (*pb.User, error)

GetUserByGameSerialHash returns a user filtered by its game serial hash

func (*GRPCServer) GetUserByWCFUserID

func (s *GRPCServer) GetUserByWCFUserID(ctx context.Context, req *pb.GetUserByWCFUserIDRequest) (*pb.User, error)

GetUserByWCFUserID returns a user filtered by its wcf user id

func (*GRPCServer) GetUserRoles

func (s *GRPCServer) GetUserRoles(ctx context.Context, id *pb.UUID) (*proto1.AccountRoles, error)

GetUserRoles of a user

func (*GRPCServer) GetWCFInfo

func (s *GRPCServer) GetWCFInfo(ctx context.Context, req *pb.GetWCFInfoRequest) (*pb.WCFUserInfo, error)

GetWCFInfo of a wcf user

func (*GRPCServer) SetUserRoles

func (s *GRPCServer) SetUserRoles(ctx context.Context, req *pb.SetUserRolesRequest) (*empty.Empty, error)

SetUserRoles of a user

func (*GRPCServer) UpdateUser

func (s *GRPCServer) UpdateUser(ctx context.Context, req *pb.UpdateUserRequest) (*empty.Empty, error)

UpdateUser credentials in the database

type Identifier

type Identifier interface {
	UUID() string
}

Identifier of a user object

type Incomplete

type Incomplete interface {
	Provider
}

Incomplete user object

func NewIncomplete

func NewIncomplete(wcfUserID WCFUserID, wcfUsername, wcfEmail, gameSerialHash string, status bool) Incomplete

NewIncomplete user object

type IncompletePassword

type IncompletePassword interface {
	Password() string
}

IncompletePassword of a user (object). A complete password is containing a password and a salt (see CompletePassword)

type Manager

type Manager interface {
	Get(ctx context.Context, id Identifier) (Complete, error)
	GetByGameSerialHash(ctx context.Context, hash string) (Complete, error)
	GetByWCFUserID(ctx context.Context, wcfUserID WCFUserID) (Complete, error)
	Create(ctx context.Context, inc Incomplete) (Complete, error)
	Delete(ctx context.Context, id Identifier) error
	GetWCFInfo(ctx context.Context, name string) (*WCFUserInfo, error)
	Update(ctx context.Context, c Complete) error
	CheckPassword(ctx context.Context, id Identifier, incPw IncompletePassword) error
	GetRoles(ctx context.Context, id Identifier) (rbac.AccountRoles, error)
	SetRoles(ctx context.Context, id Identifier, roles rbac.AccountRoles) error
}

Manager of user objects

func NewGRPCClient

func NewGRPCClient(c *grpc.ClientConn) Manager

NewGRPCClient for users

func NewManager

func NewManager(r Repository, wcf WCFRepository, prod *event.Producer, rb rbac.Control) Manager

NewManager for user objects

type PasswordSetEvent

type PasswordSetEvent struct {
	Meta *event.PayloadMeta `json:"meta"`
	Data CompletePassword   `json:"data"`
}

PasswordSetEvent of an user object

type Provider

type Provider interface {
	Data() *data
}

Provider of user data

type Repository

type Repository interface {
	Get(context.Context, Identifier) (Complete, error)
	GetByGameSerialHash(context.Context, string) (Complete, error)
	GetByWCFUserID(context.Context, WCFUserID) (Complete, error)
	Create(context.Context, Incomplete) (Complete, error)
	Update(context.Context, Complete) error
	Delete(context.Context, Identifier) error
}

Repository of user objects

type UpdatedEvent

type UpdatedEvent struct {
	Meta *event.PayloadMeta `json:"meta"`
	Data Complete           `json:"data"`
}

UpdatedEvent of an user object

type WCFRepository

type WCFRepository interface {
	GetInfo(context.Context, WCFUserID) (*WCFUserInfo, error)
	GetInfoByEmail(context.Context, string) (*WCFUserInfo, error)
	GetInfoByUsername(context.Context, string) (*WCFUserInfo, error)
}

WCFRepository of the Woltlab Community Framwork database

type WCFUserID

type WCFUserID uint64

WCFUserID of the user existing in the Woltlab Community Framwork database

func (*WCFUserID) UnmarshalJSON

func (id *WCFUserID) UnmarshalJSON(b []byte) error

UnmarshalJSON impletements the json.Unmarshaler interface

type WCFUserInfo

type WCFUserInfo struct {
	UserID   WCFUserID
	Username string
	Email    string
	Password CompletePassword
}

WCFUserInfo of an existing user in the WCF database

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL