MM-14753: Verifies that user can join teams and channels in spite of group constraints. (#10529)
* MM-147753: Verifies that users are allowed to be members of a team or a channel, based on group constraints, prior to allowing the API to add them. * MM-14753: Allow methods to return meaningful results for deleted teams or channels. * MM-14753: Renames methods to differentiate from permissions and other team and channel restrictions. * MM-14753: Only check if users are team/channel members if team/channel is group constrained. * MM-14753: Updates test function names. * MM-14753: Changes a few method signatures. * MM-14753: Small refactor and adds missing returns. * MM-14753: Changes method names from Get* to Filter* name prefixes. * MM-14753: Renames error variables. * MM-14753: Updates method names for consistency with join table names. * MM-14753: Adds case for non AppError return. * Update i18n/en.json
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
43fa7e0548
Коммит
7bde0378cd
@@ -44,6 +44,7 @@ type TestHelper struct {
|
||||
BasicDeletedChannel *model.Channel
|
||||
BasicChannel2 *model.Channel
|
||||
BasicPost *model.Post
|
||||
Group *model.Group
|
||||
|
||||
SystemAdminClient *model.Client4
|
||||
SystemAdminUser *model.User
|
||||
@@ -210,6 +211,7 @@ func (me *TestHelper) InitBasic() *TestHelper {
|
||||
me.App.UpdateUserRoles(me.BasicUser.Id, model.SYSTEM_USER_ROLE_ID, false)
|
||||
me.Client.DeleteChannel(me.BasicDeletedChannel.Id)
|
||||
me.LoginBasic()
|
||||
me.Group = me.CreateGroup()
|
||||
|
||||
return me
|
||||
}
|
||||
@@ -509,6 +511,24 @@ func (me *TestHelper) GenerateTestEmail() string {
|
||||
return strings.ToLower(model.NewId() + "@dockerhost")
|
||||
}
|
||||
|
||||
func (me *TestHelper) CreateGroup() *model.Group {
|
||||
id := model.NewId()
|
||||
group := &model.Group{
|
||||
Name: "n-" + id,
|
||||
DisplayName: "dn_" + id,
|
||||
Source: model.GroupSourceLdap,
|
||||
RemoteId: "ri_" + id,
|
||||
}
|
||||
|
||||
utils.DisableDebugLogForTest()
|
||||
group, err := me.App.CreateGroup(group)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
utils.EnableDebugLogForTest()
|
||||
return group
|
||||
}
|
||||
|
||||
func GenerateTestUsername() string {
|
||||
return "fakeuser" + model.NewRandomString(10)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user