feat: more role backend and admin/writer roles additions and adjustments
This commit is contained in:
1 parent
8c6c6456da
commit
de142f6c5f
131 files changed
+2663
-435
No files matched your search
@@ -41,7 +41,7 @@ func TestSettingsRetentionSizeHttp(t *testing.T) {
|
||||
e.settings.settings.RetentionMaxGB = c.gb
|
||||
e.probe.sizeBytes = &c.bytes
|
||||
|
||||
rec := e.get("/v1/settings", asUser(e, activityEditorID))
|
||||
rec := e.get("/v1/settings", asUser(e, activityAdminID))
|
||||
|
||||
body := sizeSettingsBody(t, rec.Body.Bytes())
|
||||
var got []string
|
||||
@@ -61,7 +61,7 @@ func TestSettingsRetentionSizeHttp(t *testing.T) {
|
||||
t.Run("Settings API, a fresh install defaults to no size limit", func(t *testing.T) {
|
||||
e := newActivityHTTPEnv(t, 1000)
|
||||
|
||||
body := sizeSettingsBody(t, e.get("/v1/settings", asUser(e, activityEditorID)).Body.Bytes())
|
||||
body := sizeSettingsBody(t, e.get("/v1/settings", asUser(e, activityAdminID)).Body.Bytes())
|
||||
|
||||
if body["activity_retention_days"] != float64(90) || body["activity_retention_max_gb"] != float64(0) || body["activity_log_size_bytes"] != float64(0) {
|
||||
t.Errorf("unexpected body %v", body)
|
||||
@@ -153,7 +153,7 @@ func TestSettingsRetentionSizeHttp(t *testing.T) {
|
||||
|
||||
rec := e.send(http.MethodPatch, "/v1/settings", `{"activity_retention_max_gb": 5}`, asUser(e, activityAdminID))
|
||||
|
||||
assertPlain(t, rec, http.StatusForbidden, "Only the owner can do this.")
|
||||
assertPlain(t, rec, http.StatusForbidden, apperr.MissingPermissionErrorMessage)
|
||||
if e.settings.retentionOK != 0 {
|
||||
t.Error("the admin changed something")
|
||||
}
|
||||
@@ -164,7 +164,7 @@ func TestSettingsRetentionSizeHttp(t *testing.T) {
|
||||
e := newActivityHTTPEnv(t, 1000)
|
||||
e.probe.sizeErr = errRepositoryFailure
|
||||
|
||||
assertPlain(t, e.get("/v1/settings", asUser(e, activityEditorID)), http.StatusInternalServerError, "Internal server error")
|
||||
assertPlain(t, e.get("/v1/settings", asUser(e, activityAdminID)), http.StatusInternalServerError, "Internal server error")
|
||||
})
|
||||
|
||||
t.Run("Settings API, the change is audited", func(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user