Pinned topicRam api to get roles and usergroups based on the community name and user id

‏2010-07-10T10:09:00Z
|Tags:

Answered question
This question has been answered.

Unanswered question
This question has not been answered yet.

I want to get the roles and usergroups which the user id belongs to in a community.
I do some researches and code as follows, but I am not sure whether it is correct or could anyone provides some more efficient RAM api to me.