mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 14:53:00 +03:00
[PR #812] [MERGED] feat(signup): add default user groups and claims for new users #613
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pocket-id/pocket-id/pull/812
Author: @zeedif
Created: 8/6/2025
Status: ✅ Merged
Merged: 8/22/2025
Merged by: @stonith404
Base:
main← Head:claims_groups_signup📝 Commits (10+)
c79d6befeat(signup): add default groups and claims for new signups2932f85refactor(signup): consolidate signup settings and fix E2E tests82bf6eafix(signup): update translation keys for signup settings and fix tests8acfcb2Merge branch 'main' into claims_groups_signupe626eb4Merge branch 'main' into claims_groups_signup61879bdfix(user): ensure atomicity and add validation for signup defaultsaf264b5handle parsing of json config variables more generic11d9f64respect pagination and enable search for user group input5c0d1ebfix e2e testsdb90ab1show user creation options when sign up disabled📊 Changes
18 files changed (+703 additions, -276 deletions)
View changed files
📝
backend/internal/bootstrap/services_bootstrap.go(+1 -1)📝
backend/internal/dto/app_config_dto.go(+2 -0)📝
backend/internal/model/app_config.go(+9 -7)📝
backend/internal/service/app_config_service.go(+9 -7)📝
backend/internal/service/custom_claim_service.go(+34 -14)📝
backend/internal/service/user_service.go(+59 -12)📝
frontend/messages/en.json(+7 -2)📝
frontend/messages/es.json(+6 -1)➕
frontend/src/lib/components/form/searchable-multi-select.svelte(+140 -0)📝
frontend/src/lib/services/app-config-service.ts(+18 -3)📝
frontend/src/lib/types/application-configuration.ts(+4 -0)📝
frontend/src/routes/settings/admin/application-configuration/+page.svelte(+13 -1)📝
frontend/src/routes/settings/admin/application-configuration/forms/app-config-general-form.svelte(+0 -66)➕
frontend/src/routes/settings/admin/application-configuration/forms/app-config-signup-defaults-form.svelte(+176 -0)📝
tests/specs/application-configuration.spec.ts(+70 -11)📝
tests/specs/ldap.spec.ts(+1 -1)📝
tests/specs/user-group.spec.ts(+6 -0)📝
tests/specs/user-signup.spec.ts(+148 -150)📄 Description
Summary
This Pull Request resolves issue #755 by implementing a feature that allows administrators to define default user groups and custom claims for new users who register via Open Signup or Signup Tokens.
The primary motivation is to streamline the onboarding process for applications integrated via OIDC, such as Kavita, which may require specific roles (like a
Loginrole) to be present for a user to be granted access. Previously, an administrator had to manually assign a user to a group after they registered, creating a delay and an extra administrative step.With these changes, new users are automatically configured with the necessary permissions upon creation, allowing them to log into third-party services immediately.
Implementation Details
signupDefaultUserGroupIDsandsignupDefaultCustomClaims, have been added to theAppConfigmodel.UserService'screateUserInternalmethod has been updated to read these settings and apply them to the new user.CustomClaimServicehas been refactored to allow its claim update logic to be executed within an existing database transaction, ensuring the user creation process remains atomic.AppConfigServiceon the frontend has been updated to correctly handle the serialization and deserialization of these new settings, which are stored as JSON strings in the database.A Note on Contribution
I would like to note that I implemented these changes with the assistance of AI, as I am not deeply proficient in Go or the Svelte framework.
I have tested these changes locally, and they appear to function as expected, resolving the issue for my use case. However, I would greatly appreciate a thorough review from the maintainers to identify any potential improvements, style inconsistencies, or bugs I may have missed.
I am fully open to feedback and ready to make any required changes to get this PR merged. Thank you for considering my contribution
Summary by CodeRabbit
New Features
Changes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.