Invalidate cloud caches when a new license is loaded (#21579)

Automatic Merge
Этот коммит содержится в:
Nick Misasi
2022-11-02 16:40:26 -04:00
коммит произвёл GitHub
родитель 1ae97fc381
Коммит a541cda9d0
19 изменённых файлов: 69 добавлений и 43 удалений

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

@@ -95,7 +95,7 @@ func createTeam(c *Context, w http.ResponseWriter, r *http.Request) {
}
// On a cloud license, we must check limits before allowing to create
if c.App.Channels().License() != nil && c.App.Channels().License().Features != nil && *c.App.Channels().License().Features.Cloud {
if c.App.Channels().License().IsCloud() {
limits, err := c.App.Cloud().GetCloudLimits(c.AppContext.Session().UserId)
if err != nil {
c.Err = model.NewAppError("Api4.createTeam", "api.cloud.app_error", nil, err.Error(), http.StatusInternalServerError)
@@ -285,7 +285,7 @@ func restoreTeam(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
// On a cloud license, we must check limits before allowing to restore
if c.App.Channels().License() != nil && c.App.Channels().License().Features != nil && *c.App.Channels().License().Features.Cloud {
if c.App.Channels().License().IsCloud() {
limits, err := c.App.Cloud().GetCloudLimits(c.AppContext.Session().UserId)
if err != nil {
c.Err = model.NewAppError("Api4.restoreTeam", "api.cloud.app_error", nil, err.Error(), http.StatusInternalServerError)
@@ -1259,7 +1259,7 @@ func teamExists(c *Context, w http.ResponseWriter, r *http.Request) {
}
func importTeam(c *Context, w http.ResponseWriter, r *http.Request) {
if c.App.Channels().License() != nil && *c.App.Channels().License().Features.Cloud {
if c.App.Channels().License().IsCloud() {
c.Err = model.NewAppError("importTeam", "api.restricted_system_admin", nil, "", http.StatusForbidden)
return
}