user

package
v0.0.0-...-72c2bb7 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service for interfacing with postgresql/rds

func New

func New(authorizer auth.Authorizer) *Service

New returns an empty Service

func (*Service) AcceptAgreement

func (s *Service) AcceptAgreement(ctx context.Context, userContext am.UserContext, accepted bool) (oid int, uid int, err error)

func (*Service) Create

func (s *Service) Create(ctx context.Context, userContext am.UserContext, user *am.User) (oid int, uid int, ucid string, err error)

Create a new user, set status to active

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, userContext am.UserContext, userID int) (oid int, err error)

Delete the user

func (*Service) Get

func (s *Service) Get(ctx context.Context, userContext am.UserContext, userEmail string) (oid int, user *am.User, err error)

Get user by their email address

func (*Service) GetByCID

func (s *Service) GetByCID(ctx context.Context, userContext am.UserContext, userCID string) (oid int, user *am.User, err error)

GetByCID user by user custom id

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, userContext am.UserContext, userID int) (oid int, user *am.User, err error)

GetByID to be called with system context

func (*Service) GetWithOrgID

func (s *Service) GetWithOrgID(ctx context.Context, userContext am.UserContext, orgID int, userCID string) (oid int, user *am.User, err error)

GetWithOrgID for internal lookups instead of getting orgID from context we pass it directly (system/support only).

func (*Service) Init

func (s *Service) Init(config []byte) error

Init by parsing the config and initializing the database pool

func (*Service) IsAuthorized

func (s *Service) IsAuthorized(ctx context.Context, userContext am.UserContext, resource, action string) bool

IsAuthorized checks if an action is allowed by a particular user

func (*Service) List

func (s *Service) List(ctx context.Context, userContext am.UserContext, filter *am.UserFilter) (oid int, users []*am.User, err error)

List all users that match the supplied filter. If filter.OrgID is different than user context, ensure system user is calling.

func (*Service) Update

func (s *Service) Update(ctx context.Context, userContext am.UserContext, user *am.User, userID int) (oid int, uid int, err error)

Update allows the customer to update the details of their user. If userID does not equal user context, ensure they have UserManage permissions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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