[MM-44307] On Limits Change, archive or restore teams according to the limits (#20247)
Automatic Merge
Этот коммит содержится в:
@@ -536,7 +536,9 @@ func handleCWSWebhook(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return true
|
||||
}, plugin.OnCloudLimitsUpdatedID)
|
||||
}
|
||||
c.App.AdjustInProductLimits(event.ProductLimits, event.Subscription)
|
||||
}
|
||||
|
||||
if err := c.App.Cloud().UpdateSubscriptionFromHook(event.ProductLimits, event.Subscription); err != nil {
|
||||
c.Err = model.NewAppError("Api4.handleCWSWebhook", "api.cloud.subscription.update_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
18
api4/team.go
18
api4/team.go
@@ -43,6 +43,7 @@ func (api *API) InitTeam() {
|
||||
api.BaseRoutes.Team.Handle("", api.APISessionRequired(getTeam)).Methods("GET")
|
||||
api.BaseRoutes.Team.Handle("", api.APISessionRequired(updateTeam)).Methods("PUT")
|
||||
api.BaseRoutes.Team.Handle("", api.APISessionRequired(deleteTeam)).Methods("DELETE")
|
||||
api.BaseRoutes.Team.Handle("/except", api.APISessionRequired(softDeleteTeamsExcept)).Methods("DELETE")
|
||||
api.BaseRoutes.Team.Handle("/patch", api.APISessionRequired(patchTeam)).Methods("PUT")
|
||||
api.BaseRoutes.Team.Handle("/restore", api.APISessionRequired(restoreTeam)).Methods("POST")
|
||||
api.BaseRoutes.Team.Handle("/privacy", api.APISessionRequired(updateTeamPrivacy)).Methods("PUT")
|
||||
@@ -402,6 +403,23 @@ func deleteTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
ReturnStatusOK(w)
|
||||
}
|
||||
|
||||
func softDeleteTeamsExcept(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.RequireTeamId()
|
||||
if c.Err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if !c.App.SessionHasPermissionToTeam(*c.AppContext.Session(), c.Params.TeamId, model.PermissionManageTeam) {
|
||||
c.SetPermissionError(model.PermissionManageTeam)
|
||||
return
|
||||
}
|
||||
|
||||
err := c.App.SoftDeleteAllTeamsExcept(c.Params.TeamId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
}
|
||||
}
|
||||
|
||||
func getTeamsForUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.RequireUserId()
|
||||
if c.Err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user