invitation

package
v0.8.26 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpiryDuration = 24 * time.Hour * 7
)

Variables

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

Functions

This section is empty.

Types

type Config added in v0.7.4

type Config struct {
	// WithRoles if set to true will allow roles to be passed in invitation, when the user accepts the
	// invite, the role will be assigned to the user
	WithRoles bool `yaml:"with_roles" mapstructure:"with_roles" default:"false"`

	MailTemplate MailTemplateConfig `yaml:"mail_template" mapstructure:"mail_template"`
}

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 string, principal authenticate.Principal) error
	ListByUser(ctx context.Context, principalID, principalType 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 MailTemplateConfig added in v0.7.4

type MailTemplateConfig struct {
	Subject string `yaml:"subject" mapstructure:"subject" default:"You have been invited to join an organization"`
	Body    string `` /* 231-byte string literal not displayed */
}

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, f organization.Filter) ([]organization.Organization, error)
}

type PolicyService added in v0.7.3

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

type PreferencesService added in v0.7.13

type PreferencesService interface {
	LoadPlatformPreferences(ctx context.Context) (map[string]string, 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) (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, prefService PreferencesService) *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