Permissions

Introduction

This page shows how you can create or update roles for a call type.

Stream has a role-based permission system. Each user has an application-level role, and also channel (chat product) and call (video product) level roles. Every role (be it application or call/channel level) contains a list of permissions. A permissions is an action (for example, create a call). The list of permissions assigned to a role defines what a user is allowed to do. Call roles are defined on the call type level.

Configuring roles

When you create a call type, you can specify your role configurations. A role configuration consists of a role name and the list of permissions that are enabled for that role.

When you create a call type, it comes with a default set of configurations. You can override or extend that.

The following example overrides the permissions of the built-in admin role and defines the customrole.

Please note that for the below code to work, you need to create the customrole beforehand. You can do that in your Stream Dashboard.

client.video.createCallType({
  name: "<call type name>",
  grants: {
    admin: ["send-audio", "send-video", "mute-users"],
    ["customrole"]: ["send-audio", "send-video"],
  },
});

// or edit a built-in call type
client.video.updateCallType({
  name: "default",
  grants: {
    /* ... */
  },
});

See how you can list permissions below.

Built-in roles

There are 5 pre-defined call roles, these are:

  • user
  • moderator
  • host
  • admin
  • call-member

You can access the default roles and their permissions in your Stream Dashboard.

You can also list roles and their permissions using the Stream API:

client.video.listCallTypes();

//or
client.video.getCallType({ name: "livestream" });

Permissions

The list of call permissions that you can include in your role configurations:

const resonse = await client.listPermissions();
console.log(response.permissions);

Capabilities

When users access calls they’ll receive an own_capabilities field in the call object, which contains all call related capabilities a user is allowed to do. This can be used by client-side SDKs to do permission checks for hiding/showing UI elements (for code examples checkout SDK documentations). Capabilities are not the same as permissions. Permissions are the list of actions the Stream API supports. Capabilities are the list of actions a given user is allowed to do in the scope of a given call taking into account:

  • application-level and call-level role of the user
  • call type settings
  • call-level settings
© Getstream.io, Inc. All Rights Reserved.