> For the complete documentation index, see [llms.txt](https://developer.emporix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.emporix.io/ce/customer-use-cases/scenarios-introduction/right-roles.md).

# User Management and Approvals

As a B2B customer, with Emporix you can easily manage your company data and your company users' data directly from your storefront.

## Company setup while registering as a customer

When a new customer registers at your storefront, all the registration data are automatically reflected in your Emporix account. This includes the company data, like address and contact information that your new customer provided during the registration. The most important piece of information is the customer's email address. By default, the customer is created with the admin role and becomes a primary contact for the company, if no other primary contact exists.

{% hint style="warning" %}
Make sure you add security measures in your implementation for creating new B2B customers on the storefront. For the showcase purposes, the new customer by default gets admin rights which for sure is not the desired behavior on your side.
{% endhint %}

## Creating users within the storefront

1. Log in to your storefront account and go to **My account** -> **Manage Users**.
2. To start creating a new user, choose **Create new user**.
3. Enter the user data, and choose the role for the user: you can select between Admin, Purchaser and Requester.
   * **Admin**: manages users, creates orders, approves orders from other users, who have the purchaser or material manager roles.
   * **Purchaser**: creates orders within the defined account threshold and can approve orders from material managers
   * **Requester**: creates order requests for purchaser or admin
4. Choose if the user should be activated or not.

After you create the new user, they receive an email notification to set the account password.

<figure><img src="/files/DF7trmZgxrCQ8fp3PeRJ" alt=""><figcaption></figcaption></figure>

All of the users' data is reflected and visible in the Emporix account in the backend system.

## B2B sign-up process

During the sign-up process, when the customer has a defined `b2b.companyRegistrationId` property, an additional validation takes place. The populated `b2b` property indicates that the registration process is for the B2B customers. The properties that are required for the B2B customers are:

* `firstName`
* `lastName`
* `company`

By default, a B2B customer is added to a legal entity matched by the name. If such a legal entity doesn’t exist, the company is created in the system, but only after an address is assigned to the newly created customer.

When the `Admin` customer creates a customer, the customer is automatically assigned to the legal entity of the `Admin` customer. When the customer is created for the B2B flow, then the default employee is informed about that by an email notification. The default employee is defined by the `default_employee` property.

## Approval requests flow

Having different user roles within a company helps keep purchasing transparent and controlled. Depending on the customer's group (`Admin`, `Buyer`, `Requester`) and the company purchasing limit, purchases may require approval before finalization — at **checkout** for an order, or when a customer accepts an **Open** quote. The sections below describe the order approval flow in the storefront. Quote acceptance follows the same role-based rules, but that workflow must be turned on separately.

{% hint style="info" %}
**Quote approval** uses the same customer group logic as order checkout: only customers with the right permissions can accept a quote directly; others must request approval from a company approver. Enable it with **Enable quote approval process** (`approval.enableQuoteApprovalProcess`) in [System Preferences](/ce/management-dashboard/settings/system-preferences.md).

For role details and flows, see the [Quotes](/frontend/commerce-examples/quote-process.md) and [Approvals](/ce/core-commerce/customer-management/approvals.md).
{% endhint %}

{% hint style="danger" %}
To be able to set up such a workflow and properly resolve relevant access rights, you need to generate a **B2B token** that contains the legal entity information. The `refreshtoken` ensures that the authorization token contains the right legal entity details so that the services retrieve only the relevant information. To learn more about the B2B token, refer to the [B2B Token](/api-references/quickstart/authentication-and-authorization/tokens-and-scopes.md#employee-users-tokens) documentation.
{% endhint %}

### Requesting an approval for order

As a purchaser (`Buyer`) or material manager (`Requester`), you can create orders within the storefront and then request an approval. To request the approval, a user has to create a standard order first and then go through the standard checkout flow. During the checkout, the user can create an approval request for ordering the items in the cart.

<figure><img src="/files/LEilC72SCM0wagu9tXkv" alt=""><figcaption></figcaption></figure>

{% stepper %}
{% step %}

#### Request approval

To start the approval process, choose the **Request approval** option.
{% endstep %}

{% step %}

#### Select approver and submit

Choose the person who should be an approver of the request and add any additional information if necessary. After that, use the **Submit** button to send the request.

<figure><img src="/files/Tac9fidjMxP2S6BM7316" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Check the result

After sending the approval request, an email notification is sent to the approver. You can also see a confirmation message that the approval was requested. In your **Saved Carts**, you can check the status of your request.

<figure><img src="/files/1BGilcuvEUEGKS5Uu5xa" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### Approving the request

As an admin, you have the permission to approve the order requests that are sent by a purchaser or a material manager. When such a request is created, you get an email notification informing you about a pending approval.

{% stepper %}
{% step %}

#### Open carts

To start working on the approval requests, go to the **Saved Carts** in your storefront account. Here, you can check the requests that are pending processing.
{% endstep %}

{% step %}

#### Select the approval request

Choose the approval request to view the checkout details for the order.
{% endstep %}

{% step %}

#### Approve or decline the request

Review the order, change the shipping information if needed, and decide if you approve or decline the request.

* If you decide to approve, choose the **Confirm & Pay** button. This completes the checkout process.
* If you decide not to approve, choose the **Decline Request** option. The requester receives information that the request was declined.

<figure><img src="/files/1LJA9VCwSR50y8x2md2n" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.emporix.io/ce/customer-use-cases/scenarios-introduction/right-roles.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
