Files
sure/test/fixtures/users.yml
T
e5750a6c09 feat(budgets): add per-user personal budgets with strict isolation (#2891)
* feat(budgets): add per-user personal budgets with strict isolation

Families can now opt into personal budgets (toggleable via family
settings): each family member gets their own budget for a given
period instead of sharing a single family-wide budget.

- Add families.personal_budgets flag and budgets.user_id, with
  partial unique indexes so shared budgets (user_id IS NULL) and
  personal budgets (user_id IS NOT NULL) can't collide.
- Budget.find_or_bootstrap scopes lookup/creation by user when the
  family has personal_budgets enabled.
- Scope most_recent_initialized_budget (used to seed a new budget
  from the prior period) by user_id so one user's copy-forward never
  bleeds into another user's budget.
- budgets.user_id cascades on user deletion so personal budgets don't
  outlive their owner.

* feat(budgets): enforce user-specific budget ownership and cascade deletion

* feat(budgets): display user name for personal budgets in budget card on the plan section

* feat(budgets): enhance personal budgets display for admins with preview feature indication

* feat(budgets): enforce user-specific budget and category visibility for personal budgets

* feat(budgets): create budget section titles and add translations notice in preferences

* feat(budgets): let household and personal budgets coexist with sharing

Previously enabling personal_budgets made the shared household budget
unreachable. Budget.find_or_bootstrap now takes an explicit household:
flag so both can be resolved independently for the same period, with a
new household_budget_enabled family setting to opt out of the household
side and keep personal budgets only.

Adds a BudgetShare model (read_only/read_write) so a member can grant
another family member access to their personal budget, enforced via
Budget#viewable_by?/editable_by? across BudgetsController,
BudgetCategoriesController, PlansController, and the read-only API.
Preferences gains a Budget sharing card (gated on preview access like
the rest of the personal budgets UI) and an owner switcher pill (
Household / mine / shared-with-me) appears on the budget page and the
Plan hub card.

Also fixes personal budgets showing the same "actual spending" as the
household budget: actual spending/income now scope to the budget
owner's own accounts instead of the viewer's full accessible set,
via a new accounts: override on IncomeStatement.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* feat(budgets): enhance budget switcher with icons and improved styling

* feat(budgets): remove user name display from budget card and header

* feat(budgets): remove unique index on taggable_type and taggable_id in taggings

* feat(budgets): enhance budget sharing functionality and improve UI elements

* Collapse personal budget migrations

---------

Signed-off-by: JulienGourmet <69808509+jubbakka@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: sure-admin <sure-admin@splashblot.com>
2026-08-18 08:36:46 +02:00

133 lines
3.3 KiB
YAML

# password_digest is BCrypt::Password.create(user_password_test, cost: BCrypt::Engine::MIN_COST).
# Keep MIN_COST here: verification cost is embedded in the digest, so a
# production-cost digest adds ~230ms of CPU to every sign_in in tests.
empty:
family: empty
first_name: User
last_name: One
email: user1@example.com
password_digest: $2a$04$deKu1NIqviMgrl.4NkXcieFkAmLa33RN9Tw/R/Llr22eMd4x/o/RO
onboarded_at: <%= 3.days.ago %>
role: admin
ai_enabled: true
show_sidebar: true
show_ai_sidebar: true
ui_layout: dashboard
sure_support_staff:
family: empty
first_name: Support
last_name: Admin
email: support@sure.am
password_digest: $2a$04$deKu1NIqviMgrl.4NkXcieFkAmLa33RN9Tw/R/Llr22eMd4x/o/RO
role: super_admin
onboarded_at: <%= 3.days.ago %>
ai_enabled: true
show_sidebar: true
show_ai_sidebar: true
ui_layout: dashboard
family_admin:
family: dylan_family
first_name: Bob
last_name: Dylan
email: bob@bobdylan.com
password_digest: $2a$04$deKu1NIqviMgrl.4NkXcieFkAmLa33RN9Tw/R/Llr22eMd4x/o/RO
role: admin
onboarded_at: <%= 3.days.ago %>
ai_enabled: true
show_sidebar: true
show_ai_sidebar: true
ui_layout: dashboard
family_member:
family: dylan_family
first_name: Jakob
last_name: Dylan
email: jakobdylan@yahoo.com
password_digest: $2a$04$deKu1NIqviMgrl.4NkXcieFkAmLa33RN9Tw/R/Llr22eMd4x/o/RO
onboarded_at: <%= 3.days.ago %>
role: member
ai_enabled: true
show_sidebar: true
show_ai_sidebar: true
ui_layout: dashboard
new_email:
family: empty
first_name: Test
last_name: User
email: user@example.com
unconfirmed_email: new@example.com
password_digest: $2a$04$deKu1NIqviMgrl.4NkXcieFkAmLa33RN9Tw/R/Llr22eMd4x/o/RO
onboarded_at: <%= Time.current %>
role: member
ai_enabled: true
show_sidebar: true
show_ai_sidebar: true
ui_layout: dashboard
intro_user:
family: empty
first_name: Intro
last_name: User
email: intro@example.com
password_digest: $2a$04$deKu1NIqviMgrl.4NkXcieFkAmLa33RN9Tw/R/Llr22eMd4x/o/RO
onboarded_at: <%= 1.day.ago %>
role: guest
ai_enabled: true
show_sidebar: false
show_ai_sidebar: false
ui_layout: intro
inactive_trial_user:
family: inactive_trial
first_name: Inactive
last_name: User
email: inactive@example.com
password_digest: $2a$04$deKu1NIqviMgrl.4NkXcieFkAmLa33RN9Tw/R/Llr22eMd4x/o/RO
role: admin
onboarded_at: <%= 90.days.ago %>
ai_enabled: true
show_sidebar: true
show_ai_sidebar: true
ui_layout: dashboard
# SSO-only user: created via JIT provisioning, no local password
sso_only:
family: empty
first_name: SSO
last_name: User
email: sso-user@example.com
password_digest: ~
role: admin
onboarded_at: <%= 1.day.ago %>
ai_enabled: true
# Additional test users expected by PersonalBudgetTest
josh:
family: empty
first_name: Josh
last_name: Tester
email: josh@example.com
password_digest: $2a$12$XoNBo/cMCyzpYtvhrPAhsubG21mELX48RAcjSVCRctW8dG8wrDIla
onboarded_at: <%= 2.days.ago %>
role: member
ai_enabled: true
show_sidebar: true
show_ai_sidebar: true
ann:
family: empty
first_name: Ann
last_name: Tester
email: ann@example.com
password_digest: $2a$12$XoNBo/cMCyzpYtvhrPAhsubG21mELX48RAcjSVCRctW8dG8wrDIla
onboarded_at: <%= 2.days.ago %>
role: member
ai_enabled: true
show_sidebar: true
show_ai_sidebar: true