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
11
api4/team.go
11
api4/team.go
@@ -535,6 +535,17 @@ func removeTeamMember(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
team, err := c.App.GetTeam(c.Params.TeamId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
if team.GroupConstrained != nil && *team.GroupConstrained && (c.Params.UserId != c.App.Session.UserId) {
|
||||
c.Err = model.NewAppError("removeTeamMember", "api.team.remove_member.group_constrained.app_error", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if err := c.App.RemoveUserFromTeam(c.Params.TeamId, c.Params.UserId, c.App.Session.UserId); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
|
||||
Ссылка в новой задаче
Block a user