feat: more role backend and admin/writer roles additions and adjustments

This commit is contained in:
Florian Sylvain committed 2026-10-26 18:15:26 +01:00
1 parent 8c6c6456da
commit de142f6c5f
131 files changed
+2663 -435

No files matched your search

@@ -308,7 +308,7 @@ func TestExistingRoleChecksAreUntouched(t *testing.T) {
denied bool
}{
{"owner invites", apiKeyOwnerId, http.MethodPost, "/v1/user/invite", `{"email":"new@example.com"}`, false},
{"admin invites", apiKeyDevId, http.MethodPost, "/v1/user/invite", `{"email":"new@example.com"}`, true},
{"admin invites (allowed since roles_permissions_enforcement)", apiKeyDevId, http.MethodPost, "/v1/user/invite", `{"email":"new@example.com"}`, false},
{"admin creates a content type", apiKeyDevId, http.MethodPost, "/v1/content-type", `{}`, false},
{"admin patches settings", apiKeyDevId, http.MethodPatch, "/v1/settings", `{}`, true},
{"admin checks for updates", apiKeyDevId, http.MethodPost, "/v1/system/update/check", "", true},
@@ -317,8 +317,8 @@ func TestExistingRoleChecksAreUntouched(t *testing.T) {
t.Run(c.name, func(t *testing.T) {
e := newAPIKeyEnv(t)
rec := e.withCookie(t, c.method, c.path, c.body, c.user)
if c.denied && (rec.Code != http.StatusForbidden || rec.Body.String() != apperr.OwnerRequiredErrorMessage+"\n") {
t.Errorf("expected owner-required 403, got %d %q", rec.Code, rec.Body.String())
if c.denied && (rec.Code != http.StatusForbidden || rec.Body.String() != apperr.MissingPermissionErrorMessage+"\n") {
t.Errorf("expected missing_permission 403, got %d %q", rec.Code, rec.Body.String())
}
if !c.denied && rec.Code == http.StatusForbidden {
t.Errorf("unexpected 403 %q", rec.Body.String())