Community Membership
You can get a list of community members by calling the following method:
Enum Types
AmityCommunityMembershipFilter
AmityCommunityMembershipSortOption
Required parameter
communityId
- the ID of the community to query
Optional parameters
memberships
- filter for membership type. The possible values are: (seeCommunityUserMembership
)'none'
- not a member of the community'member'
- member of the community'banned'
- member banned from the community
sortBy
- sorting method to arrange the returned collection. The possible values are: (seeCommunitySortingMethod
)'firstCreated'
'lastCreated'
The default value of sortBy
is LAST_CREATED
so you can skip .sortBy
in builder.
Roles and Permission
Creator of community can add and remove role of user via AmityCommunityModeration
.
Roles
You can add or remove default roles as well as custom roles.
Note:
The channel creator is automatically assigned as the channel moderator.
The previous/last moderator is not allowed to leave a community and an error is displayed.
The channel moderator can promote a user/member to moderator.
The channel moderator can demote a moderator to a user/member.
This applies only to Live and Community channels’. This does not apply to Conversation Channel.
Query Memberships by Role
The AmityCommunityParticipation
provides a list of members by role in the given community.
The roles
parameter filter members by specific role.
To query members with the default moderator roles assigned, you can use 'channel-moderator'
, 'community-moderator
'. At this moment, we do not have a way to query for member-only roles. However, if you have assigned a custom role to a member in the community, you can pass in the roleId
of the custom role to filter members by this role.
Please note that you can only assign custom roles to a member in a community via the SDK. This feature is not available yet on Amity Console.
Applying a custom role to a user via Amity Console will only apply the role at the user-level, and not at the community level, and if you try to query for a member with this custom role, no results will be returned.
Permission
You can check your permission in community by sending AmityPermission
enums to AmityCoreClient.hasPermission(amityPermission)
method.
Last updated