feat(roles): functions of owner decision Nr. 2 in the catalogue
Catalogue r1-2026-11-16.1 adds the functions owner decision Nr. 2 (docgen#6 17878, 18011) names and that no R1 function already covers: CVD-Verantwortung and Veröffentlichungsverantwortung (R5), Meldefreigabe, Fristführung, Vorabprüfung, Weitergabe von Informationen and Datenschutzfunktion (R2), and the R1 functions Erstzuordnung, Eskalation and Einsichtsprotokollkontrolle. External holders as proposed in 18110 K-4. The safety check and product measures wait for the owner (K-1, K-2). GET /role-dataset now names the current catalogue as catalogue_version and the stored one as stored_catalogue_version. It named the stored one, which the portal sends back on save: after any catalogue change every save of an existing dataset was refused as catalogue_outdated, and reloading answered the same version again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
This commit is contained in:
1 parent
9cf4f7db05
commit
bef4e31c05
4 files changed
+103
-15
No files matched your search
@@ -42,14 +42,20 @@ type roleDatasetSaveReq struct {
|
||||
}
|
||||
|
||||
type roleDatasetResp struct {
|
||||
TenantID string `json:"tenant_id"`
|
||||
Revision int `json:"revision"`
|
||||
CatalogueVersion string `json:"catalogue_version"`
|
||||
UpdatedBy string `json:"updated_by,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
Data json.RawMessage `json:"data"`
|
||||
Derived roleDatasetDerived `json:"derived"`
|
||||
Catalogue roles.Catalogue `json:"catalogue"`
|
||||
TenantID string `json:"tenant_id"`
|
||||
Revision int `json:"revision"`
|
||||
// CatalogueVersion is the catalogue the answer is edited against: the
|
||||
// current one, which a save must name. The stored dataset may have been
|
||||
// saved against an older one (StoredCatalogueVersion); answering that
|
||||
// instead would refuse every save after a catalogue change for good,
|
||||
// since reloading answered it again.
|
||||
CatalogueVersion string `json:"catalogue_version"`
|
||||
StoredCatalogueVersion string `json:"stored_catalogue_version,omitempty"`
|
||||
UpdatedBy string `json:"updated_by,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
Data json.RawMessage `json:"data"`
|
||||
Derived roleDatasetDerived `json:"derived"`
|
||||
Catalogue roles.Catalogue `json:"catalogue"`
|
||||
}
|
||||
|
||||
type roleDatasetDerived struct {
|
||||
@@ -113,7 +119,7 @@ func (s *Server) roleDatasetAnswer(tenantID string, stored *store.RoleDataset, d
|
||||
Catalogue: roles.CurrentCatalogue(),
|
||||
}
|
||||
if stored != nil {
|
||||
out.Revision, out.CatalogueVersion, out.UpdatedBy = stored.Revision, stored.CatalogueVersion, stored.UpdatedBy
|
||||
out.Revision, out.StoredCatalogueVersion, out.UpdatedBy = stored.Revision, stored.CatalogueVersion, stored.UpdatedBy
|
||||
at := stored.UpdatedAt
|
||||
out.UpdatedAt = &at
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.breakpilot.com/platform/tenant-registry/internal/roles"
|
||||
"git.breakpilot.com/platform/tenant-registry/internal/store"
|
||||
)
|
||||
|
||||
// A dataset saved against an older catalogue: the answer names the current
|
||||
// catalogue to edit against, and a save with what the answer named goes
|
||||
// through. Before, the answer named the stored version, the save was
|
||||
// refused as catalogue_outdated, and reloading answered the same again.
|
||||
func TestRoleDataset_afterACatalogueChange(t *testing.T) {
|
||||
f := newRoleFixture(t)
|
||||
if _, _, err := f.s.Store.SaveRoleDataset(context.Background(), store.RoleDatasetWrite{
|
||||
TenantID: f.tenant.ID, Data: json.RawMessage(mgmtOnly), CatalogueVersion: "r1-older", ExpectedRevision: 0, By: "u-ceo", At: time.Now(),
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
code, out, raw := f.do(t, "ceo", "GET", f.path(""), "")
|
||||
if code != http.StatusOK || out["catalogue_version"] != roles.CatalogueVersion || out["stored_catalogue_version"] != "r1-older" {
|
||||
t.Fatalf("answer: %d %s", code, raw)
|
||||
}
|
||||
body := strings.Replace(saveBody(mgmtOnly, 1), roles.CatalogueVersion, out["catalogue_version"].(string), 1)
|
||||
if code, _, raw := f.do(t, "ceo", "PUT", f.path(""), body); code != http.StatusOK {
|
||||
t.Fatalf("save with the answered version: %d %s", code, raw)
|
||||
}
|
||||
if code, out, raw := f.do(t, "ceo", "GET", f.path(""), ""); code != http.StatusOK || out["stored_catalogue_version"] != roles.CatalogueVersion {
|
||||
t.Fatalf("stored against the current catalogue now: %d %s", code, raw)
|
||||
}
|
||||
}
|
||||
|
||||
// The functions of owner decision Nr. 2 are in the catalogue; the safety
|
||||
// check and the product measures are not yet (18110 K-1, K-2).
|
||||
func TestCatalogue_ownerDecisionNr2(t *testing.T) {
|
||||
for _, k := range []string{"r5.cvd_verantwortung", "r5.veroeffentlichung", "r2.meldefreigabe", "r2.fristfuehrung",
|
||||
"r2.vorabpruefung", "r2.weitergabe", "r2.datenschutzfunktion", "r1.erstzuordnung", "r1.eskalation", "r1.einsichtsprotokollkontrolle"} {
|
||||
if _, ok := roles.FunctionByKey(k); !ok {
|
||||
t.Errorf("missing %s", k)
|
||||
}
|
||||
}
|
||||
for _, f := range roles.Functions {
|
||||
if strings.Contains(f.Code, "safety") || strings.Contains(f.Code, "produktmassnahmen") {
|
||||
t.Errorf("%s waits for the owner", f.Code)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user