teams

package
v6.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: AGPL-3.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AcceptedDomainError = errors.New("the user cannot be added as the domain associated with the account is not permitted")
	MemberCountError    = errors.New("unable to count the team members")
	MaxMemberCountError = errors.New("reached to the maximum number of allowed accounts")
)

Functions

func IsEmailAddressAllowed

func IsEmailAddressAllowed(email string, allowedDomains []string) bool

Types

type DomainError

type DomainError struct {
	Domain string
}

func (DomainError) Error

func (DomainError) Error() string

type ServiceConfig

type ServiceConfig struct {
	// Mandatory fields
	TeamStore    store.TeamStore
	GroupStore   store.GroupStore
	ChannelStore store.ChannelStore
	Users        Users
	WebHub       WebHub
	ConfigFn     func() *model.Config
	LicenseFn    func() *model.License
}

ServiceConfig is used to initialize the TeamService.

type TeamService

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

func New

func New(c ServiceConfig) (*TeamService, error)

func (*TeamService) CreateTeam

func (ts *TeamService) CreateTeam(team *model.Team) (*model.Team, error)

func (*TeamService) DefaultChannelNames

func (ts *TeamService) DefaultChannelNames() []string

By default the list will be (not necessarily in this order):

['town-square', 'off-topic']

However, if TeamSettings.ExperimentalDefaultChannels contains a list of channels then that list will replace 'off-topic' and be included in the return results in addition to 'town-square'. For example:

['town-square', 'game-of-thrones', 'wow']

func (*TeamService) GetAllowedDomains

func (ts *TeamService) GetAllowedDomains(user *model.User, team *model.Team) []string

func (*TeamService) GetMember added in v6.7.0

func (ts *TeamService) GetMember(teamID string, userID string) (*model.TeamMember, error)

GetMember return the team member from the team.

func (*TeamService) GetTeam

func (ts *TeamService) GetTeam(teamID string) (*model.Team, error)

func (*TeamService) GetTeams added in v6.7.0

func (ts *TeamService) GetTeams(teamIDs []string) ([]*model.Team, error)

func (*TeamService) IsTeamEmailAllowed

func (ts *TeamService) IsTeamEmailAllowed(user *model.User, team *model.Team) bool

func (*TeamService) JoinUserToTeam

func (ts *TeamService) JoinUserToTeam(team *model.Team, user *model.User) (*model.TeamMember, bool, error)

JoinUserToTeam adds a user to the team and it returns three values: 1. a pointer to the team member, if successful 2. a boolean: true if the user has a non-deleted team member for that team already, otherwise false. 3. a pointer to an AppError if something went wrong.

func (*TeamService) PatchTeam

func (ts *TeamService) PatchTeam(teamID string, patch *model.TeamPatch) (*model.Team, error)

func (*TeamService) RemoveTeamMember

func (ts *TeamService) RemoveTeamMember(teamMember *model.TeamMember) error

RemoveTeamMember removes the team member from the team. This method sends the websocket message before actually removing so the user being removed gets it.

func (*TeamService) UpdateTeam

func (ts *TeamService) UpdateTeam(team *model.Team, opts UpdateOptions) (*model.Team, error)

type UpdateOptions

type UpdateOptions struct {
	Sanitized bool
	Imported  bool
}

type Users

type Users interface {
	GetUser(userID string) (*model.User, error)
}

Users is a subset of UserService interface

type WebHub

type WebHub interface {
	Publish(message *model.WebSocketEvent)
}

WebHub is used to publish events, the name should be given appropriately while developing the websocket or clustering service

Jump to

Keyboard shortcuts

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