MCPcopy
hub / github.com/tinode/chat / verifyChannelAccess

Method verifyChannelAccess

server/topic.go:3967–3975  ·  view source on GitHub ↗

Verifies if topic can be access by the provided name: access any topic as non-channel, access channel as channel. Returns true if access is for channel, false if not and error if access is invalid.

(asTopic string)

Source from the content-addressed store, hash-verified

3965// Verifies if topic can be access by the provided name: access any topic as non-channel, access channel as channel.
3966// Returns true if access is for channel, false if not and error if access is invalid.
3967func (t *Topic) verifyChannelAccess(asTopic string) (bool, error) {
3968 if !types.IsChannel(asTopic) {
3969 return false, nil
3970 }
3971 if t.isChan {
3972 return true, nil
3973 }
3974 return false, types.ErrNotFound
3975}
3976
3977// Infer topic category from name.
3978func topicCat(name string) types.TopicCat {

Callers 6

handleMetaMethod · 0.95
handleSubscriptionMethod · 0.95
handleLeaveRequestMethod · 0.95
handleNoteBroadcastMethod · 0.95
replyDelSubMethod · 0.95
replyLeaveUnsubMethod · 0.95

Calls 1

IsChannelFunction · 0.92

Tested by

no test coverage detected