Comprehensive community moderation tools including role management, enforcement actions, banning, and permission systems
addRoles()
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.
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 |
removeRoles()
function removes existing roles from community members. This function allows selective role removal while maintaining other assigned roles for the specified users.
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 |
banMembers()
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.
Parameter | Type | Required | Description |
---|---|---|---|
userIds | String[] | Yes | Array of user IDs to ban from the community |
communityId | String | Yes | ID of the target community |
unbanMembers()
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.
Parameter | Type | Required | Description |
---|---|---|---|
userIds | String[] | Yes | Array of user IDs to unban from the community |
communityId | String | Yes | ID of the target community |
hasPermission()
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.
Parameter | Type | Required | Description |
---|---|---|---|
permission | Enum | Yes | Permission type to check |
communityId | String | Yes | ID of the target community |
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 |