user

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package user provides utilites for managing users with MDM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeApplyUserEndpoint

func MakeApplyUserEndpoint(svc Service) endpoint.Endpoint

func MakeListUsersEndpoint

func MakeListUsersEndpoint(svc Service) endpoint.Endpoint

func MarshalUser

func MarshalUser(u *User) ([]byte, error)

func RegisterHTTPHandlers

func RegisterHTTPHandlers(r *mux.Router, e Endpoints, options ...httptransport.ServerOption)

func UnmarshalUser

func UnmarshalUser(data []byte, u *User) error

Types

type Endpoints

type Endpoints struct {
	ApplyUserEndpoint endpoint.Endpoint
	ListUsersEndpoint endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s Service, outer endpoint.Middleware, others ...endpoint.Middleware) Endpoints

func (Endpoints) ApplyUser

func (e Endpoints) ApplyUser(ctx context.Context, u User) (*User, error)

func (Endpoints) ListUsers

func (e Endpoints) ListUsers(ctx context.Context, opts ListUsersOption) ([]User, error)

type ListUsersOption

type ListUsersOption struct {
	Page    int `json:"page"`
	PerPage int `json:"per_page"`

	FilterUserID []string `json:"filter_user_id"`
	FilterUDID   []string `json:"filter_udid"`
}

type Service

type Service interface {
	ApplyUser(ctx context.Context, u User) (*User, error)
	ListUsers(ctx context.Context, opt ListUsersOption) ([]User, error)
}

func NewHTTPClient

func NewHTTPClient(instance, token string, logger log.Logger, opts ...httptransport.ClientOption) (Service, error)

type Store

type Store interface {
	User(string) (*User, error)
	Save(*User) error
	List() ([]User, error)
}

type User

type User struct {
	UUID          string `json:"uuid"`
	UDID          string `json:"udid"`
	UserID        string `json:"user_id"`
	UserShortname string `json:"user_shortname"`
	UserLongname  string `json:"user_longname"`
	AuthToken     string `json:"auth_token"`
	PasswordHash  []byte `json:"password_hash"`
	Hidden        bool   `json:"hidden"`
}

func NewFromRequest

func NewFromRequest(u User) (*User, error)

type UserService

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

func New

func New(store Store) *UserService

func (*UserService) ApplyUser

func (svc *UserService) ApplyUser(ctx context.Context, u User) (*User, error)

func (*UserService) ListUsers

func (svc *UserService) ListUsers(ctx context.Context, opts ListUsersOption) ([]User, error)

type Worker

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

func NewWorker

func NewWorker(db WorkerStore, subscriber pubsub.Subscriber, logger log.Logger) *Worker

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

type WorkerStore

type WorkerStore interface {
	Save(*User) error
	DeleteDeviceUsers(udid string) error
	UserByUserID(userID string) (*User, error)
}

Directories

Path Synopsis
internal
userproto
Package userproto is a generated protocol buffer package.
Package userproto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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