@@ -13,6 +13,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/v6/app/request"
|
"github.com/mattermost/mattermost-server/v6/app/request"
|
||||||
@@ -141,6 +142,11 @@ func (api *PluginAPI) GetLicense() *model.License {
|
|||||||
return api.app.Srv().License()
|
return api.app.Srv().License()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *PluginAPI) IsEnterpriseReady() bool {
|
||||||
|
result, _ := strconv.ParseBool(model.BuildEnterpriseReady)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
func (api *PluginAPI) GetServerVersion() string {
|
func (api *PluginAPI) GetServerVersion() string {
|
||||||
return model.CurrentVersion
|
return model.CurrentVersion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1922,3 +1922,15 @@ func TestPluginAPIUpdateCommand(t *testing.T) {
|
|||||||
require.Equal(t, team1.Id, newCmd4.TeamId)
|
require.Equal(t, team1.Id, newCmd4.TeamId)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPluginAPIIsEnterpriseReady(t *testing.T) {
|
||||||
|
oldValue := model.BuildEnterpriseReady
|
||||||
|
defer func() { model.BuildEnterpriseReady = oldValue }()
|
||||||
|
|
||||||
|
model.BuildEnterpriseReady = "true"
|
||||||
|
th := Setup(t)
|
||||||
|
defer th.TearDown()
|
||||||
|
api := th.SetupPluginAPI()
|
||||||
|
|
||||||
|
assert.Equal(t, true, api.IsEnterpriseReady())
|
||||||
|
}
|
||||||
|
|||||||
@@ -92,6 +92,12 @@ type API interface {
|
|||||||
// Minimum server version: 5.10
|
// Minimum server version: 5.10
|
||||||
GetLicense() *model.License
|
GetLicense() *model.License
|
||||||
|
|
||||||
|
// IsEnterpriseReady returns true if the Mattermost server is configured as Enterprise Ready.
|
||||||
|
//
|
||||||
|
// @tag Server
|
||||||
|
// Minimum server version: 5.10
|
||||||
|
IsEnterpriseReady() bool
|
||||||
|
|
||||||
// GetServerVersion return the current Mattermost server version
|
// GetServerVersion return the current Mattermost server version
|
||||||
//
|
//
|
||||||
// @tag Server
|
// @tag Server
|
||||||
|
|||||||
@@ -112,6 +112,13 @@ func (api *apiTimerLayer) GetLicense() *model.License {
|
|||||||
return _returnsA
|
return _returnsA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *apiTimerLayer) IsEnterpriseReady() bool {
|
||||||
|
startTime := timePkg.Now()
|
||||||
|
_returnsA := api.apiImpl.IsEnterpriseReady()
|
||||||
|
api.recordTime(startTime, "IsEnterpriseReady", true)
|
||||||
|
return _returnsA
|
||||||
|
}
|
||||||
|
|
||||||
func (api *apiTimerLayer) GetServerVersion() string {
|
func (api *apiTimerLayer) GetServerVersion() string {
|
||||||
startTime := timePkg.Now()
|
startTime := timePkg.Now()
|
||||||
_returnsA := api.apiImpl.GetServerVersion()
|
_returnsA := api.apiImpl.GetServerVersion()
|
||||||
|
|||||||
@@ -980,6 +980,33 @@ func (s *apiRPCServer) GetLicense(args *Z_GetLicenseArgs, returns *Z_GetLicenseR
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Z_IsEnterpriseReadyArgs struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type Z_IsEnterpriseReadyReturns struct {
|
||||||
|
A bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *apiRPCClient) IsEnterpriseReady() bool {
|
||||||
|
_args := &Z_IsEnterpriseReadyArgs{}
|
||||||
|
_returns := &Z_IsEnterpriseReadyReturns{}
|
||||||
|
if err := g.client.Call("Plugin.IsEnterpriseReady", _args, _returns); err != nil {
|
||||||
|
log.Printf("RPC call to IsEnterpriseReady API failed: %s", err.Error())
|
||||||
|
}
|
||||||
|
return _returns.A
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *apiRPCServer) IsEnterpriseReady(args *Z_IsEnterpriseReadyArgs, returns *Z_IsEnterpriseReadyReturns) error {
|
||||||
|
if hook, ok := s.impl.(interface {
|
||||||
|
IsEnterpriseReady() bool
|
||||||
|
}); ok {
|
||||||
|
returns.A = hook.IsEnterpriseReady()
|
||||||
|
} else {
|
||||||
|
return encodableError(fmt.Errorf("API IsEnterpriseReady called but not implemented."))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type Z_GetServerVersionArgs struct {
|
type Z_GetServerVersionArgs struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2388,6 +2388,20 @@ func (_m *API) InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *mo
|
|||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsEnterpriseReady provides a mock function with given fields:
|
||||||
|
func (_m *API) IsEnterpriseReady() bool {
|
||||||
|
ret := _m.Called()
|
||||||
|
|
||||||
|
var r0 bool
|
||||||
|
if rf, ok := ret.Get(0).(func() bool); ok {
|
||||||
|
r0 = rf()
|
||||||
|
} else {
|
||||||
|
r0 = ret.Get(0).(bool)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0
|
||||||
|
}
|
||||||
|
|
||||||
// KVCompareAndDelete provides a mock function with given fields: key, oldValue
|
// KVCompareAndDelete provides a mock function with given fields: key, oldValue
|
||||||
func (_m *API) KVCompareAndDelete(key string, oldValue []byte) (bool, *model.AppError) {
|
func (_m *API) KVCompareAndDelete(key string, oldValue []byte) (bool, *model.AppError) {
|
||||||
ret := _m.Called(key, oldValue)
|
ret := _m.Called(key, oldValue)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user