MM-59540 Ensure user has invite team permission in order to change setting (#28670)
* ensure user has invite team permission in order to change setting * add tests and handle UI * lint fixes * revert changes to invite section input * update tests * revert bad merge --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
11b66de686
Коммит
790103fae0
@@ -251,6 +251,12 @@ func patchTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// if changing "AllowOpenInvite" or "AllowedDomains", user must have InviteUser permission
|
||||
if (team.AllowOpenInvite != nil || team.AllowedDomains != nil) && !c.App.SessionHasPermissionToTeam(*c.AppContext.Session(), c.Params.TeamId, model.PermissionInviteUser) {
|
||||
c.SetPermissionError(model.PermissionInviteUser)
|
||||
return
|
||||
}
|
||||
|
||||
if oldTeam, err := c.App.GetTeam(c.Params.TeamId); err == nil {
|
||||
auditRec.AddEventPriorState(oldTeam)
|
||||
auditRec.AddEventObjectType("team")
|
||||
|
||||
Ссылка в новой задаче
Block a user