Skip to content

Auth: ownership + view-group access model & per-machine project identity#50

Merged
dvcdsys merged 1 commit into
developfrom
feat/auth-view-groups-and-project-identity
May 22, 2026
Merged

Auth: ownership + view-group access model & per-machine project identity#50
dvcdsys merged 1 commit into
developfrom
feat/auth-view-groups-and-project-identity

Conversation

@dvcdsys
Copy link
Copy Markdown
Owner

@dvcdsys dvcdsys commented May 22, 2026

Summary

  • Authorization model: per-user ownership + admin-managed view-groups. Roles renamed vieweruser. Projects/workspaces get owner_user_id; external projects (git_repos peer) are ownerless and admin-administered. View-group members get read/search on external projects + workspaces shared to the group. Enforced server-side (requireProjectAccess/Ownership, requireWorkspaceVisible/Ownership, mustBeAdmin) — list filtering, owner-on-create, admin-only git-repos/github-tokens/groups, owner-or-admin mutations.
  • New endpoints: groups CRUD + members, project/workspace shares, PUT /projects/{hash}/owner; /auth/me returns the caller's groups.
  • Dashboard: View Groups admin module, share-to-group cards (project + workspace), reassign-owner dialog, role-aware control hiding.
  • Per-machine project identity: local project key is namespaced local:{machine_id}:{path} so the same path on different machines/users no longer collides. display_path holds the real path; CLI generates ~/.cix/machine_id and computes the matching hash (server is the formula authority).

Migrations (breaking)

Test plan

  • cd server && go test ./... — 34 pkgs green (migration backfill, group sharing, ownership mutations, admin-only gating, machine namespacing/collision tests)
  • cd cli && go test ./... — green (hash mirrors delegate to client.EncodeProjectPath)
  • cd server/dashboard && npm run build + tsc --noEmit — green
  • make openapi-gen regenerated; codegen stable
  • Manual: log in as user vs admin, share an external project/workspace to a group, confirm a member's agent (API key) can search it but not see others' personal projects
  • Manual: index same path from two machines → two distinct projects

🤖 Generated with Claude Code

…ct identity

Introduce a per-user authorization model so a shared cix-server can serve
agents of many users safely, and fix local-project identity collisions across
machines.

Authorization (server + dashboard):
- Roles renamed viewer -> user; two-tier RBAC (admin, user).
- Projects/workspaces gain owner_user_id; external projects (git_repos peer)
  are ownerless and admin-administered.
- New view_groups + membership + project/workspace share tables. Members of a
  group get read/search on external projects and workspaces shared to it.
- Access enforced in handlers (requireProjectAccess/Ownership,
  requireWorkspaceVisible/Ownership, mustBeAdmin): list filtering, owner-on
  create, admin-only git-repos/github-tokens/groups, owner-or-admin mutations.
- New endpoints: groups CRUD + members, project/workspace shares,
  PUT /projects/{hash}/owner; /auth/me returns the caller's groups.
- Dashboard: View Groups admin module, share-to-group cards, reassign-owner,
  role-aware control hiding.

Per-machine project identity:
- Local project key is namespaced local:{machine_id}:{path}; path_hash derives
  from it so the same path on different machines/users no longer collides.
  display_path holds the real path; machine_id/machine_label added.
- CLI generates ~/.cix/machine_id, sends it on create, and computes the
  matching hash (client.EncodeProjectPath); server is the formula authority.

Migrations #10 (auth) and #11 (machine identity): existing users -> admin,
local projects + workspaces -> first active admin, external stay ownerless;
display_path backfilled. Breaking — announce in release notes; re-init local
projects. Coordinated CLI<->server bump.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@dvcdsys dvcdsys merged commit e275c4a into develop May 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant