PLT-6657 Move system console to use v4 endpoints and redux (#6572)
* Move system console to use v4 endpoints and redux * Rename logs dir to get past gitignore * Fix test email * Update brand unit test * Updates per feedback
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
40efd8367a
Коммит
1138dd6770
@@ -23,6 +23,7 @@ func getBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
// No permission check required
|
||||
|
||||
if img, err := app.GetBrandImage(); err != nil {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
w.Write(nil)
|
||||
} else {
|
||||
w.Header().Set("Content-Type", "image/png")
|
||||
|
||||
@@ -13,27 +13,15 @@ func TestGetBrandImage(t *testing.T) {
|
||||
defer TearDown()
|
||||
Client := th.Client
|
||||
|
||||
data, resp := Client.GetBrandImage()
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(data) != 0 {
|
||||
t.Fatal("no image uploaded - should be empty")
|
||||
}
|
||||
_, resp := Client.GetBrandImage()
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
Client.Logout()
|
||||
data, resp = Client.GetBrandImage()
|
||||
CheckNoError(t, resp)
|
||||
_, resp = Client.GetBrandImage()
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
if len(data) != 0 {
|
||||
t.Fatal("no image uploaded - should be empty")
|
||||
}
|
||||
|
||||
data, resp = th.SystemAdminClient.GetBrandImage()
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(data) != 0 {
|
||||
t.Fatal("no image uploaded - should be empty")
|
||||
}
|
||||
_, resp = th.SystemAdminClient.GetBrandImage()
|
||||
CheckNotFoundStatus(t, resp)
|
||||
}
|
||||
|
||||
func TestUploadBrandImage(t *testing.T) {
|
||||
|
||||
@@ -20,7 +20,7 @@ func InitCompliance() {
|
||||
BaseRoutes.Compliance.Handle("/reports", ApiSessionRequired(createComplianceReport)).Methods("POST")
|
||||
BaseRoutes.Compliance.Handle("/reports", ApiSessionRequired(getComplianceReports)).Methods("GET")
|
||||
BaseRoutes.Compliance.Handle("/reports/{report_id:[A-Za-z0-9]+}", ApiSessionRequired(getComplianceReport)).Methods("GET")
|
||||
BaseRoutes.Compliance.Handle("/reports/{report_id:[A-Za-z0-9]+}/download", ApiSessionRequired(downloadComplianceReport)).Methods("GET")
|
||||
BaseRoutes.Compliance.Handle("/reports/{report_id:[A-Za-z0-9]+}/download", ApiSessionRequiredTrustRequester(downloadComplianceReport)).Methods("GET")
|
||||
}
|
||||
|
||||
func createComplianceReport(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -52,13 +52,17 @@ func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func testEmail(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
cfg := model.ConfigFromJson(r.Body)
|
||||
if cfg == nil {
|
||||
cfg = utils.Cfg
|
||||
}
|
||||
|
||||
if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
|
||||
c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
|
||||
return
|
||||
}
|
||||
|
||||
err := app.TestEmail(c.Session.UserId, utils.Cfg)
|
||||
err := app.TestEmail(c.Session.UserId, cfg)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
|
||||
@@ -27,7 +27,7 @@ func InitUser() {
|
||||
BaseRoutes.Users.Handle("/autocomplete", ApiSessionRequired(autocompleteUsers)).Methods("GET")
|
||||
|
||||
BaseRoutes.User.Handle("", ApiSessionRequired(getUser)).Methods("GET")
|
||||
BaseRoutes.User.Handle("/image", ApiSessionRequired(getProfileImage)).Methods("GET")
|
||||
BaseRoutes.User.Handle("/image", ApiSessionRequiredTrustRequester(getProfileImage)).Methods("GET")
|
||||
BaseRoutes.User.Handle("/image", ApiSessionRequired(setProfileImage)).Methods("POST")
|
||||
BaseRoutes.User.Handle("", ApiSessionRequired(updateUser)).Methods("PUT")
|
||||
BaseRoutes.User.Handle("/patch", ApiSessionRequired(patchUser)).Methods("PUT")
|
||||
|
||||
Ссылка в новой задаче
Block a user