• HOME
  • INTEGRATIONS
  • SDKS
  • GUIDES
  • API DOCS
No results for ""
EXPAND ALL
launchdarkly.com

EDIT ON GITHUB

Creating custom roles and policies

Read time: 3 minutes
Last edited: Oct 22, 2020

Overview

This topic explains how to create and implement custom roles and policies in LaunchDarkly.

This topic only describes creating custom roles with the basic policy editor

If you need to use custom roles to address a scenario not covered in the documentation, you can write your own policies with the advanced editor.

To learn more, read Writing policies in the advanced editor.

Creating a custom role

Before you can give a team member custom permissions in LaunchDarkly, you must create a custom role to assign to them.

To create a custom role:

  1. Navigate to Account Settings.
  2. Click into the Roles tab.
  3. Click New Role. The "Create a role" screen appears.
  4. Enter a human-readable Name for the role.
  5. Enter a Key for the role.
  6. (Optional) Enter a Description to explain what the role does.
  7. Create a policy in the "Policy" fields.
  8. Click Save Role.

The "Create a role" screen.
The "Create a role" screen.

Creating policies for custom roles

Policies are sets of actions a custom role is allowed or not allowed to take. You can create policies from the Roles tab.

Write policies by hand in the advanced editor

Advanced users can write custom policies of their own with the Aadvanced editor.

To learn more about writing your own policies, read Using policies.

To create a policy:

  1. Complete the steps in Creating a custom role.
  2. In the "Create a role" screen, click into the Resources field.
  3. Specify a resource this policy affects.
The resource finder can help

Many common LaunchDarkly items are resources, including flags, metrics, and more. If your LaunchDarkly project is large, it may be difficult to find the exact resource you need.

Click Resource finder to choose projects, feature flags, environments, metrics, and roles to add to your policy.

To learn more, read Finding resource IDs.

  1. Choose an Effect from the dropdown.
  2. Choose one or more Actions for the policy to enforce.

The Actions dropdown with options selected.
The Actions dropdown with options selected.

  1. Click Update. The results of your policy display.

A custom policy.
A custom policy.

Giving a team member a custom role

After you have created a custom role and policies for it, you must give that role to all members to whom you wish it to apply.

To give a member a custom role:

  1. Navigate to Account Settings.
  2. Click into the Team tab and find the team member you wish to give a custom role.
  3. Click Edit beside that team member's name. The member's Settings page opens.

The member's Settings page.
The member's Settings page.

  1. Click the member's Role. A dropdown menu expands.
  2. Choose Custom. All available custom roles appear with checkboxes beside them.

The Role dropdown menu.
The Role dropdown menu.

  1. Choose all custom roles you wish to give the member.
  2. Click Save Member.

Custom roles given to the member.
Custom roles given to the member.

You must assign roles to members individually

You must add a custom role to one member at a time. You may not apply a role to multiple members simultaneously.

For example, if you wish to add a role for the QA team, you must find each QA team member and add the role to each member individually.

Removing a team member's custom role

If a team member changes function or needs their permissions modified, you can remove a custom role from them at any time.

To remove a custom role from a member:

  1. Navigate to Account Settings.
  2. Click into the Team tab and find the team member you wish to remove a custom role from.
  3. Click Edit beside that team member's name. The member's Settings page opens.
  4. Deselect the checkboxes for the roles you wish to remove from the member.
  5. (Optional) If you wish to return the member to a standard role, choose Reader, Writer, or Admin / Owner from the Role dropdown.

The Role dropdown menu.
The Role dropdown menu.

  1. Click Save Member.

Viewing custom role details

You can see details about a specific custom role. More information is available on the "Role policy details" screen.

Use the "Role policy details" screen to view detailed information about a custom role, including which projects and feature flags the role has permission to modify. You can also see each action the custom role can perform and what that action does.

The "Role policy details" screen.
The "Role policy details" screen.

To view details for custom roles from the Roles tab:

  1. Navigate to Account Settings and click into the Roles tab.
  2. Find the role with details you wish to view and click Details. The "Role policy details" screen appears.

A role's entry in the Roles tab with the Details button called out.
A role's entry in the Roles tab with the Details button called out.

To view details for custom roles in other parts of the LaunchDarkly UI, click a custom role's name to open the "Role policy details" screen.

A member's entry in the Team tab with their custom roles called out.
A member's entry in the Team tab with their custom roles called out.

Editing existing custom roles

Edit an existing policy at any time by clicking the pencil icon or add a new policy to a custom role by clicking Add statement.

To edit a custom role:

  1. Navigate to Account Settings.
  2. Click into the Roles tab and find the role you wish to edit.
  3. Click Edit. The "Edit custom role" screen appears.

The "Edit custom role" screen.
The "Edit custom role" screen.

  1. Change whatever features of the role you wish.
  2. Click Save.

Deleting custom roles

Delete a custom role from the Account Settings page.

To delete a custom role:

  1. Navigate to Account Settings.
  2. Click into the Roles tab and find the role you wish to edit.
  3. Click Edit. The "Edit custom role" screen appears.
  4. Click Delete Role.

The "Delete role" button.
The "Delete role" button.