Documentation
¶
Index ¶
- type Capability
- type CreatorSource
- func (s *CreatorSource) GetCreators(ctx context.Context, roomId string) ([]string, error)
- func (s *CreatorSource) HasCapability(ctx context.Context, userId string, roomId string, capability Capability) (Tristate, error)
- func (s *CreatorSource) ImportData(ctx context.Context, roomId string, createEvent gomatrixserverlib.PDU) error
- type MuninnHallMemberDirectory
- type MuninnHallSource
- func (s *MuninnHallSource) GetServers(ctx context.Context) ([]string, error)
- func (s *MuninnHallSource) HasCapability(ctx context.Context, userId string, roomId string, capability Capability) (Tristate, error)
- func (s *MuninnHallSource) ImportData(ctx context.Context, directory MuninnHallMemberDirectory) error
- type MuninnMemberDirectoryEvent
- type PowerLevelsSource
- func (s *PowerLevelsSource) HasCapability(ctx context.Context, userId string, roomId string, capability Capability) (Tristate, error)
- func (s *PowerLevelsSource) ImportData(ctx context.Context, roomId string, powerLevelsEvent gomatrixserverlib.PDU) error
- func (s *PowerLevelsSource) IsUserAboveDefault(ctx context.Context, roomId string, userId string) (bool, error)
- type SelfDirectedSource
- type Source
- type Tristate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreatorSource ¶
type CreatorSource struct {
// contains filtered or unexported fields
}
CreatorSource - trusts v12+ room creators as high power level users
func NewCreatorSource ¶
func NewCreatorSource(db storage.PersistentStorage) (*CreatorSource, error)
func (*CreatorSource) GetCreators ¶
func (*CreatorSource) HasCapability ¶
func (s *CreatorSource) HasCapability(ctx context.Context, userId string, roomId string, capability Capability) (Tristate, error)
func (*CreatorSource) ImportData ¶
func (s *CreatorSource) ImportData(ctx context.Context, roomId string, createEvent gomatrixserverlib.PDU) error
type MuninnHallSource ¶
type MuninnHallSource struct {
// contains filtered or unexported fields
}
MuninnHallSource - uses the Muninn Hall member directory to determine which servers have higher trust levels in communities.
func NewMuninnHallSource ¶
func NewMuninnHallSource(db storage.PersistentStorage) (*MuninnHallSource, error)
func (*MuninnHallSource) GetServers ¶
func (s *MuninnHallSource) GetServers(ctx context.Context) ([]string, error)
func (*MuninnHallSource) HasCapability ¶
func (s *MuninnHallSource) HasCapability(ctx context.Context, userId string, roomId string, capability Capability) (Tristate, error)
func (*MuninnHallSource) ImportData ¶
func (s *MuninnHallSource) ImportData(ctx context.Context, directory MuninnHallMemberDirectory) error
type MuninnMemberDirectoryEvent ¶
type MuninnMemberDirectoryEvent struct {
Content struct {
MemberDirectory MuninnHallMemberDirectory `json:"com.muninn-hall.member_directory"`
} `json:"content"`
}
type PowerLevelsSource ¶
type PowerLevelsSource struct {
// contains filtered or unexported fields
}
PowerLevelsSource - uses the room's power levels to determine trust levels. Above-default power levels are trusted.
func NewPowerLevelsSource ¶
func NewPowerLevelsSource(db storage.PersistentStorage) (*PowerLevelsSource, error)
func (*PowerLevelsSource) HasCapability ¶
func (s *PowerLevelsSource) HasCapability(ctx context.Context, userId string, roomId string, capability Capability) (Tristate, error)
func (*PowerLevelsSource) ImportData ¶
func (s *PowerLevelsSource) ImportData(ctx context.Context, roomId string, powerLevelsEvent gomatrixserverlib.PDU) error
func (*PowerLevelsSource) IsUserAboveDefault ¶
type SelfDirectedSource ¶
type SelfDirectedSource struct {
// contains filtered or unexported fields
}
SelfDirectedSource - trusts user IDs matching the allowed globs list, and doesn't trust those matching the denied globs list. Note that the denied globs list takes precedence over the allowed globs list.
func NewSelfDirectedSource ¶
func NewSelfDirectedSource(db storage.PersistentStorage, allowedGlobs []string, deniedGlobs []string) (*SelfDirectedSource, error)
func (*SelfDirectedSource) HasCapability ¶
func (s *SelfDirectedSource) HasCapability(ctx context.Context, userId string, roomId string, capability Capability) (Tristate, error)
type Source ¶
type Source interface {
// HasCapability returns TristateTrue if the given user has the given capability in the given room under this source of trust,
// TristateFalse if they explicitly do not, and TristateDefault if the source of trust doesn't have an opinion.
HasCapability(ctx context.Context, userId string, roomId string, capability Capability) (Tristate, error)
}
Source - represents a source of trust. "Trust" is arbitrarily defined as a set of capabilities applied to users in a room. This trust may be global, or it may be scoped to a community. Trust may also change over time.