> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bbrands.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Roles and permissions

> What each kind of person can see and do in the customer portal, and where it is decided.

The portal has no roles assigned by hand. What a person can do depends on **their relationship with the
account they are working with** (the one picked in **Act as**) and on the environment's feature flags.

## Kinds of person

| Kind | Who they are | How they reach the portal |
| - | - | - |
| **Personal account holder** | The primary user of their own account | Sign-in, onboarding invitation or digital contract |
| **Company legal representative** | The person who answers for a customer company | Sign-in and **Act as** › the company; also invitation or contract |
| **Company administrator** | Manages a company without being its holder | Sign-in and **Act as** › the company; signs the company contract without the payment step |
| **Member without management rights** | Person linked to the account who is neither holder nor legal representative | Sign-in; sees the information but cannot change payment methods |

## What each one can do

| Action | Personal account holder | Legal representative | Company administrator | Member without management |
| - | :-: | :-: | :-: | :-: |
| See the switched-on sections | Yes | Yes | Yes | Yes |
| Switch between personal account and companies (**Act as**) | If they belong to a company | Yes | Yes | If they belong to a company |
| Add, set as default or delete a payment method | Yes | Yes | No | No |
| Do the onboarding when it is on | Yes, blocked until done | Yes, blocked until done | Not applicable | Not applicable |
| Sign the digital contract | Yes, with the payment step | Yes, with the payment step | Yes, without the payment step | Not applicable |
| Create or change their password | Yes | Yes | Yes | Yes |
| Obtain and use Club coupons | Per the Club eligibility rules (active plan, no debt, quotas and limits) | Same | Same | Same |

> [!NOTE]
>
> To add a payment method, besides being allowed to manage it, the account must be eligible, have a Chilean
> RUT and have at least one method kind allowed by the configuration. Otherwise the portal hides the
> **Agregar tarjeta** and **Registrar PAC** buttons.

Each section page details its rules under **Business rules**.

## Where it is decided

| Rule | Where it is computed |
| - | - |
| May manage payment methods (`can_manage`) | `backend/horizon-api/lib/endpoint/customer-payment-method/customer-payment-method.service.ts`: primary user or legal representative |
| May add payment methods (`can_enroll`) | Same service: also an eligible account, a Chilean RUT and an allowed kind |
| Companies offered in **Act as** | `GET /api/v3/auth/context` (`app/lib/shell/use-organization-context.ts`) |
| Company administrator's contract journey | `app/[locale]/(public)/contract/[contractId]/company-admin-journey.ts` |
| Who must do onboarding | Flag `portal-customer-onboarding`: primary user of a personal account or legal representative of a company |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.