fix(messaging): channel create permission logic

This commit is contained in:
Mitja Zivkovic
2019-02-27 20:34:36 +01:00
parent b7e2d9c127
commit 9c4cc0870d
+4 -4
View File
@@ -223,19 +223,19 @@ func (svc *channel) Create(in *types.Channel) (out *types.Channel, err error) {
}
}
if in.Topic != "" && svc.prm.CanUpdate(in) {
if in.Topic != "" && !svc.prm.CanUpdate(in) {
return errors.New("Not allowed to set channel topic")
}
if in.Type == types.ChannelTypePublic && svc.prm.CanCreatePublicChannel() {
if in.Type == types.ChannelTypePublic && !svc.prm.CanCreatePublicChannel() {
return errors.New("Not allowed to create public channels")
}
if in.Type == types.ChannelTypePrivate && svc.prm.CanCreatePrivateChannel() {
if in.Type == types.ChannelTypePrivate && !svc.prm.CanCreatePrivateChannel() {
return errors.New("Not allowed to create private channels")
}
if in.Type == types.ChannelTypeGroup && svc.prm.CanCreateDirectChannel() {
if in.Type == types.ChannelTypeGroup && !svc.prm.CanCreateDirectChannel() {
return errors.New("Not allowed to create group channels")
}