invitation

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Filter

type Filter struct {
	OrgID  string
	UserID string
}

type GroupService

type GroupService interface {
	Get(ctx context.Context, id string) (group.Group, error)
	AddMember(ctx context.Context, groupID, relationName string, principal authenticate.Principal) error
	ListByUser(ctx context.Context, userID string, flt group.Filter) ([]group.Group, error)
}

type Invitation

type Invitation struct {
	ID        uuid.UUID
	UserID    string
	OrgID     string
	GroupIDs  []string
	RoleIDs   []string
	Metadata  metadata.Metadata
	CreatedAt time.Time
	ExpiresAt time.Time
}

type OrganizationService

type OrganizationService interface {
	Get(ctx context.Context, id string) (organization.Organization, error)
	AddMember(ctx context.Context, orgID, relationName string, principal authenticate.Principal) error
	ListByUser(ctx context.Context, userID string) ([]organization.Organization, error)
}

type PolicyService added in v0.7.3

type PolicyService interface {
	Create(ctx context.Context, policy policy.Policy) (policy.Policy, error)
}

type RelationService

type RelationService interface {
	Create(ctx context.Context, rel relation.Relation) (relation.Relation, error)
	Delete(ctx context.Context, rel relation.Relation) error
}

type Repository

type Repository interface {
	Set(ctx context.Context, invite Invitation) error
	List(ctx context.Context, flt Filter) ([]Invitation, error)
	ListByUser(ctx context.Context, id string) ([]Invitation, error)
	Get(ctx context.Context, id uuid.UUID) (Invitation, error)
	Delete(ctx context.Context, id uuid.UUID) error
}

type Service

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

func NewService

func NewService(dialer mailer.Dialer, repo Repository,
	orgSvc OrganizationService, grpSvc GroupService,
	userService UserService, relService RelationService,
	policyService PolicyService, allowRoles bool) *Service

func (Service) Accept

func (s Service) Accept(ctx context.Context, id uuid.UUID) error

Accept invites a user to an organization

func (Service) Create

func (s Service) Create(ctx context.Context, invitation Invitation) (Invitation, error)

func (Service) Delete

func (s Service) Delete(ctx context.Context, id uuid.UUID) error

func (Service) Get

func (s Service) Get(ctx context.Context, id uuid.UUID) (Invitation, error)

func (Service) List

func (s Service) List(ctx context.Context, flt Filter) ([]Invitation, error)

func (Service) ListByUser

func (s Service) ListByUser(ctx context.Context, id string) ([]Invitation, error)

type UserService

type UserService interface {
	GetByID(ctx context.Context, id string) (user.User, error)
}

Jump to

Keyboard shortcuts

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