invitations

package
v0.0.0-...-d3d53d6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2016 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleMember = "member"
	RoleOwner  = "owner"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type InvitationManager

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

InvitationManager is used to store organizations

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) 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) GetByUser

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

GetByUser gets all invitations for a user.

func (*InvitationManager) GetPendingByOrganization

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

GetPendingByOrganization gets all pending invitations for a user.

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) RemoveAll

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

RemoveAll Removes all invitations linked to an organization

func (*InvitationManager) Save

Save save/update an invitation

type InvitationStatus

type InvitationStatus string
const (
	RequestPending  InvitationStatus = "pending"
	RequestAccepted InvitationStatus = "accepted"
	RequestRejected InvitationStatus = "rejected"
)

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"`
}

JoinOrganizationInvitation defines an invitation to join an organization

Jump to

Keyboard shortcuts

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