From 5f7cb8cfbf879aa0b0d43a7b7068688368fda9fc Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 6 Jul 2016 08:23:24 -0400 Subject: PLT-3346/PLT-3342/PLT-3360 EE: Add the ability to restrict channel management permissions (#3453) * EE: Add the ability to restrict channel management permissions * Always allow last user in a channel to delete that channel --- model/config.go | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'model/config.go') diff --git a/model/config.go b/model/config.go index 32994a279..61c39bc5b 100644 --- a/model/config.go +++ b/model/config.go @@ -32,9 +32,9 @@ const ( DIRECT_MESSAGE_ANY = "any" DIRECT_MESSAGE_TEAM = "team" - TEAM_INVITE_ALL = "all" - TEAM_INVITE_TEAM_ADMIN = "team_admin" - TEAM_INVITE_SYSTEM_ADMIN = "system_admin" + PERMISSIONS_ALL = "all" + PERMISSIONS_TEAM_ADMIN = "team_admin" + PERMISSIONS_SYSTEM_ADMIN = "system_admin" FAKE_SETTING = "********************************" @@ -169,17 +169,19 @@ type SupportSettings struct { } type TeamSettings struct { - SiteName string - MaxUsersPerTeam int - EnableTeamCreation bool - EnableUserCreation bool - EnableOpenServer *bool - RestrictCreationToDomains string - RestrictTeamNames *bool - EnableCustomBrand *bool - CustomBrandText *string - RestrictDirectMessage *string - RestrictTeamInvite *string + SiteName string + MaxUsersPerTeam int + EnableTeamCreation bool + EnableUserCreation bool + EnableOpenServer *bool + RestrictCreationToDomains string + RestrictTeamNames *bool + EnableCustomBrand *bool + CustomBrandText *string + RestrictDirectMessage *string + RestrictTeamInvite *string + RestrictPublicChannelManagement *string + RestrictPrivateChannelManagement *string } type LdapSettings struct { @@ -381,7 +383,17 @@ func (o *Config) SetDefaults() { if o.TeamSettings.RestrictTeamInvite == nil { o.TeamSettings.RestrictTeamInvite = new(string) - *o.TeamSettings.RestrictTeamInvite = TEAM_INVITE_ALL + *o.TeamSettings.RestrictTeamInvite = PERMISSIONS_ALL + } + + if o.TeamSettings.RestrictPublicChannelManagement == nil { + o.TeamSettings.RestrictPublicChannelManagement = new(string) + *o.TeamSettings.RestrictPublicChannelManagement = PERMISSIONS_ALL + } + + if o.TeamSettings.RestrictPrivateChannelManagement == nil { + o.TeamSettings.RestrictPrivateChannelManagement = new(string) + *o.TeamSettings.RestrictPrivateChannelManagement = PERMISSIONS_ALL } if o.EmailSettings.EnableSignInWithEmail == nil { -- cgit v1.2.3-1-g7c22