mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Updates migration tests to reflect front-end mapping changes. (#8237)
This commit is contained in:
committed by
Jesús Espino
parent
9325430859
commit
b7fc3d7d35
@@ -247,7 +247,7 @@ func (a *App) trackConfig() {
|
||||
|
||||
a.SendDiagnostic(TRACK_CONFIG_TEAM, map[string]interface{}{
|
||||
"enable_user_creation": cfg.TeamSettings.EnableUserCreation,
|
||||
"enable_team_creation": cfg.TeamSettings.EnableTeamCreation,
|
||||
"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,
|
||||
|
||||
@@ -962,7 +962,7 @@ func (s *ThemeSettings) SetDefaults() {
|
||||
type TeamSettings struct {
|
||||
SiteName string
|
||||
MaxUsersPerTeam *int
|
||||
EnableTeamCreation bool
|
||||
EnableTeamCreation *bool
|
||||
EnableUserCreation bool
|
||||
EnableOpenServer *bool
|
||||
RestrictCreationToDomains string
|
||||
@@ -1085,6 +1085,10 @@ func (s *TeamSettings) SetDefaults() {
|
||||
if s.ExperimentalPrimaryTeam == nil {
|
||||
s.ExperimentalPrimaryTeam = NewString("")
|
||||
}
|
||||
|
||||
if s.EnableTeamCreation == nil {
|
||||
s.EnableTeamCreation = NewBool(true)
|
||||
}
|
||||
}
|
||||
|
||||
type ClientRequirements struct {
|
||||
|
||||
@@ -260,7 +260,7 @@ func SetRolePermissionsFromConfig(roles map[string]*model.Role, cfg *model.Confi
|
||||
)
|
||||
}
|
||||
|
||||
if cfg.TeamSettings.EnableTeamCreation {
|
||||
if *cfg.TeamSettings.EnableTeamCreation {
|
||||
roles[model.SYSTEM_USER_ROLE_ID].Permissions = append(
|
||||
roles[model.SYSTEM_USER_ROLE_ID].Permissions,
|
||||
model.PERMISSION_CREATE_TEAM.Id,
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -112,7 +113,14 @@ func updateConfig(config *model.Config, key string, value string) {
|
||||
v = reflect.ValueOf(config.TeamSettings)
|
||||
field = v.FieldByName(key)
|
||||
}
|
||||
field.Elem().SetString(value)
|
||||
|
||||
switch value {
|
||||
case "true", "false":
|
||||
b, _ := strconv.ParseBool(value)
|
||||
field.Elem().SetBool(b)
|
||||
default:
|
||||
field.Elem().SetString(value)
|
||||
}
|
||||
}
|
||||
|
||||
func roleHasPermission(role *model.Role, permission string) bool {
|
||||
|
||||
@@ -354,7 +354,7 @@ func GenerateClientConfig(c *model.Config, diagnosticId string) map[string]strin
|
||||
|
||||
props["SiteURL"] = strings.TrimRight(*c.ServiceSettings.SiteURL, "/")
|
||||
props["SiteName"] = c.TeamSettings.SiteName
|
||||
props["EnableTeamCreation"] = strconv.FormatBool(c.TeamSettings.EnableTeamCreation)
|
||||
props["EnableTeamCreation"] = strconv.FormatBool(*c.TeamSettings.EnableTeamCreation)
|
||||
props["EnableUserCreation"] = strconv.FormatBool(c.TeamSettings.EnableUserCreation)
|
||||
props["EnableOpenServer"] = strconv.FormatBool(*c.TeamSettings.EnableOpenServer)
|
||||
props["RestrictDirectMessage"] = *c.TeamSettings.RestrictDirectMessage
|
||||
|
||||
@@ -431,16 +431,6 @@
|
||||
"permission": "delete_post",
|
||||
"shouldHave": true
|
||||
},
|
||||
{
|
||||
"roleName": "channel_admin",
|
||||
"permission": "delete_post",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "channel_admin",
|
||||
"permission": "delete_others_posts",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "team_admin",
|
||||
"permission": "delete_post",
|
||||
@@ -458,16 +448,6 @@
|
||||
"permission": "delete_post",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "channel_admin",
|
||||
"permission": "delete_post",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "channel_admin",
|
||||
"permission": "delete_others_posts",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "team_admin",
|
||||
"permission": "delete_post",
|
||||
@@ -485,16 +465,6 @@
|
||||
"permission": "delete_post",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "channel_admin",
|
||||
"permission": "delete_post",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "channel_admin",
|
||||
"permission": "delete_others_posts",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "team_admin",
|
||||
"permission": "delete_post",
|
||||
@@ -506,5 +476,57 @@
|
||||
"shouldHave": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"enableTeamCreation": {
|
||||
"true": [
|
||||
{
|
||||
"roleName": "system_user",
|
||||
"permission": "create_team",
|
||||
"shouldHave": true
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
{
|
||||
"roleName": "system_user",
|
||||
"permission": "create_team",
|
||||
"shouldHave": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"enableOnlyAdminIntegrations": {
|
||||
"true": [
|
||||
{
|
||||
"roleName": "team_user",
|
||||
"permission": "manage_webhooks",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "team_user",
|
||||
"permission": "manage_slash_commands",
|
||||
"shouldHave": false
|
||||
},
|
||||
{
|
||||
"roleName": "system_user",
|
||||
"permission": "manage_oauth",
|
||||
"shouldHave": false
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
{
|
||||
"roleName": "team_user",
|
||||
"permission": "manage_webhooks",
|
||||
"shouldHave": true
|
||||
},
|
||||
{
|
||||
"roleName": "team_user",
|
||||
"permission": "manage_slash_commands",
|
||||
"shouldHave": true
|
||||
},
|
||||
{
|
||||
"roleName": "system_user",
|
||||
"permission": "manage_oauth",
|
||||
"shouldHave": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user