From 9c4cc0870dd638406b8fd85025cf294ed480e07d Mon Sep 17 00:00:00 2001 From: Mitja Zivkovic Date: Wed, 27 Feb 2019 20:31:29 +0100 Subject: [PATCH] fix(messaging): channel create permission logic --- messaging/service/channel.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/messaging/service/channel.go b/messaging/service/channel.go index 8eb39f099..ec2810921 100644 --- a/messaging/service/channel.go +++ b/messaging/service/channel.go @@ -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") }