WHAT YOU'LL LEARN
  • how to create a Role
  • how to define access permissions for a Role
Can I use this?

In the Open Source version, you’ll have basic roles and permissions, where users either have full access or no access to a particular application.
To access the advanced roles and permissions feature, you need a Webiny Enterprise or Webiny Business license.

You can manage access permissions for users with Roles. In a Role, you define various access permissions, and then assign this Role to users. In this tutorial, we will learn how to create a Role with custom access permission to the Headless CMS. We will do this in 2 steps:

  • Step 1: Create a Role.
  • Step 2: Define access permissions.

As an example, we will create a Role with the following access permissions:

  • Permission to view and update a specific content model group.
  • Permission to view, create, and update all content models inside the content model group.
  • Permission to view, create, and update the content entries inside the content models.

Prerequisites
anchor

To follow this tutorial, you need to have a content model group named E-commerce in your Webiny instance. If you don’t have it, please follow the Create Content Model Group tutorial to create it.

Step 1: Create a Role
anchor

  1. From the Side Menu, click Settings > ACCESS MANAGEMENT > Roles.

    ✔️ The Roles screen opens.

  2. Click + New.

    ✔️ The form to create a new Role opens.

  3. In the Name textbox, type E-Commerce.

  4. In the Slug textbox, type e-commerce.

  5. In the Description textbox, type User Role for E-Commerce Managers.

Step 2: Define Access Permissions
anchor

  1. Under the Permissions section, click Headless CMS.

    ✔️ The Headless CMS accordion opens.

  2. In the Access Level dropdown, click Custom access.

  3. Under GraphQL API types, select all the three checkboxes - Read, Manage, and Preview.

  4. Under the Content Model Groups section:

    a. In the Access Scope dropdown, click Only specific groups.

    ✔️ A list of content model groups in the current locale appears.

    b. Select the E-Commerce checkbox.

    c. In the Primary Actions dropdown, click Read, write.

  5. Under the Content Models section:

    a. In the Access Scope dropdown, click All models.

    b. In the Primary Actions dropdown, click Read, write.

  6. Under the Content Entries section:

    a. In the Access Scope dropdown, click All entries.

    b. In the Primary Actions dropdown, click Read, write.

    c. Under Publishing actions, select Publish and Unpublish checkboxes.

  7. Click Save.

    ✔️ The message “Role saved successfully!” displays.