Fix all occurances of checking for RemoteClusterServiceLicense (#22453)
Этот коммит содержится в:
@@ -579,7 +579,7 @@ func (s *Server) startInterClusterServices(license *model.License) error {
|
|||||||
// Remote Cluster service
|
// Remote Cluster service
|
||||||
|
|
||||||
// License check (assume enabled if shared channels enabled)
|
// License check (assume enabled if shared channels enabled)
|
||||||
if !*license.Features.RemoteClusterService && !license.HasSharedChannels() {
|
if !license.HasRemoteClusterService() && !license.HasSharedChannels() {
|
||||||
mlog.Debug("License does not have Remote Cluster services enabled")
|
mlog.Debug("License does not have Remote Cluster services enabled")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,6 +321,21 @@ func (l *License) HasEnterpriseMarketplacePlugins() bool {
|
|||||||
l.SkuShortName == LicenseShortSkuEnterprise
|
l.SkuShortName == LicenseShortSkuEnterprise
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *License) HasRemoteClusterService() bool {
|
||||||
|
if l == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// If SharedChannels is enabled then RemoteClusterService must be enabled.
|
||||||
|
if l.HasSharedChannels() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return (l.Features != nil && l.Features.RemoteClusterService != nil && *l.Features.RemoteClusterService) ||
|
||||||
|
l.SkuShortName == LicenseShortSkuProfessional ||
|
||||||
|
l.SkuShortName == LicenseShortSkuEnterprise
|
||||||
|
}
|
||||||
|
|
||||||
func (l *License) HasSharedChannels() bool {
|
func (l *License) HasSharedChannels() bool {
|
||||||
if l == nil {
|
if l == nil {
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ func (c *Context) CloudKeyRequired() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) RemoteClusterTokenRequired() {
|
func (c *Context) RemoteClusterTokenRequired() {
|
||||||
if license := c.App.Channels().License(); license == nil || !*license.Features.RemoteClusterService || c.AppContext.Session().Props[model.SessionPropType] != model.SessionTypeRemoteclusterToken {
|
if license := c.App.Channels().License(); license == nil || !license.HasRemoteClusterService() || c.AppContext.Session().Props[model.SessionPropType] != model.SessionTypeRemoteclusterToken {
|
||||||
c.Err = model.NewAppError("", "api.context.session_expired.app_error", nil, "TokenRequired", http.StatusUnauthorized)
|
c.Err = model.NewAppError("", "api.context.session_expired.app_error", nil, "TokenRequired", http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
c.AppContext.SetSession(session)
|
c.AppContext.SetSession(session)
|
||||||
}
|
}
|
||||||
} else if token != "" && c.App.Channels().License() != nil && *c.App.Channels().License().Features.RemoteClusterService && tokenLocation == app.TokenLocationRemoteClusterHeader {
|
} else if token != "" && c.App.Channels().License() != nil && c.App.Channels().License().HasRemoteClusterService() && tokenLocation == app.TokenLocationRemoteClusterHeader {
|
||||||
// Get the remote cluster
|
// Get the remote cluster
|
||||||
if remoteId := c.GetRemoteID(r); remoteId == "" {
|
if remoteId := c.GetRemoteID(r); remoteId == "" {
|
||||||
c.Logger.Warn("Missing remote cluster id") //
|
c.Logger.Warn("Missing remote cluster id") //
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user