Updates migration tests to reflect front-end mapping changes. (#8237)
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
9325430859
Коммит
b7fc3d7d35
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user