Role Management
Add and remove roles from community members with flexible permissions
Enforcement Tools
Ban and unban users to maintain community standards
Permission System
Check user permissions for granular access control
Administrative Control
Complete moderation toolkit for community governance
Add Roles
TheaddRoles()
function assigns existing roles to community members, providing flexible role-based access control. This function supports both default roles and custom roles configured in your community.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roles | String[] | Yes | Array of role names to assign |
userIds | String[] | Yes | Array of user IDs to receive the roles |
communityId | String | Yes | ID of the target community |
Remove Roles
TheremoveRoles()
function removes existing roles from community members. This function allows selective role removal while maintaining other assigned roles for the specified users.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
roles | String[] | Yes | Array of role names to remove |
userIds | String[] | Yes | Array of user IDs to remove roles from |
communityId | String | Yes | ID of the target community |
Ban Members
ThebanMembers()
function allows community creators and moderators to ban multiple members simultaneously. This provides an efficient way to enforce community rules and restrict access for users who violate community standards.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
userIds | String[] | Yes | Array of user IDs to ban from the community |
communityId | String | Yes | ID of the target community |
Unban Members
TheunbanMembers()
function removes bans from previously banned community members. This feature is useful when banned members have corrected their behavior and are ready to rejoin the community.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
userIds | String[] | Yes | Array of user IDs to unban from the community |
communityId | String | Yes | ID of the target community |
Permission Checking
ThehasPermission()
method provides a convenient way to check user permissions within a community. Use this method to implement proper access control and conditional UI elements based on user capabilities.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
permission | Enum | Yes | Permission type to check |
communityId | String | Yes | ID of the target community |
Available Permissions
Permission | Description |
---|---|
ADD_COMMUNITY_USER | Add members to community |
REMOVE_COMMUNITY_USER | Remove members from community |
BAN_USER | Ban users from community |
EDIT_COMMUNITY | Edit community settings |
DELETE_COMMUNITY | Delete the community |
MANAGE_COMMUNITY_USER | Manage user roles and permissions |
Moderation Rules
Role Hierarchy
- Community Creator: Automatically assigned moderator role, cannot be removed as last moderator
- Moderators: Can manage members, assign/remove roles, and enforce community rules
- Members: Standard community access with basic participation rights
Permission Requirements
- Add/Remove Roles: Moderator or Administrator permissions required
- Ban/Unban Members: Moderator or Administrator permissions required
- Permission Checks: Available to all authenticated users
Important Limitations
- The last moderator cannot leave a community without assigning another moderator
- Community creators are automatically assigned moderator roles
- Role operations apply to Community and Live channels only (not Conversation channels)
- Permissions are evaluated in real-time and may change based on role updates