Skip to content

feat: client profiles (subscription settings per group of users) - #1074

Draft
Rerowros wants to merge 25 commits into
PasarGuard:devfrom
Rerowros:feat/client-profiles
Draft

Rerowros wants to merge 25 commits into
PasarGuard:devfrom
Rerowros:feat/client-profiles

Conversation

@Rerowros

Copy link
Copy Markdown
Contributor

Summary

Adds client profiles: a named set of subscription settings that you assign to users, similar to Remnawave's external squads. A reseller or a premium plan can get its own templates, title, support link, headers and variables without a separate admin account.

  • A profile holds:

    • client templates per format (Xray / sing-box / Clash);
    • profile title and support URL;
    • announce text and announce URL;
    • update interval and randomize order;
    • extra response headers and headers to remove;
    • custom variables.

    Any field left empty is inherited from the global settings.

  • users.client_profile_id and user_templates.client_profile_id (nullable, ON DELETE SET NULL). Users created from a template inherit it. Migration d1f3a5c7e9b2.

  • API:

    • CRUD under /api/client_profile;
    • a full list and a simple list, both with user counts;
    • bulk delete;
    • bulk assign/unassign via POST|DELETE /api/client_profile/{id}/users;
    • a new RBAC resource client_profiles.
  • Subscriptions resolve settings in this order:

    • templates: host > rule > profile > default;
    • title and support URL: profile > admin > global;
    • headers: global → profile additions → profile removals → rule headers.

    Profiles are cached and invalidated over NATS like other entities.

  • Dashboard:

    • a "Client profiles" tab on the Templates page;
    • a profile select in the user and user template dialogs;
    • an "Assign client profile" bulk action;
    • the new resource in the admin role editor.

Users without a profile get exactly the same subscription as before.

Part of splitting #759 into focused PRs.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor / cleanup
  • Documentation
  • Tests / CI

Checklist

  • I tested the change locally or explained why it cannot be tested.
  • I added or updated tests for behavior changes.
  • I updated documentation, translations, or examples if needed.
  • I checked database migrations when models or schema changed.
  • I did not include secrets, tokens, private keys, or unrelated changes.

Testing

uv run pytest tests/api/test_client_profile.py tests/api/test_subscription_client_profile.py tests/test_subscription_cpu.py -q   # 26 passed
cd dashboard && bun test src/features/templates/forms/client-profile-form.test.ts
bun run build

By hand on a local panel: I created two profiles and assigned them from the user dialog and with the bulk action. The subscription title, headers, update interval and template changed accordingly.

Screenshots

Will add in a comment.

Notes for reviewers

  • Changing a user's profile, directly or by applying a user template, is checked against the admin's client_profiles permissions for both the new and the current profile.
  • Groups already cover Remnawave's internal squads, and the hosts-group branch goes further in that direction, so this PR only adds the external side.
  • This PR and the template-routing PR overlap in a few subscription files (share.py, client_templates.py, config_cache.py, operation/subscription.py). I keep a branch with both merged and all tests passing (Rerowros:feat/remnawave-parity), so whichever PR lands second gets a ready rebase.
  • The migration branches from c8d2e4f6a1b3. If another PR in this series lands first, a merge revision will be needed.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 68534c1a-9c1f-40fb-a59b-79861500694a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…e and keep loading profiles saved before the stricter checks
…-all on users.update, refresh the template list and polish the profile dialog

- profile form rejects non latin-1 header values except profile-title and announce
- remove from all users needs users.update; with scope own the prompt has no panel-wide count
- the confirm dialog stays open until the request succeeds
- profile dialog: no stale template list, draft reset on close, input length caps, aria labels
- ClientProfileSelect passes FormControl id and aria attributes to its trigger
- getApiErrorDetail moved to utils/error-utils
@Rerowros
Rerowros marked this pull request as draft October 25, 2026 21:00
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