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.
Этот коммит содержится в:
Martin Kraft
2019-04-12 10:15:46 -04:00
коммит произвёл GitHub
родитель f93ba3cd23
Коммит 100433f4cc
5 изменённых файлов: 52 добавлений и 0 удалений

Просмотреть файл

@@ -1218,6 +1218,11 @@ func removeChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if channel.GroupConstrained != nil && *channel.GroupConstrained && (c.Params.UserId != c.App.Session.UserId) {
c.Err = model.NewAppError("removeChannelMember", "api.channel.remove_member.group_constrained.app_error", nil, "", http.StatusBadRequest)
return
}
if c.Params.UserId != c.App.Session.UserId {
if channel.Type == model.CHANNEL_OPEN && !c.App.SessionHasPermissionToChannel(c.App.Session, channel.Id, model.PERMISSION_MANAGE_PUBLIC_CHANNEL_MEMBERS) {
c.SetPermissionError(model.PERMISSION_MANAGE_PUBLIC_CHANNEL_MEMBERS)