Skip to content

Add user groups#6215

Closed
fthobe wants to merge 5 commits intosolidusio:mainfrom
S3-Store:add-user-groups
Closed

Add user groups#6215
fthobe wants to merge 5 commits intosolidusio:mainfrom
S3-Store:add-user-groups

Conversation

@fthobe
Copy link
Copy Markdown
Contributor

@fthobe fthobe commented Apr 10, 2025

Warning

Should be applied together with #6216 user group assignment via API and a PR in Starter Frontend

Video of the Feature*
https://github.com/user-attachments/assets/a944e1a2-958b-4628-8bd9-fead0bfc3a45

  • Not all functionalities in the video are part of this PR.

User Groups Feature

This pull request introduces a comprehensive User Groups management system in Admin, aimed at enhancing user management and improving the organization of users within the application. The main changes include the ability to enforce default user group assignments upon signup, manage user groups, and improve the admin interface for managing users and their groups.

Included Issues:

#1
#6

Key Features:

  1. Enforce User Group Assignment Upon Signup:

    • Updated the UsersController to assign a default user group to new users, based on the store's setting for enforce_group_upon_signup.
    • Added a checkbox to the store settings form to allow administrators to enable or disable this feature.
  2. User Groups Management in Spree Admin:

    • Introduced a new UserGroupsController to manage user groups within the admin panel.
    • Added user group management views.
    • Enhanced the user form to allow the assignment of user groups to users.
    • Updated store form to include a selection for the default cart user group.
  3. User Group Model and Core Associations:

    • Added Spree::UserGroup model with associations to users and stores to allow flexible user group management.
    • Added necessary database migrations to create the spree_user_groups table and reference user groups in the users and stores tables.

Benefits:

  • Improved User Management: This feature provides an efficient way for administrators to organize users into groups, streamlining management and enhancing the customer experience.
  • Customizable User Group Assignment: With the option to enforce user group assignment upon signup, store owners can ensure that all new users are categorized appropriately from the start.
  • Enhanced Admin Interface: The addition of user groups to the admin menu and interface makes it easier for admins to manage and assign users to groups.
  • Flexible and Scalable: The model and association changes allow for further customization, enabling targeted pricing, promotions, or content based on user groups.

Visual Changes:

image

@github-actions github-actions Bot added changelog:solidus_backend Changes to the solidus_backend gem changelog:solidus_core Changes to the solidus_core gem labels Apr 10, 2025
Added associations in Spree::User model for user groups to support grouping users for targeted pricing and management.
Created Spree::UserGroup model with associations to users and stores to enable flexible user group management.
Updated locale files to include translations for user groups.
Added migrations to create spree_user_groups table and add user group references to users and stores.
- Added UserGroupsController to manage user groups.
- Created views for user group management, including:
  - New user group form (`new.html.erb`)
  - User group edit form (`edit.html.erb`)
  - User group index view (`index.html.erb`)
  - Partial view for user group form fields.
- Enhanced user management by allowing assignment of user groups to users in the user form.
- Updated store form to include a selection for the default cart user group.
- Added breadcrumb navigation for improved user experience in the admin panel.

This feature allows administrators to create, edit, and manage user groups, facilitating better organization and access control for users within the Spree application.
- Created a new users sub-menu partial to manage user-related navigation, including links to users and user groups.

These enhancements improve the organization of the admin interface, making it easier for administrators to manage user groups effectively.
- Updated UsersController to assign the default user group to new users if the current store has the `enforce_group_upon_signup` setting enabled.
- Added a checkbox in the store settings form to allow administrators to enable or disable the `enforce_group_upon_signup` feature.
- Included a new translation key for the `enforce_group_upon_signup` label in the English locale file.

This feature ensures that all new users are automatically added to a specified user group, improving user management and organization within the Spree application.
@fthobe fthobe closed this Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_backend Changes to the solidus_backend gem changelog:solidus_core Changes to the solidus_core gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants