headscale/hscontrol/db
Ryan Malloy 209ba5c4ea oidc groups: store and expose the OIDC groups claim
Add a Groups column on the User model populated from the OIDC
'groups' claim at login, and surface it through the gRPC/REST
User message so external tools (Headplane) can read group
membership without reaching into the database.

- proto: add 'repeated string groups = 9' to v1.User.
- types.User: Groups text column, GetGroups/SetGroups JSON helpers,
  FromClaim populates from claims.Groups. The existing
  FlexibleStringSlice on OIDCClaims.Groups already handles
  JumpCloud-style single-string emission.
- types.User.Proto(): populate v1.User.Groups via GetGroups().
- db migration 202505141323: add the column BEFORE the existing
  202505141324 migration that loads users via the struct, so the
  schema is in place before any migration touches the User type.
- db migration 202507021200: extend the inline CREATE TABLE users
  and INSERT INTO users ... SELECT FROM users_old to carry the
  new column through the SQLite schema-recreation step.
- schema.sql: declare the column so squibble.Validate accepts
  databases produced by the new migration chain. Verified against
  all 7 historical sqlite dumps in hscontrol/db/testdata/sqlite.
- types.UserView, types_clone.go: regenerated to expose Groups.
- config-example.yaml, docs/ref/oidc.md: note the 'groups' scope
  and the role the column plays for external integrations.
- integration/oidc_groups_test.go: verify the round-trip via
  headscale.ListUsers() for users with multi-group, single-group,
  and empty group memberships.
2026-06-04 01:57:50 -06:00
..
sqliteconfig all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
testdata/sqlite db: backfill zero-time node expiry to NULL 2026-05-27 09:49:05 +02:00
api_key.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
api_key_test.go grpc: support expire/delete API keys by ID 2026-01-20 17:13:38 +01:00
db.go oidc groups: store and expose the OIDC groups claim 2026-06-04 01:57:50 -06:00
db_test.go db: backfill zero-time node expiry to NULL 2026-05-27 09:49:05 +02:00
ephemeral_garbage_collector_test.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
ip.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
ip_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
main_test.go all: fix test flakiness and improve test infrastructure 2026-03-14 02:52:28 -07:00
node.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
node_test.go db: remove unused SetApprovedRoutes and SetTags helpers 2026-05-15 11:21:58 +02:00
policy.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
preauth_keys.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
preauth_keys_test.go db: guard UsePreAuthKey with WHERE used=false 2026-04-10 14:09:57 +01:00
schema.sql oidc groups: store and expose the OIDC groups claim 2026-06-04 01:57:50 -06:00
suite_test.go hscontrol/types: silence zerolog by default in tests 2026-04-17 16:31:49 +01:00
text_serialiser.go all: mechanical lint fixes 2026-05-19 09:55:22 +02:00
user_update_test.go hscontrol: use Updates() instead of Save() for partial updates 2025-11-11 12:47:48 -06:00
users.go all: apply godoc [Name] link conventions across comments 2026-05-19 09:55:22 +02:00
users_test.go types: persist Node JSON slices via named IsZero types 2026-05-15 11:21:58 +02:00
versioncheck.go db: treat Go module pseudo-versions as dev builds 2026-05-26 17:29:13 +02:00
versioncheck_test.go db: treat Go module pseudo-versions as dev builds 2026-05-26 17:29:13 +02:00