mirror of
https://github.com/we-promise/sure.git
synced 2026-06-05 10:49:01 +00:00
Make first user of instance automatically super_admin (#655)
* Implement dynamic role assignment for new family creators. Introduced `User.role_for_new_family_creator` to assign `super_admin` to the first user of an instance and a configurable fallback role (e.g., `admin`) to subsequent users. Updated controllers and tests accordingly. * Update default fallback role for family creators to admin. --------- Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
This commit is contained in:
@@ -36,9 +36,10 @@ module Api
|
||||
user = User.new(user_signup_params)
|
||||
|
||||
# Create family for new user
|
||||
# First user of an instance becomes super_admin
|
||||
family = Family.new
|
||||
user.family = family
|
||||
user.role = :admin
|
||||
user.role = User.role_for_new_family_creator
|
||||
|
||||
if user.save
|
||||
# Claim invite code if provided
|
||||
|
||||
Reference in New Issue
Block a user