mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-56400] Allow mmctl to download a Support Packet using --local mode (#25836)
This commit is contained in:
parent
e9b9d4ff60
commit
1c0dcda801
@ -17,6 +17,7 @@ func (api *API) InitSystemLocal() {
|
|||||||
api.BaseRoutes.APIRoot.Handle("/server_busy", api.APILocal(setServerBusy)).Methods("POST")
|
api.BaseRoutes.APIRoot.Handle("/server_busy", api.APILocal(setServerBusy)).Methods("POST")
|
||||||
api.BaseRoutes.APIRoot.Handle("/server_busy", api.APILocal(getServerBusyExpires)).Methods("GET")
|
api.BaseRoutes.APIRoot.Handle("/server_busy", api.APILocal(getServerBusyExpires)).Methods("GET")
|
||||||
api.BaseRoutes.APIRoot.Handle("/server_busy", api.APILocal(clearServerBusy)).Methods("DELETE")
|
api.BaseRoutes.APIRoot.Handle("/server_busy", api.APILocal(clearServerBusy)).Methods("DELETE")
|
||||||
|
api.BaseRoutes.System.Handle("/support_packet", api.APILocal(generateSupportPacket)).Methods("GET")
|
||||||
api.BaseRoutes.APIRoot.Handle("/integrity", api.APILocal(localCheckIntegrity)).Methods("POST")
|
api.BaseRoutes.APIRoot.Handle("/integrity", api.APILocal(localCheckIntegrity)).Methods("POST")
|
||||||
api.BaseRoutes.System.Handle("/schema/version", api.APILocal(getAppliedSchemaMigrations)).Methods("GET")
|
api.BaseRoutes.System.Handle("/schema/version", api.APILocal(getAppliedSchemaMigrations)).Methods("GET")
|
||||||
}
|
}
|
||||||
|
@ -211,16 +211,18 @@ func TestGenerateSupportPacket(t *testing.T) {
|
|||||||
th.LoginSystemManager()
|
th.LoginSystemManager()
|
||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
|
|
||||||
t.Run("As a System Administrator", func(t *testing.T) {
|
t.Run("system admin and local client can generate support packet", func(t *testing.T) {
|
||||||
l := model.NewTestLicense()
|
l := model.NewTestLicense()
|
||||||
th.App.Srv().SetLicense(l)
|
th.App.Srv().SetLicense(l)
|
||||||
|
|
||||||
file, _, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
|
th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) {
|
||||||
require.NoError(t, err)
|
file, _, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
|
||||||
require.NotZero(t, len(file))
|
require.NoError(t, err)
|
||||||
|
require.NotZero(t, len(file))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("As a System Administrator but with RestrictSystemAdmin true", func(t *testing.T) {
|
t.Run("Using system admin and local client but with RestrictSystemAdmin true", func(t *testing.T) {
|
||||||
originalRestrictSystemAdminVal := *th.App.Config().ExperimentalSettings.RestrictSystemAdmin
|
originalRestrictSystemAdminVal := *th.App.Config().ExperimentalSettings.RestrictSystemAdmin
|
||||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ExperimentalSettings.RestrictSystemAdmin = true })
|
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ExperimentalSettings.RestrictSystemAdmin = true })
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -229,9 +231,11 @@ func TestGenerateSupportPacket(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
|
|
||||||
_, resp, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
|
th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) {
|
||||||
require.Error(t, err)
|
_, resp, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
|
||||||
CheckForbiddenStatus(t, resp)
|
require.Error(t, err)
|
||||||
|
CheckForbiddenStatus(t, resp)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("As a system role, not system admin", func(t *testing.T) {
|
t.Run("As a system role, not system admin", func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user