Skip to content

Updating visuals

If you see any images containing outdated UI, please bear with us.

We are updating all content as quickly as possible to mirror our new UI.

Managing roles ​

Roles help you control what permissions a user has. This allows you to prevent unauthorized access to things such as table views, API Endpoints, and pages in the interface.

To access the roles of your application, visit the Roles tab in the Authentication subtab of Data & API (see Creating roles below).

Understanding roles ​

Roles are labels you assign to users to control what they can access in your app. They work as a permission system that lets you build different experiences for different types of users.

How roles work ​

When you create a role, you can then:

  1. Assign it to users in the Users tab of the Authentication subtab in Data & API
  2. Restrict access to table views based on roles
  3. Restrict access to API Endpoints based on roles
  4. Show or hide interface elements based on the user's roles
  5. Protect entire pages so only users with specific roles can access them

Roles are enforced automatically by WeWeb when you configure access restrictions. If a user doesn't have the required role, they'll be blocked from accessing that resource.

Creating roles ​

  1. Open the Data & API tab, then open the Authentication subtab
  2. In the Authentication panel, open the Roles tab
  3. Click Insert to create a new role
  4. In Create a Role, enter a clear, descriptive Name (for example, user, manager, admin)
  5. Click Insert
The Roles tab of the Authentication subtab, with the admin role in the list and the Insert buttonThe Create a Role window with admin as the Name and the Insert button

Keep role names simple, lowercase, and consistent throughout your app. Avoid spaces or special characters.

ROLE NAMING BEST PRACTICES

  • Use lowercase for consistency (e.g., admin not Admin)
  • Be descriptive but concise (e.g., content_editor not user_who_can_edit_content)
  • Match your app's domain (e.g., teacher, student for an education app)
  • Avoid changing role names after launch (as it will likely mean you need to update many parts of logic that use old names)

Assigning roles to users ​

Once you've created roles, you can assign them to users:

  1. Go to the Users tab in the Authentication subtab of Data & API
  2. Click the pencil icon next to the user's checkbox to open Update User
  3. In the roles field, add or remove roles as needed, then click Save
  4. Changes take effect once the user refreshes the page
The Update User window of a test user, with the admin role checked in the roles field

Users can have multiple roles at the same time. For example, a user could have both user and premium roles.

TESTING WITH ROLES

Create multiple test users with different role combinations to verify your access controls work correctly. For example:

  • Test user with no roles (basic authenticated user)
  • Test user with admin role
  • Test user with premium role

Where roles are enforced ​

Roles are automatically enforced in multiple places throughout your WeWeb app:

Table views ​

When you create a view on a table, you can restrict access based on roles:

  1. Go to the Data & API tab, then open the Tables subtab, then select the table that contains your view.
  2. Open the view (it shows as a tab at the top of the table).
  3. In the view header, click the access button (it usually shows Public or Authenticated).
  4. Choose one of:
    • Public — Anyone can retrieve data from this view (no sign in required).
    • Authenticated — Only signed-in users can retrieve data.
  5. If you chose Authenticated, you can also restrict by role:
    • Choose Match any or Match all.
    • Select one or more roles (for example admin).
The Access popover of a view set to Authenticated, with a Match any condition restricting the view to the admin role

For example, you might create an "Admin users view" that only users with the admin role can access, while having a separate "Public users view" that anyone can read.

API Endpoints ​

When you create an API Endpoint, you can restrict who can call it:

  1. Open your API Endpoint from the API Endpoints section in the Backend Workflows subtab of Data & API
  2. Click the access button at the top of the API Endpoint (it shows Public or Auth, followed by +Roles when roles are required) to open the Security panel
  3. Choose one of:
    • Public — Anyone can call this API Endpoint (use only for non-sensitive operations)
    • Authenticated — Only signed-in users can call it
  4. If you chose Authenticated, you can also restrict by role: choose Match any or Match all, then select one or more roles
The Security panel of an API Endpoint set to Authenticated, with Match any and the admin role, and the Auth+Roles button

Learn more about securing your API Endpoints: Securing API Endpoints →

Pages ​

You can protect entire pages so only users with specific roles can access them:

  1. Go to Interface and select a page
  2. Open the page settings
  3. Open Private access
  4. Set Who can access this page to Authenticated users
  5. In Roles who can access this page, choose the roles allowed to access the page
The Private access panel of a page, with Who can access this page set to Authenticated users and the admin role in Roles who can access this page

When a user without the required roles tries to access a protected page, they'll be redirected to the Page for unauthorized users set in Define default redirections.

Interface elements ​

You can also show or hide elements in your interface based on the current user's roles using conditional visibility or workflow conditions with the auth data available in the binding window.

For example, to show an Admin button only to admins, select the button, open its settings, and bind the Condition of Conditional Rendering to a formula like contains(auth.user.roles, "admin"). The button is then hidden for users who don't have the admin role:

An Admin button whose Conditional Rendering condition is bound to contains(Auth user roles, admin) in the binding window

Checking roles in workflows ​

In your workflows and bindings, you can access the current user's roles via the auth data:

  • auth.user.roles — Array of role names assigned to the current user
  • You can use this in conditions to show/hide elements or branch your workflow logic

The ROLES section of the binding window lists the names of the roles you created:

The auth data of the binding window, with the roles field of the user and the ROLES section listing the admin role

For example, you might show an "Admin Panel" button only if auth.user.roles contains the admin role.

In a workflow, add a True/False split action (in Interface → Flow (Logic)) and bind its Condition to the same formula. The actions under true only run for users with the admin role:

An Is admin True/False split in an interface workflow, with its Condition bound to contains(Auth user roles, admin)

INTERFACE CHECKS ARE NOT SECURE

Using role data in the interface (to show/hide elements or control navigation) improves user experience but does not provide security. Anyone with technical knowledge can bypass interface restrictions by manipulating the browser or directly calling your API Endpoints.

Always enforce security in your backend:

  • Restrict table views with the Access setting
  • Secure API Endpoints with the Security panel (public/authenticated/role-based restrictions)
  • Use Middleware workflows for custom permission logic

Think of interface role checks as a convenience for users, not a security measure. Real security happens on the backend where users cannot bypass it.

CONTINUE LEARNING

Connect sign-in providers so users can authenticate.

SSO Providers →