invitations

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: BSD-3-Clause Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	RoleMember    = "member"
	RoleOwner     = "owner"
	RoleOrgMember = "orgmember"
	RoleOrgOwner  = "orgowner"
)

Denotes the different kind of roles in an organization

View Source
const (
	InviteURL = "https://%s/login#/organizationinvite/%s"
)

The url to link in an invitation email

Variables

This section is empty.

Functions

func ParseInvitationType added in v0.9.9

func ParseInvitationType(invitationType string) string

Types

type InvitationManager

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

InvitationManager is used to store invitations

func NewInvitationManager

func NewInvitationManager(r *http.Request) *InvitationManager

NewInvitationManager creates and initializes a new InvitationManager

func (*InvitationManager) CountByOrganization

func (o *InvitationManager) CountByOrganization(globalid string) (int, error)

CountByOrganization Counts the amount of invitations, filtered by an organization

func (*InvitationManager) FilterByEmail added in v0.9.9

func (o *InvitationManager) FilterByEmail(email string, status string) ([]JoinOrganizationInvitation, error)

FilterByEmail gets all invitations for an email address, filtered on status

func (*InvitationManager) FilterByOrganization added in v0.9.9

func (o *InvitationManager) FilterByOrganization(globalID string, status string) ([]JoinOrganizationInvitation, error)

FilterByOrganization gets all invitations for a user, filtered on status

func (*InvitationManager) FilterByPhonenumber added in v0.9.9

func (o *InvitationManager) FilterByPhonenumber(phonenumber string, status string) ([]JoinOrganizationInvitation, error)

FilterByPhonenumber gets all invitations for a phone number, filtered on status

func (*InvitationManager) FilterByUser added in v0.9.9

func (o *InvitationManager) FilterByUser(username string, status string) ([]JoinOrganizationInvitation, error)

FilterByUser gets all invitations for a user, filtered on status

func (*InvitationManager) Get

func (o *InvitationManager) Get(username string, organization string, role string, status InvitationStatus) (*JoinOrganizationInvitation, error)

Get get an invitation by it's content, not really this usefull, TODO: just make an exists method

func (*InvitationManager) GetByCode

func (o *InvitationManager) GetByCode(code string) (invite *JoinOrganizationInvitation, err error)

GetByCode Gets an invite by code

func (*InvitationManager) GetByEmail added in v0.9.9

func (o *InvitationManager) GetByEmail(email string) ([]JoinOrganizationInvitation, error)

GetByEmail gets all invitations for an email address.

func (*InvitationManager) GetByOrganization added in v0.9.9

func (o *InvitationManager) GetByOrganization(globalid string) ([]JoinOrganizationInvitation, error)

GetByOrganization gets all invitations for an organization

func (*InvitationManager) GetByPhonenumber added in v0.9.9

func (o *InvitationManager) GetByPhonenumber(phonenumber string) ([]JoinOrganizationInvitation, error)

GetByPhonenumber gets all invitations for a phone number.

func (*InvitationManager) GetByUser

func (o *InvitationManager) GetByUser(username string) ([]JoinOrganizationInvitation, error)

GetByUser gets all invitations for a user.

func (*InvitationManager) GetOpenOrganizationInvites added in v0.9.10

func (o *InvitationManager) GetOpenOrganizationInvites(globalID string) ([]JoinOrganizationInvitation, error)

GetInvites gets all invites where the organization is invited

func (*InvitationManager) GetWithEmail added in v0.9.9

func (o *InvitationManager) GetWithEmail(email string, organization string, role string, status InvitationStatus) (*JoinOrganizationInvitation, error)

GetWithEmail get an invitation by it's content, not really this usefull, TODO: just make an exists method

func (*InvitationManager) GetWithPhonenumber added in v0.9.9

func (o *InvitationManager) GetWithPhonenumber(phonenumber string, organization string, role string, status InvitationStatus) (*JoinOrganizationInvitation, error)

GetWithPhonenumber get an invitation by it's content, not really this usefull, TODO: just make an exists method

func (*InvitationManager) HasEmailInvite added in v0.9.13

func (o *InvitationManager) HasEmailInvite(globalid string, email string) (hasInvite bool, err error)

HasEmailInvite Checks if an emailaddress has an invite to an organization

func (*InvitationManager) HasInvite

func (o *InvitationManager) HasInvite(globalid string, username string) (hasInvite bool, err error)

HasInvite Checks if a user has an invite for an organization

func (*InvitationManager) HasPhoneInvite added in v0.9.13

func (o *InvitationManager) HasPhoneInvite(globalid string, phonenumber string) (hasInvite bool, err error)

HasPhoneInvite Checks if a phonenumber has an invite to an organization

func (*InvitationManager) Remove added in v0.9.8

func (o *InvitationManager) Remove(globalID string, username string, searchString string) error

Remove removes an invitation

func (*InvitationManager) RemoveAll

func (o *InvitationManager) RemoveAll(globalid string) error

RemoveAll Removes all invitations linked to an organization

func (*InvitationManager) Save

Save saves/updates an invitation

func (*InvitationManager) SetAcceptedByCode

func (o *InvitationManager) SetAcceptedByCode(code string) error

SetAcceptedByCode Sets an invite as "accepted"

type InvitationStatus

type InvitationStatus string

InvitationStatus is a string representation of the current status of an invite

const (
	// RequestPending is an open invite waiting to be accepted or rejected
	RequestPending InvitationStatus = "pending"
	// RequestAccepted is an invitation that has been accepted by the user
	RequestAccepted InvitationStatus = "accepted"
	// RequestRejected is an invitation that has been rejected by the user
	RequestRejected InvitationStatus = "rejected"
)

type InviteMethod

type InviteMethod string

InviteMethod is a representation of how the user was invited

const (
	MethodWebsite InviteMethod = "website"
	MethodEmail   InviteMethod = "email"
	MethodPhone   InviteMethod = "phone"
)

Denote the different ways a user can be invited

type JoinOrganizationInvitation

type JoinOrganizationInvitation struct {
	ID             bson.ObjectId    `json:"-" bson:"_id,omitempty"`
	Organization   string           `json:"organization"`
	Role           string           `json:"role"`
	User           string           `json:"user"`
	Status         InvitationStatus `json:"status"`
	Created        db.DateTime      `json:"created"`
	Method         InviteMethod     `json:"method"`
	EmailAddress   string           `json:"emailaddress"`
	PhoneNumber    string           `json:"phonenumber"`
	Code           string           `json:"-"`
	IsOrganization bool             `json:"isorganization"`
}

JoinOrganizationInvitation defines an invitation to join an organization

func (*JoinOrganizationInvitation) ConvertToView added in v0.9.15

ConvertToView converts a JoinOrganizationInvitation to a JoinOrganizationInvitationView

type JoinOrganizationInvitationView added in v0.9.15

type JoinOrganizationInvitationView struct {
	Organization   string           `json:"organization"`
	Role           string           `json:"role"`
	User           string           `json:"user"`
	Status         InvitationStatus `json:"status"`
	Created        db.DateTime      `json:"created"`
	Method         InviteMethod     `json:"method"`
	EmailAddress   string           `json:"emailaddress"`
	PhoneNumber    string           `json:"phonenumber"`
	IsOrganization bool             `json:"isorganization"`
}

JoinOrganizationInvitationView is a view of an OrganizationInvitation that is served by the API

Jump to

Keyboard shortcuts

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