Fix: align POSIX hierarchy contract
This commit is contained in:
@@ -978,6 +978,7 @@ func (service *Service) ensureBootstrapPOSIXSkeleton(
|
||||
departmentPath,
|
||||
teamPath,
|
||||
projectPath,
|
||||
filepath.Join(projectPath, "children"),
|
||||
filepath.Join(projectPath, "tree"),
|
||||
filepath.Join(usersPath, "personals"),
|
||||
} {
|
||||
@@ -1041,6 +1042,14 @@ func (service *Service) ensureBootstrapPOSIXSkeleton(
|
||||
return fmt.Errorf("write project home.json: %w", err)
|
||||
}
|
||||
|
||||
if err := writeJSONFile(filepath.Join(projectPath, "acl.json"), map[string]any{
|
||||
"version": 1,
|
||||
"inherits": true,
|
||||
"rules": []any{},
|
||||
}); err != nil {
|
||||
return fmt.Errorf("write project acl.json: %w", err)
|
||||
}
|
||||
|
||||
if err := writeJSONFile(filepath.Join(usersPath, "settings.json"), map[string]any{
|
||||
"primaryAdminId": admin.ID,
|
||||
}); err != nil {
|
||||
|
||||
@@ -52,6 +52,8 @@ func TestEnsureBootstrapPOSIXSkeletonInitializesEmptyRoot(t *testing.T) {
|
||||
filepath.Join(rootPath, "departments", "department-primary-department", "teams", "team-primary-team", "users.json"),
|
||||
filepath.Join(rootPath, "projects", "project-primary-project", "settings.json"),
|
||||
filepath.Join(rootPath, "projects", "project-primary-project", "home.json"),
|
||||
filepath.Join(rootPath, "projects", "project-primary-project", "acl.json"),
|
||||
filepath.Join(rootPath, "projects", "project-primary-project", "children"),
|
||||
filepath.Join(rootPath, "projects", "project-primary-project", "tree"),
|
||||
filepath.Join(rootPath, "users", "settings.json"),
|
||||
filepath.Join(rootPath, "users", "data.json"),
|
||||
@@ -90,6 +92,11 @@ func TestEnsureBootstrapPOSIXSkeletonInitializesEmptyRoot(t *testing.T) {
|
||||
t.Fatalf("expected project settings type project, got %#v", projectSettings["type"])
|
||||
}
|
||||
|
||||
projectACL := readJSONFileForTest[map[string]any](t, filepath.Join(rootPath, "projects", "project-primary-project", "acl.json"))
|
||||
if projectACL["inherits"] != true {
|
||||
t.Fatalf("expected project acl to inherit by default, got %#v", projectACL["inherits"])
|
||||
}
|
||||
|
||||
usersSettings := readJSONFileForTest[map[string]any](t, filepath.Join(rootPath, "users", "settings.json"))
|
||||
if usersSettings["primaryAdminId"] != "admin-1" {
|
||||
t.Fatalf("expected primary admin id admin-1, got %#v", usersSettings["primaryAdminId"])
|
||||
|
||||
Reference in New Issue
Block a user