MM-12815: Clearly deprecated disused config settings. (#9751)
* MM-12815: Clearly deprecated disused config settings. * Fix tests.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f23eeb56c7
Коммит
8d3cfc6ad7
@@ -218,15 +218,10 @@ func TestListCommands(t *testing.T) {
|
||||
Client := th.Client
|
||||
|
||||
enableCommands := *th.App.Config().ServiceSettings.EnableCommands
|
||||
enableOnlyAdminIntegrations := *th.App.Config().ServiceSettings.EnableOnlyAdminIntegrations
|
||||
defer func() {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableCommands = &enableCommands })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
cfg.ServiceSettings.EnableOnlyAdminIntegrations = &enableOnlyAdminIntegrations
|
||||
})
|
||||
}()
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableCommands = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOnlyAdminIntegrations = true })
|
||||
|
||||
newCmd := &model.Command{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
|
||||
@@ -571,7 +571,7 @@ func (a *App) DoAdvancedPermissionsMigration() {
|
||||
}
|
||||
|
||||
config := a.Config()
|
||||
if *config.ServiceSettings.AllowEditPost == model.ALLOW_EDIT_POST_ALWAYS {
|
||||
if *config.ServiceSettings.DEPRECATED_DO_NOT_USE_AllowEditPost == model.ALLOW_EDIT_POST_ALWAYS {
|
||||
*config.ServiceSettings.PostEditTimeLimit = -1
|
||||
if err := a.SaveConfig(config, true); err != nil {
|
||||
mlog.Error("Failed to update config in Advanced Permissions Phase 1 Migration.", mlog.String("error", err.Error()))
|
||||
@@ -611,7 +611,7 @@ func (a *App) DoEmojisPermissionsMigration() {
|
||||
var err *model.AppError = nil
|
||||
|
||||
mlog.Info("Migrating emojis config to database.")
|
||||
switch *a.Config().ServiceSettings.RestrictCustomEmojiCreation {
|
||||
switch *a.Config().ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation {
|
||||
case model.RESTRICT_EMOJI_CREATION_ALL:
|
||||
role, err = a.GetRoleByName(model.SYSTEM_USER_ROLE_ID)
|
||||
if err != nil {
|
||||
|
||||
@@ -242,19 +242,19 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
}
|
||||
|
||||
// Add a license and change the policy config.
|
||||
restrictPublicChannel := *th.App.Config().TeamSettings.RestrictPublicChannelManagement
|
||||
restrictPrivateChannel := *th.App.Config().TeamSettings.RestrictPrivateChannelManagement
|
||||
restrictPublicChannel := *th.App.Config().TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement
|
||||
restrictPrivateChannel := *th.App.Config().TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement
|
||||
|
||||
defer func() {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.RestrictPublicChannelManagement = restrictPublicChannel })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.RestrictPrivateChannelManagement = restrictPrivateChannel })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement = restrictPublicChannel })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement = restrictPrivateChannel })
|
||||
}()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.TeamSettings.RestrictPublicChannelManagement = model.PERMISSIONS_TEAM_ADMIN
|
||||
*cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement = model.PERMISSIONS_TEAM_ADMIN
|
||||
})
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.TeamSettings.RestrictPrivateChannelManagement = model.PERMISSIONS_TEAM_ADMIN
|
||||
*cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement = model.PERMISSIONS_TEAM_ADMIN
|
||||
})
|
||||
th.App.SetLicense(model.NewTestLicense())
|
||||
|
||||
@@ -429,30 +429,34 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
// Check that the config setting for "always" and "time_limit" edit posts is updated correctly.
|
||||
th.ResetRoleMigration()
|
||||
|
||||
config := th.App.GetConfig()
|
||||
*config.ServiceSettings.AllowEditPost = "always"
|
||||
*config.ServiceSettings.PostEditTimeLimit = 300
|
||||
th.App.SaveConfig(config, false)
|
||||
allowEditPost := *th.App.Config().ServiceSettings.DEPRECATED_DO_NOT_USE_AllowEditPost
|
||||
postEditTimeLimit := *th.App.Config().ServiceSettings.PostEditTimeLimit
|
||||
|
||||
defer func() {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_AllowEditPost = allowEditPost})
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.PostEditTimeLimit = postEditTimeLimit})
|
||||
}()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_AllowEditPost = "always"
|
||||
*cfg.ServiceSettings.PostEditTimeLimit = 300
|
||||
})
|
||||
|
||||
th.App.DoAdvancedPermissionsMigration()
|
||||
config = th.App.GetConfig()
|
||||
|
||||
config := th.App.GetConfig()
|
||||
assert.Equal(t, -1, *config.ServiceSettings.PostEditTimeLimit)
|
||||
|
||||
th.ResetRoleMigration()
|
||||
|
||||
config = th.App.GetConfig()
|
||||
*config.ServiceSettings.AllowEditPost = "time_limit"
|
||||
*config.ServiceSettings.PostEditTimeLimit = 300
|
||||
th.App.SaveConfig(config, false)
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_AllowEditPost = "time_limit"
|
||||
*cfg.ServiceSettings.PostEditTimeLimit = 300
|
||||
})
|
||||
|
||||
th.App.DoAdvancedPermissionsMigration()
|
||||
config = th.App.GetConfig()
|
||||
assert.Equal(t, 300, *config.ServiceSettings.PostEditTimeLimit)
|
||||
|
||||
config = th.App.GetConfig()
|
||||
*config.ServiceSettings.AllowEditPost = "always"
|
||||
*config.ServiceSettings.PostEditTimeLimit = 300
|
||||
th.App.SaveConfig(config, false)
|
||||
}
|
||||
|
||||
func TestDoEmojisPermissionsMigration(t *testing.T) {
|
||||
@@ -464,16 +468,16 @@ func TestDoEmojisPermissionsMigration(t *testing.T) {
|
||||
}
|
||||
|
||||
// Add a license and change the policy config.
|
||||
restrictCustomEmojiCreation := *th.App.Config().ServiceSettings.RestrictCustomEmojiCreation
|
||||
restrictCustomEmojiCreation := *th.App.Config().ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation
|
||||
|
||||
defer func() {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.RestrictCustomEmojiCreation = restrictCustomEmojiCreation
|
||||
*cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation = restrictCustomEmojiCreation
|
||||
})
|
||||
}()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.RestrictCustomEmojiCreation = model.RESTRICT_EMOJI_CREATION_SYSTEM_ADMIN
|
||||
*cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation = model.RESTRICT_EMOJI_CREATION_SYSTEM_ADMIN
|
||||
})
|
||||
|
||||
th.ResetEmojisMigration()
|
||||
@@ -538,7 +542,7 @@ func TestDoEmojisPermissionsMigration(t *testing.T) {
|
||||
assert.Equal(t, expectedSystemAdmin, role1.Permissions, fmt.Sprintf("'%v' did not have expected permissions", model.SYSTEM_ADMIN_ROLE_ID))
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.RestrictCustomEmojiCreation = model.RESTRICT_EMOJI_CREATION_ADMIN
|
||||
*cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation = model.RESTRICT_EMOJI_CREATION_ADMIN
|
||||
})
|
||||
|
||||
th.ResetEmojisMigration()
|
||||
@@ -567,7 +571,7 @@ func TestDoEmojisPermissionsMigration(t *testing.T) {
|
||||
assert.Equal(t, expectedSystemAdmin, systemAdmin1.Permissions, fmt.Sprintf("'%v' did not have expected permissions", model.SYSTEM_ADMIN_ROLE_ID))
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.RestrictCustomEmojiCreation = model.RESTRICT_EMOJI_CREATION_ALL
|
||||
*cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation = model.RESTRICT_EMOJI_CREATION_ALL
|
||||
})
|
||||
|
||||
th.ResetEmojisMigration()
|
||||
|
||||
@@ -202,7 +202,7 @@ func (a *App) trackConfig() {
|
||||
"enable_incoming_webhooks": cfg.ServiceSettings.EnableIncomingWebhooks,
|
||||
"enable_outgoing_webhooks": cfg.ServiceSettings.EnableOutgoingWebhooks,
|
||||
"enable_commands": *cfg.ServiceSettings.EnableCommands,
|
||||
"enable_only_admin_integrations": *cfg.ServiceSettings.EnableOnlyAdminIntegrations,
|
||||
"enable_only_admin_integrations": *cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_EnableOnlyAdminIntegrations,
|
||||
"enable_post_username_override": cfg.ServiceSettings.EnablePostUsernameOverride,
|
||||
"enable_post_icon_override": cfg.ServiceSettings.EnablePostIconOverride,
|
||||
"enable_user_access_tokens": *cfg.ServiceSettings.EnableUserAccessTokens,
|
||||
@@ -212,7 +212,7 @@ func (a *App) trackConfig() {
|
||||
"gfycat_api_key": isDefault(*cfg.ServiceSettings.GfycatApiKey, model.SERVICE_SETTINGS_DEFAULT_GFYCAT_API_KEY),
|
||||
"gfycat_api_secret": isDefault(*cfg.ServiceSettings.GfycatApiSecret, model.SERVICE_SETTINGS_DEFAULT_GFYCAT_API_SECRET),
|
||||
"experimental_enable_authentication_transfer": *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer,
|
||||
"restrict_custom_emoji_creation": *cfg.ServiceSettings.RestrictCustomEmojiCreation,
|
||||
"restrict_custom_emoji_creation": *cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation,
|
||||
"enable_testing": cfg.ServiceSettings.EnableTesting,
|
||||
"enable_developer": *cfg.ServiceSettings.EnableDeveloper,
|
||||
"enable_multifactor_authentication": *cfg.ServiceSettings.EnableMultifactorAuthentication,
|
||||
@@ -238,8 +238,8 @@ func (a *App) trackConfig() {
|
||||
"cors_allow_credentials": *cfg.ServiceSettings.CorsAllowCredentials,
|
||||
"cors_debug": *cfg.ServiceSettings.CorsDebug,
|
||||
"isdefault_allowed_untrusted_internal_connections": isDefault(*cfg.ServiceSettings.AllowedUntrustedInternalConnections, ""),
|
||||
"restrict_post_delete": *cfg.ServiceSettings.RestrictPostDelete,
|
||||
"allow_edit_post": *cfg.ServiceSettings.AllowEditPost,
|
||||
"restrict_post_delete": *cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictPostDelete,
|
||||
"allow_edit_post": *cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_AllowEditPost,
|
||||
"post_edit_time_limit": *cfg.ServiceSettings.PostEditTimeLimit,
|
||||
"enable_user_typing_messages": *cfg.ServiceSettings.EnableUserTypingMessages,
|
||||
"enable_channel_viewed_messages": *cfg.ServiceSettings.EnableChannelViewedMessages,
|
||||
@@ -265,14 +265,14 @@ func (a *App) trackConfig() {
|
||||
|
||||
a.SendDiagnostic(TRACK_CONFIG_TEAM, map[string]interface{}{
|
||||
"enable_user_creation": cfg.TeamSettings.EnableUserCreation,
|
||||
"enable_team_creation": *cfg.TeamSettings.EnableTeamCreation,
|
||||
"restrict_team_invite": *cfg.TeamSettings.RestrictTeamInvite,
|
||||
"restrict_public_channel_creation": *cfg.TeamSettings.RestrictPublicChannelCreation,
|
||||
"restrict_private_channel_creation": *cfg.TeamSettings.RestrictPrivateChannelCreation,
|
||||
"restrict_public_channel_management": *cfg.TeamSettings.RestrictPublicChannelManagement,
|
||||
"restrict_private_channel_management": *cfg.TeamSettings.RestrictPrivateChannelManagement,
|
||||
"restrict_public_channel_deletion": *cfg.TeamSettings.RestrictPublicChannelDeletion,
|
||||
"restrict_private_channel_deletion": *cfg.TeamSettings.RestrictPrivateChannelDeletion,
|
||||
"enable_team_creation": *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_EnableTeamCreation,
|
||||
"restrict_team_invite": *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictTeamInvite,
|
||||
"restrict_public_channel_creation": *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation,
|
||||
"restrict_private_channel_creation": *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation,
|
||||
"restrict_public_channel_management": *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement,
|
||||
"restrict_private_channel_management": *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement,
|
||||
"restrict_public_channel_deletion": *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPublicChannelDeletion,
|
||||
"restrict_private_channel_deletion": *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelDeletion,
|
||||
"enable_open_server": *cfg.TeamSettings.EnableOpenServer,
|
||||
"enable_user_deactivation": *cfg.TeamSettings.EnableUserDeactivation,
|
||||
"enable_custom_brand": *cfg.TeamSettings.EnableCustomBrand,
|
||||
@@ -287,7 +287,7 @@ func (a *App) trackConfig() {
|
||||
"isdefault_custom_brand_text": isDefault(*cfg.TeamSettings.CustomBrandText, model.TEAM_SETTINGS_DEFAULT_CUSTOM_BRAND_TEXT),
|
||||
"isdefault_custom_description_text": isDefault(*cfg.TeamSettings.CustomDescriptionText, model.TEAM_SETTINGS_DEFAULT_CUSTOM_DESCRIPTION_TEXT),
|
||||
"isdefault_user_status_away_timeout": isDefault(*cfg.TeamSettings.UserStatusAwayTimeout, model.TEAM_SETTINGS_DEFAULT_USER_STATUS_AWAY_TIMEOUT),
|
||||
"restrict_private_channel_manage_members": *cfg.TeamSettings.RestrictPrivateChannelManageMembers,
|
||||
"restrict_private_channel_manage_members": *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManageMembers,
|
||||
"enable_X_to_leave_channels_from_LHS": *cfg.TeamSettings.EnableXToLeaveChannelsFromLHS,
|
||||
"experimental_enable_automatic_replies": *cfg.TeamSettings.ExperimentalEnableAutomaticReplies,
|
||||
"experimental_town_square_is_hidden_in_lhs": *cfg.TeamSettings.ExperimentalHideTownSquareinLHS,
|
||||
|
||||
@@ -93,7 +93,6 @@ func serverForWebClientTestsCmdF(command *cobra.Command, args []string) error {
|
||||
func setupClientTests(cfg *model.Config) {
|
||||
*cfg.TeamSettings.EnableOpenServer = true
|
||||
*cfg.ServiceSettings.EnableCommands = false
|
||||
*cfg.ServiceSettings.EnableOnlyAdminIntegrations = false
|
||||
*cfg.ServiceSettings.EnableCustomEmoji = true
|
||||
cfg.ServiceSettings.EnableIncomingWebhooks = false
|
||||
cfg.ServiceSettings.EnableOutgoingWebhooks = false
|
||||
|
||||
132
model/config.go
132
model/config.go
@@ -222,7 +222,7 @@ type ServiceSettings struct {
|
||||
EnableIncomingWebhooks bool
|
||||
EnableOutgoingWebhooks bool
|
||||
EnableCommands *bool
|
||||
EnableOnlyAdminIntegrations *bool
|
||||
DEPRECATED_DO_NOT_USE_EnableOnlyAdminIntegrations *bool `json:"EnableOnlyAdminIntegrations"` // This field is deprecated and must not be used.
|
||||
EnablePostUsernameOverride bool
|
||||
EnablePostIconOverride bool
|
||||
EnableLinkPreviews *bool
|
||||
@@ -252,9 +252,9 @@ type ServiceSettings struct {
|
||||
EnableGifPicker *bool
|
||||
GfycatApiKey *string
|
||||
GfycatApiSecret *string
|
||||
RestrictCustomEmojiCreation *string
|
||||
RestrictPostDelete *string
|
||||
AllowEditPost *string
|
||||
DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation *string `json:"RestrictCustomEmojiCreation"` // This field is deprecated and must not be used.
|
||||
DEPRECATED_DO_NOT_USE_RestrictPostDelete *string `json:"RestrictPostDelete"` // This field is deprecated and must not be used.
|
||||
DEPRECATED_DO_NOT_USE_AllowEditPost *string `json:"AllowEditPost"` // This field is deprecated and must not be used.
|
||||
PostEditTimeLimit *int
|
||||
TimeBetweenUserTypingUpdatesMilliseconds *int64
|
||||
EnablePostSearch *bool
|
||||
@@ -447,8 +447,8 @@ func (s *ServiceSettings) SetDefaults() {
|
||||
s.EnableCommands = NewBool(false)
|
||||
}
|
||||
|
||||
if s.EnableOnlyAdminIntegrations == nil {
|
||||
s.EnableOnlyAdminIntegrations = NewBool(true)
|
||||
if s.DEPRECATED_DO_NOT_USE_EnableOnlyAdminIntegrations == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_EnableOnlyAdminIntegrations = NewBool(true)
|
||||
}
|
||||
|
||||
if s.WebsocketPort == nil {
|
||||
@@ -505,16 +505,16 @@ func (s *ServiceSettings) SetDefaults() {
|
||||
s.GfycatApiSecret = NewString(SERVICE_SETTINGS_DEFAULT_GFYCAT_API_SECRET)
|
||||
}
|
||||
|
||||
if s.RestrictCustomEmojiCreation == nil {
|
||||
s.RestrictCustomEmojiCreation = NewString(RESTRICT_EMOJI_CREATION_ALL)
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation = NewString(RESTRICT_EMOJI_CREATION_ALL)
|
||||
}
|
||||
|
||||
if s.RestrictPostDelete == nil {
|
||||
s.RestrictPostDelete = NewString(PERMISSIONS_DELETE_POST_ALL)
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictPostDelete == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictPostDelete = NewString(PERMISSIONS_DELETE_POST_ALL)
|
||||
}
|
||||
|
||||
if s.AllowEditPost == nil {
|
||||
s.AllowEditPost = NewString(ALLOW_EDIT_POST_ALWAYS)
|
||||
if s.DEPRECATED_DO_NOT_USE_AllowEditPost == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_AllowEditPost = NewString(ALLOW_EDIT_POST_ALWAYS)
|
||||
}
|
||||
|
||||
if s.ExperimentalEnableAuthenticationTransfer == nil {
|
||||
@@ -1145,37 +1145,37 @@ func (s *ThemeSettings) SetDefaults() {
|
||||
}
|
||||
|
||||
type TeamSettings struct {
|
||||
SiteName string
|
||||
MaxUsersPerTeam *int
|
||||
EnableTeamCreation *bool
|
||||
EnableUserCreation *bool
|
||||
EnableOpenServer *bool
|
||||
EnableUserDeactivation *bool
|
||||
RestrictCreationToDomains string
|
||||
EnableCustomBrand *bool
|
||||
CustomBrandText *string
|
||||
CustomDescriptionText *string
|
||||
RestrictDirectMessage *string
|
||||
RestrictTeamInvite *string
|
||||
RestrictPublicChannelManagement *string
|
||||
RestrictPrivateChannelManagement *string
|
||||
RestrictPublicChannelCreation *string
|
||||
RestrictPrivateChannelCreation *string
|
||||
RestrictPublicChannelDeletion *string
|
||||
RestrictPrivateChannelDeletion *string
|
||||
RestrictPrivateChannelManageMembers *string
|
||||
EnableXToLeaveChannelsFromLHS *bool
|
||||
UserStatusAwayTimeout *int64
|
||||
MaxChannelsPerTeam *int64
|
||||
MaxNotificationsPerChannel *int64
|
||||
EnableConfirmNotificationsToChannel *bool
|
||||
TeammateNameDisplay *string
|
||||
ExperimentalViewArchivedChannels *bool
|
||||
ExperimentalEnableAutomaticReplies *bool
|
||||
ExperimentalHideTownSquareinLHS *bool
|
||||
ExperimentalTownSquareIsReadOnly *bool
|
||||
ExperimentalPrimaryTeam *string
|
||||
ExperimentalDefaultChannels []string
|
||||
SiteName string
|
||||
MaxUsersPerTeam *int
|
||||
DEPRECATED_DO_NOT_USE_EnableTeamCreation *bool `json:"EnableTeamCreation"` // This field is deprecated and must not be used.
|
||||
EnableUserCreation *bool
|
||||
EnableOpenServer *bool
|
||||
EnableUserDeactivation *bool
|
||||
RestrictCreationToDomains string
|
||||
EnableCustomBrand *bool
|
||||
CustomBrandText *string
|
||||
CustomDescriptionText *string
|
||||
RestrictDirectMessage *string
|
||||
DEPRECATED_DO_NOT_USE_RestrictTeamInvite *string `json:"RestrictTeamInvite"` // This field is deprecated and must not be used.
|
||||
DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement *string `json:"RestrictPublicChannelManagement"` // This field is deprecated and must not be used.
|
||||
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement *string `json:"RestrictPrivateChannelManagement"` // This field is deprecated and must not be used.
|
||||
DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation *string `json:"RestrictPublicChannelCreation"` // This field is deprecated and must not be used.
|
||||
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation *string `json:"RestrictPrivateChannelCreation"` // This field is deprecated and must not be used.
|
||||
DEPRECATED_DO_NOT_USE_RestrictPublicChannelDeletion *string `json:"RestrictPublicChannelDeletion"` // This field is deprecated and must not be used.
|
||||
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelDeletion *string `json:"RestrictPrivateChannelDeletion"` // This field is deprecated and must not be used.
|
||||
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManageMembers *string `json:"RestrictPrivateChannelManageMembers"` // This field is deprecated and must not be used.
|
||||
EnableXToLeaveChannelsFromLHS *bool
|
||||
UserStatusAwayTimeout *int64
|
||||
MaxChannelsPerTeam *int64
|
||||
MaxNotificationsPerChannel *int64
|
||||
EnableConfirmNotificationsToChannel *bool
|
||||
TeammateNameDisplay *string
|
||||
ExperimentalViewArchivedChannels *bool
|
||||
ExperimentalEnableAutomaticReplies *bool
|
||||
ExperimentalHideTownSquareinLHS *bool
|
||||
ExperimentalTownSquareIsReadOnly *bool
|
||||
ExperimentalPrimaryTeam *string
|
||||
ExperimentalDefaultChannels []string
|
||||
}
|
||||
|
||||
func (s *TeamSettings) SetDefaults() {
|
||||
@@ -1207,49 +1207,49 @@ func (s *TeamSettings) SetDefaults() {
|
||||
s.RestrictDirectMessage = NewString(DIRECT_MESSAGE_ANY)
|
||||
}
|
||||
|
||||
if s.RestrictTeamInvite == nil {
|
||||
s.RestrictTeamInvite = NewString(PERMISSIONS_ALL)
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictTeamInvite == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictTeamInvite = NewString(PERMISSIONS_ALL)
|
||||
}
|
||||
|
||||
if s.RestrictPublicChannelManagement == nil {
|
||||
s.RestrictPublicChannelManagement = NewString(PERMISSIONS_ALL)
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement = NewString(PERMISSIONS_ALL)
|
||||
}
|
||||
|
||||
if s.RestrictPrivateChannelManagement == nil {
|
||||
s.RestrictPrivateChannelManagement = NewString(PERMISSIONS_ALL)
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement = NewString(PERMISSIONS_ALL)
|
||||
}
|
||||
|
||||
if s.RestrictPublicChannelCreation == nil {
|
||||
s.RestrictPublicChannelCreation = new(string)
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation = new(string)
|
||||
// If this setting does not exist, assume migration from <3.6, so use management setting as default.
|
||||
if *s.RestrictPublicChannelManagement == PERMISSIONS_CHANNEL_ADMIN {
|
||||
*s.RestrictPublicChannelCreation = PERMISSIONS_TEAM_ADMIN
|
||||
if *s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement == PERMISSIONS_CHANNEL_ADMIN {
|
||||
*s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation = PERMISSIONS_TEAM_ADMIN
|
||||
} else {
|
||||
*s.RestrictPublicChannelCreation = *s.RestrictPublicChannelManagement
|
||||
*s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation = *s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement
|
||||
}
|
||||
}
|
||||
|
||||
if s.RestrictPrivateChannelCreation == nil {
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation == nil {
|
||||
// If this setting does not exist, assume migration from <3.6, so use management setting as default.
|
||||
if *s.RestrictPrivateChannelManagement == PERMISSIONS_CHANNEL_ADMIN {
|
||||
s.RestrictPrivateChannelCreation = NewString(PERMISSIONS_TEAM_ADMIN)
|
||||
if *s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement == PERMISSIONS_CHANNEL_ADMIN {
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation = NewString(PERMISSIONS_TEAM_ADMIN)
|
||||
} else {
|
||||
s.RestrictPrivateChannelCreation = NewString(*s.RestrictPrivateChannelManagement)
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation = NewString(*s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement)
|
||||
}
|
||||
}
|
||||
|
||||
if s.RestrictPublicChannelDeletion == nil {
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelDeletion == nil {
|
||||
// If this setting does not exist, assume migration from <3.6, so use management setting as default.
|
||||
s.RestrictPublicChannelDeletion = NewString(*s.RestrictPublicChannelManagement)
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelDeletion = NewString(*s.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement)
|
||||
}
|
||||
|
||||
if s.RestrictPrivateChannelDeletion == nil {
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelDeletion == nil {
|
||||
// If this setting does not exist, assume migration from <3.6, so use management setting as default.
|
||||
s.RestrictPrivateChannelDeletion = NewString(*s.RestrictPrivateChannelManagement)
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelDeletion = NewString(*s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement)
|
||||
}
|
||||
|
||||
if s.RestrictPrivateChannelManageMembers == nil {
|
||||
s.RestrictPrivateChannelManageMembers = NewString(PERMISSIONS_ALL)
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManageMembers == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManageMembers = NewString(PERMISSIONS_ALL)
|
||||
}
|
||||
|
||||
if s.EnableXToLeaveChannelsFromLHS == nil {
|
||||
@@ -1292,8 +1292,8 @@ func (s *TeamSettings) SetDefaults() {
|
||||
s.ExperimentalDefaultChannels = []string{}
|
||||
}
|
||||
|
||||
if s.EnableTeamCreation == nil {
|
||||
s.EnableTeamCreation = NewBool(true)
|
||||
if s.DEPRECATED_DO_NOT_USE_EnableTeamCreation == nil {
|
||||
s.DEPRECATED_DO_NOT_USE_EnableTeamCreation = NewBool(true)
|
||||
}
|
||||
|
||||
if s.EnableUserCreation == nil {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Config, isLicensed bool) map[string]*model.Role {
|
||||
if isLicensed {
|
||||
switch *cfg.TeamSettings.RestrictPublicChannelCreation {
|
||||
switch *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation {
|
||||
case model.PERMISSIONS_ALL:
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions,
|
||||
@@ -29,7 +29,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
}
|
||||
|
||||
if isLicensed {
|
||||
switch *cfg.TeamSettings.RestrictPublicChannelManagement {
|
||||
switch *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement {
|
||||
case model.PERMISSIONS_ALL:
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions,
|
||||
@@ -58,7 +58,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
}
|
||||
|
||||
if isLicensed {
|
||||
switch *cfg.TeamSettings.RestrictPublicChannelDeletion {
|
||||
switch *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPublicChannelDeletion {
|
||||
case model.PERMISSIONS_ALL:
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions,
|
||||
@@ -87,7 +87,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
}
|
||||
|
||||
if isLicensed {
|
||||
switch *cfg.TeamSettings.RestrictPrivateChannelCreation {
|
||||
switch *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation {
|
||||
case model.PERMISSIONS_ALL:
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions,
|
||||
@@ -107,7 +107,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
}
|
||||
|
||||
if isLicensed {
|
||||
switch *cfg.TeamSettings.RestrictPrivateChannelManagement {
|
||||
switch *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement {
|
||||
case model.PERMISSIONS_ALL:
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions,
|
||||
@@ -136,7 +136,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
}
|
||||
|
||||
if isLicensed {
|
||||
switch *cfg.TeamSettings.RestrictPrivateChannelDeletion {
|
||||
switch *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelDeletion {
|
||||
case model.PERMISSIONS_ALL:
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions,
|
||||
@@ -166,7 +166,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
|
||||
// Restrict permissions for Private Channel Manage Members
|
||||
if isLicensed {
|
||||
switch *cfg.TeamSettings.RestrictPrivateChannelManageMembers {
|
||||
switch *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManageMembers {
|
||||
case model.PERMISSIONS_ALL:
|
||||
roles[model.CHANNEL_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.CHANNEL_USER_ROLE_ID].Permissions,
|
||||
@@ -194,7 +194,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
)
|
||||
}
|
||||
|
||||
if !*cfg.ServiceSettings.EnableOnlyAdminIntegrations {
|
||||
if !*cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_EnableOnlyAdminIntegrations {
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions,
|
||||
model.PERMISSION_MANAGE_WEBHOOKS.Id,
|
||||
@@ -208,13 +208,13 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
|
||||
// Grant permissions for inviting and adding users to a team.
|
||||
if isLicensed {
|
||||
if *cfg.TeamSettings.RestrictTeamInvite == model.PERMISSIONS_TEAM_ADMIN {
|
||||
if *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictTeamInvite == model.PERMISSIONS_TEAM_ADMIN {
|
||||
roles[model.TEAM_ADMIN_ROLE_ID].Permissions = append(
|
||||
roles[model.TEAM_ADMIN_ROLE_ID].Permissions,
|
||||
model.PERMISSION_INVITE_USER.Id,
|
||||
model.PERMISSION_ADD_USER_TO_TEAM.Id,
|
||||
)
|
||||
} else if *cfg.TeamSettings.RestrictTeamInvite == model.PERMISSIONS_ALL {
|
||||
} else if *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_RestrictTeamInvite == model.PERMISSIONS_ALL {
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.TEAM_USER_ROLE_ID].Permissions,
|
||||
model.PERMISSION_INVITE_USER.Id,
|
||||
@@ -230,7 +230,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
}
|
||||
|
||||
if isLicensed {
|
||||
switch *cfg.ServiceSettings.RestrictPostDelete {
|
||||
switch *cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictPostDelete {
|
||||
case model.PERMISSIONS_DELETE_POST_ALL:
|
||||
roles[model.CHANNEL_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.CHANNEL_USER_ROLE_ID].Permissions,
|
||||
@@ -260,7 +260,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
)
|
||||
}
|
||||
|
||||
if *cfg.TeamSettings.EnableTeamCreation {
|
||||
if *cfg.TeamSettings.DEPRECATED_DO_NOT_USE_EnableTeamCreation {
|
||||
roles[model.SYSTEM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.SYSTEM_USER_ROLE_ID].Permissions,
|
||||
model.PERMISSION_CREATE_TEAM.Id,
|
||||
@@ -268,7 +268,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
}
|
||||
|
||||
if isLicensed {
|
||||
switch *cfg.ServiceSettings.AllowEditPost {
|
||||
switch *cfg.ServiceSettings.DEPRECATED_DO_NOT_USE_AllowEditPost {
|
||||
case model.ALLOW_EDIT_POST_ALWAYS, model.ALLOW_EDIT_POST_TIME_LIMIT:
|
||||
roles[model.CHANNEL_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.CHANNEL_USER_ROLE_ID].Permissions,
|
||||
|
||||
@@ -82,7 +82,7 @@ func TestSetRolePermissionsFromConfig(t *testing.T) {
|
||||
for policyValue, rolesMappings := range v {
|
||||
|
||||
config := mockConfig()
|
||||
updateConfig(config, policyName, policyValue)
|
||||
updateConfig(config, "DEPRECATED_DO_NOT_USE_"+policyName, policyValue)
|
||||
roles := model.MakeDefaultRoles()
|
||||
SetRolePermissionsFromConfig(roles, config, true)
|
||||
|
||||
|
||||
@@ -518,14 +518,6 @@ func GenerateClientConfig(c *model.Config, diagnosticId string, license *model.L
|
||||
props["WebsocketURL"] = strings.TrimRight(*c.ServiceSettings.WebsocketURL, "/")
|
||||
props["EnableUserDeactivation"] = strconv.FormatBool(*c.TeamSettings.EnableUserDeactivation)
|
||||
props["RestrictDirectMessage"] = *c.TeamSettings.RestrictDirectMessage
|
||||
props["RestrictTeamInvite"] = *c.TeamSettings.RestrictTeamInvite
|
||||
props["RestrictPublicChannelCreation"] = *c.TeamSettings.RestrictPublicChannelCreation
|
||||
props["RestrictPrivateChannelCreation"] = *c.TeamSettings.RestrictPrivateChannelCreation
|
||||
props["RestrictPublicChannelManagement"] = *c.TeamSettings.RestrictPublicChannelManagement
|
||||
props["RestrictPrivateChannelManagement"] = *c.TeamSettings.RestrictPrivateChannelManagement
|
||||
props["RestrictPublicChannelDeletion"] = *c.TeamSettings.RestrictPublicChannelDeletion
|
||||
props["RestrictPrivateChannelDeletion"] = *c.TeamSettings.RestrictPrivateChannelDeletion
|
||||
props["RestrictPrivateChannelManageMembers"] = *c.TeamSettings.RestrictPrivateChannelManageMembers
|
||||
props["EnableXToLeaveChannelsFromLHS"] = strconv.FormatBool(*c.TeamSettings.EnableXToLeaveChannelsFromLHS)
|
||||
props["TeammateNameDisplay"] = *c.TeamSettings.TeammateNameDisplay
|
||||
props["ExperimentalPrimaryTeam"] = *c.TeamSettings.ExperimentalPrimaryTeam
|
||||
@@ -536,15 +528,12 @@ func GenerateClientConfig(c *model.Config, diagnosticId string, license *model.L
|
||||
props["EnableIncomingWebhooks"] = strconv.FormatBool(c.ServiceSettings.EnableIncomingWebhooks)
|
||||
props["EnableOutgoingWebhooks"] = strconv.FormatBool(c.ServiceSettings.EnableOutgoingWebhooks)
|
||||
props["EnableCommands"] = strconv.FormatBool(*c.ServiceSettings.EnableCommands)
|
||||
props["EnableOnlyAdminIntegrations"] = strconv.FormatBool(*c.ServiceSettings.EnableOnlyAdminIntegrations)
|
||||
props["EnablePostUsernameOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostUsernameOverride)
|
||||
props["EnablePostIconOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostIconOverride)
|
||||
props["EnableUserAccessTokens"] = strconv.FormatBool(*c.ServiceSettings.EnableUserAccessTokens)
|
||||
props["EnableLinkPreviews"] = strconv.FormatBool(*c.ServiceSettings.EnableLinkPreviews)
|
||||
props["EnableTesting"] = strconv.FormatBool(c.ServiceSettings.EnableTesting)
|
||||
props["EnableDeveloper"] = strconv.FormatBool(*c.ServiceSettings.EnableDeveloper)
|
||||
props["RestrictPostDelete"] = *c.ServiceSettings.RestrictPostDelete
|
||||
props["AllowEditPost"] = *c.ServiceSettings.AllowEditPost
|
||||
props["PostEditTimeLimit"] = fmt.Sprintf("%v", *c.ServiceSettings.PostEditTimeLimit)
|
||||
props["CloseUnusedDirectMessages"] = strconv.FormatBool(*c.ServiceSettings.CloseUnusedDirectMessages)
|
||||
props["EnablePreviewFeatures"] = strconv.FormatBool(*c.ServiceSettings.EnablePreviewFeatures)
|
||||
@@ -583,7 +572,6 @@ func GenerateClientConfig(c *model.Config, diagnosticId string, license *model.L
|
||||
props["EnableGifPicker"] = strconv.FormatBool(*c.ServiceSettings.EnableGifPicker)
|
||||
props["GfycatApiKey"] = *c.ServiceSettings.GfycatApiKey
|
||||
props["GfycatApiSecret"] = *c.ServiceSettings.GfycatApiSecret
|
||||
props["RestrictCustomEmojiCreation"] = *c.ServiceSettings.RestrictCustomEmojiCreation
|
||||
props["MaxFileSize"] = strconv.FormatInt(*c.FileSettings.MaxFileSize, 10)
|
||||
|
||||
props["MaxNotificationsPerChannel"] = strconv.FormatInt(*c.TeamSettings.MaxNotificationsPerChannel, 10)
|
||||
@@ -719,7 +707,6 @@ func GenerateLimitedClientConfig(c *model.Config, diagnosticId string, license *
|
||||
props["BuildEnterpriseReady"] = model.BuildEnterpriseReady
|
||||
|
||||
props["SiteName"] = c.TeamSettings.SiteName
|
||||
props["EnableTeamCreation"] = strconv.FormatBool(*c.TeamSettings.EnableTeamCreation)
|
||||
props["EnableUserCreation"] = strconv.FormatBool(*c.TeamSettings.EnableUserCreation)
|
||||
props["EnableOpenServer"] = strconv.FormatBool(*c.TeamSettings.EnableOpenServer)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user