user

package
v0.0.0-...-29c6822 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: MIT Imports: 13 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 MakeHTTPHandler

func MakeHTTPHandler(e Endpoints, logger log.Logger) *mux.Router

func MakeListUsersEndpoint

func MakeListUsersEndpoint(svc Service) endpoint.Endpoint

func MarshalUser

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

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) 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)

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