MM-14757/14758: Restricts deleting team and channel members if the team or channel is group constrained. (#10553)
* MM-14757/14758: Update APIs to reject removals from group-constrained teams. * MM-14757/14758: Tests API changes. * MM-14757/14758: Allow users to leave channals and teams. * MM-14757/14758: Updates translation key order. * MM-14757/14758: Adds user to team before setting it to group-constrained b/c of new add restrictions.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f93ba3cd23
Коммит
100433f4cc
@@ -1712,6 +1712,20 @@ func TestRemoveTeamMember(t *testing.T) {
|
||||
|
||||
_, resp = th.SystemAdminClient.RemoveTeamMember(th.BasicTeam.Id, th.BasicUser.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
_, resp = th.SystemAdminClient.AddTeamMember(th.BasicTeam.Id, th.SystemAdminUser.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
// If the team is group-constrained the user cannot be removed
|
||||
th.BasicTeam.GroupConstrained = model.NewBool(true)
|
||||
_, err := th.App.UpdateTeam(th.BasicTeam)
|
||||
require.Nil(t, err)
|
||||
_, resp = th.SystemAdminClient.RemoveTeamMember(th.BasicTeam.Id, th.BasicUser.Id)
|
||||
require.Equal(t, "api.team.remove_member.group_constrained.app_error", resp.Error.Id)
|
||||
|
||||
// Can remove self even if team is group-constrained
|
||||
_, resp = th.SystemAdminClient.RemoveTeamMember(th.BasicTeam.Id, th.SystemAdminUser.Id)
|
||||
CheckNoError(t, resp)
|
||||
}
|
||||
|
||||
func TestGetTeamStats(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user