In Stream's architecture, channels are organized in groups called Channel Types
- This is most often the first parameter to pass when initializing a channel
Channel types can be configured with specific permissions and features. The five default channel types (commerce, gaming, messaging, livestream, and team) come with different default permission policies preconfigured to best fit one use-case. For example, one of the default permission policies for the 'messaging' channel type "only allows users with a moderator or admin role to ban another user".
- Find more information in this docs section
Modify/adapt those policies to fit your use-case or even create a custom channel type with its own set of permissions policies according to your needs.
A policy is structured by a User Role being Allowed/Denied access to Ressources, ex: user with admin role are allowed to create channels, and/or, create a message, and/or ban a user...
Once the policies for the channel type are loaded, the list of policies is iterated based on priority (highest first) - If the policy matches the current request, then the request is either accepted or discarded (allow/deny action)
If there is not match, continue iterating until one policy matches. Please note here that define policies' priority is also important.
- Visit this docs section to learn more about Policies structure and permission checks logic
Change permission policies :
You can change/create permission policies applied to a Channel Type at any time through the dashboard.
Change user roles:
You can indeed change a user role to admin or moderator using the API. However, please note that any role management operation is only allowed server-side, You will need to update your users server-side to change their roles
You can also learn more about User Roles in this docs section