user

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ActionCreate        = "user.create"
	ActionUpdate        = "user.update"
	ActionDelete        = "user.delete"
	ActionLock          = "user.lock"
	ActionReadList      = "user.read.list"
	PermissionResource  = "user"
	ErrPermissionDenied = errors.New("permission denied")
)

Functions

This section is empty.

Types

type MongoDBRepository

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

func (*MongoDBRepository) Create

func (r *MongoDBRepository) Create(ctx context.Context, user *types.User) (string, error)

func (*MongoDBRepository) Delete

func (r *MongoDBRepository) Delete(ctx context.Context, id string) error

func (*MongoDBRepository) FindAll

func (r *MongoDBRepository) FindAll(context.Context, *types.User) ([]*types.User, error)

func (*MongoDBRepository) FindByID

func (r *MongoDBRepository) FindByID(ctx context.Context, id string) (*types.User, error)

func (*MongoDBRepository) FindBySample

func (r *MongoDBRepository) FindBySample(ctx context.Context, user *types.User) ([]*types.User, error)

func (*MongoDBRepository) Lock

func (r *MongoDBRepository) Lock(ctx context.Context, id string) error

func (*MongoDBRepository) Update

func (r *MongoDBRepository) Update(ctx context.Context, user *types.User) error

type PolicyService

type PolicyService interface {
	IsAllowed(ctx context.Context, roles []string, action, resource string) (bool, error)
}

type Repository

type Repository interface {
	Create(context.Context, *types.User) (string, error)
	Delete(context.Context, string) error
	Update(context.Context, *types.User) error
	Lock(context.Context, string) error
	FindBySample(context.Context, *types.User) ([]*types.User, error)
	FindAll(context.Context) ([]*types.User, error)
	FindByID(ctx context.Context, id string) (*types.User, error)
}

type Service

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

func (*Service) Create

func (s *Service) Create(ctx context.Context, user *types.User) (string, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

func (*Service) FindAll

func (s *Service) FindAll(ctx context.Context) ([]*types.User, error)

func (*Service) FindByID

func (s *Service) FindByID(ctx context.Context, id string) (*types.User, error)

func (*Service) FindBySample

func (s *Service) FindBySample(ctx context.Context, user *types.User) ([]*types.User, error)

func (*Service) IsAllowed

func (s *Service) IsAllowed(ctx context.Context, action string) error

func (*Service) Lock

func (s *Service) Lock(ctx context.Context, id string) error

func (*Service) Update

func (s *Service) Update(ctx context.Context, user *types.User) error

Jump to

Keyboard shortcuts

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