Customizing NowSecure Platform Roles via GraphQL API

Introduction
Prerequisites
Graph Queries

Introduction

The following instructions enable organizations to leverage GraphQL mutations to create, customize, remove, and reset roles within NowSecure Platform.

Note: Only those with Admin role permissions may create custom roles and set permissions. All default roles may be updated, except Admin.

Roles are located and can be set within the Admin > Permissions tab of NowSecure Platform.

1.png

Prerequisites

You will first need a token for authentication. See the Creating an API Bearer Token article for more detailed instructions.

Within NowSecure Platform, select your Profile in the upper right > Tokens. Select Generate Token  Below examples uses token titled "GraphQL".

3.png

Note: This token is presented one time, so copy it and keep it safe. You can revoke it and create another, if needed. 

Next, navigate to the NowSecure GraphQL Playground.NowSecure GraphQL Playground

Add your bearer token to the HTTP Headers area. The format is:

{“Authorization” : “Bearer YOUR-TOKEN-HERE”}

Below is what the window should look like if entered it properly. Notice the (1) in the headers title:GraphQL bearer token

Graph Queries

View Role Information

To make changes to existing roles, you need to know the role’s unique identifier or ref.

You can query the roles in your account by running the following GraphQL query:

query {
  my {
    organization {
      roles {
        ref, name, label
      }
    }
  }
}

Note: To call a mutation, use the keyword mutation before the GraphQL query. To pass an input type, provide the data written as a .json object. Below are several mutations you may use to customize roles within NowSecure Platform.

Rename default roles

In this example, we will change the default role of Developer to UPLOADERS. User roles can be found in the Admin tab > Users in Platform.

You can query the roles in your account by running the following GraphQL query:

mutation {
  organization {
    updateRole(ref: "{...}", label: "{New Label}"){ref, name, label}
  }
}

Replace the ref and label with the appropriate updates.

Once complete, the role should be updated from Developer to UPLOADERS within NowSecure Platform.

Create a role

Leverage a GraphQL mutation to create a new role, e.g., Auditor. You may choose the name that best fits your new role.

mutation {
  organization {
    createRole(label: "Auditors"){ref, name, label}
  }
}

Once complete, the new role should be visible within NowSecure Platform , within Roles.

Removing a role

This mutation removes a role from Platform.

mutation {
  organization {
    removeRole(ref: "...")
  }
}

Reset a role

Resetting a role removes any custom alias or permissions.

mutation {
  organization {
    resetRole(ref: "..."){ref, name,label,permissions {ref,label,privileges}}
  }
}
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.