Overview
In your Spree application you will usually have 2 types of users:- Customers - users who browse and purchase products
- Admins - users who manage the store via the Admin Panel
| Class | Description | Default |
|---|---|---|
Spree.user_class | Customers who browse and purchase products | Spree::User |
Spree.admin_user_class | Administrators who manage the store via Admin Panel | Spree::AdminUser |
You can use your own User classes. More on this in the Customize Authentication guide.
Customers
Customers are users who browse your store and purchase products. They are managed viaSpree.user_class.
Customers can have:
- Addresses - both billing and shipping
- Orders - a list of products that the customer has purchased
- Credit Cards - saved credit cards for checkout
- Payment Sources - saved non-credit card payment methods (PayPal, Klarna, etc.)
- Store Credits - assigned by the store owners, to be used to purchase products
- Gift Cards - gift cards owned by or assigned to the customer
- Wishlists - a list of products that the customer has marked as a wishlist
Customer Attributes
| Attribute | Description | Example Value |
|---|---|---|
email | The email address of the customer | [email protected] |
ship_address_id | References the default shipping address | 2 |
bill_address_id | References the default billing address | 3 |
Customer Methods
Spree.user_class includes several ActiveRecord concerns which provide additional methods:
Returns the last incomplete order for the given store.
Returns the total amount available store credits for the customer in the given store.
Returns the default Wishlist for the given Store.
Returns a list of all active payment sources (credit cards, PayPal, Klarna, etc.) that can be used on checkout.
Admins
Admins are users who manage the store via the Admin Panel. They are managed viaSpree.admin_user_class.
Admin Roles
Admin users can have different roles attached which control their permissions in the Admin Panel.| Role | Description |
|---|---|
admin | Full access to all Admin Panel features |
You can create custom roles with specific permissions. See the Customize Permissions guide for more details.
Managing Admin Access
Resources that include theSpree::UserManagement concern (such as Spree::Store) provide methods to manage admin access:
Admin User Invitation Flow
Spree uses a customSpree::Invitation model to handle admin user invitations. This provides a secure, token-based invitation system with built-in expiration and role assignment.
Invitation Model
TheSpree::Invitation model tracks:
| Attribute | Description |
|---|---|
email | Email address of the invitee |
token | Secure token for the invitation link |
status | pending or accepted |
expires_at | When the invitation expires (default: 2 weeks) |
resource | The resource being granted access to (e.g., Store) |
role | The role to assign upon acceptance |
inviter | The admin who created the invitation |
invitee | The user who accepts the invitation |
Inviting an Admin via Admin Panel
- Navigate to Settings → Users in the Admin Panel
- Click Invite User
- Enter the new admin’s email address
- Select the appropriate role
- Click Send Invitation
Inviting an Admin via Code
Resending an Invitation
Accepting an Invitation
When an invitee accepts, the invitation transitions toaccepted and a Spree::RoleUser record is created linking the user to the resource with the specified role.
Invitation Expiration
By default, invitations expire after 2 weeks. You can customize this per invitation:Invitation Events
The invitation system publishes events that you can subscribe to:| Event | Description |
|---|---|
invitation.created | Invitation was created (triggers email) |
invitation.accepted | Invitation was accepted |
invitation.resent | Invitation was resent |
Permissions
Spree uses CanCanCan library to handle authorization for both customers and admins. More on permissions can be found in the Customize Permissions guide.Current User
In Spree controllers or any controller inheriting fromSpree::BaseController, you can access the current user with spree_current_user method:
Related Documentation
- Addresses - User address management
- Orders - User order history
- Authentication - Custom authentication
- Permissions - User permissions and authorization

