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(getServerBusyExpires)).Methods("GET")
|
||||
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.System.Handle("/schema/version", api.APILocal(getAppliedSchemaMigrations)).Methods("GET")
|
||||
}
|
||||
|
@ -211,16 +211,18 @@ func TestGenerateSupportPacket(t *testing.T) {
|
||||
th.LoginSystemManager()
|
||||
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()
|
||||
th.App.Srv().SetLicense(l)
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) {
|
||||
file, _, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
|
||||
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
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ExperimentalSettings.RestrictSystemAdmin = true })
|
||||
defer func() {
|
||||
@ -229,10 +231,12 @@ func TestGenerateSupportPacket(t *testing.T) {
|
||||
})
|
||||
}()
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) {
|
||||
_, resp, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("As a system role, not system admin", func(t *testing.T) {
|
||||
_, resp, err := th.SystemManagerClient.GenerateSupportPacket(context.Background())
|
||||
|
Loading…
Reference in New Issue
Block a user