Forum Discussion

jmurray's avatar
jmurray
Champion
12 years ago

Group Role vs. Regular Roles

Hi,

 

I'm trying to do something like this, but with group roles:

<#assign is_gm = false />
<#list restadmin("/users/id/${user.id?c}/roles").roles.role as role>
<#if role.name?? && (role.name == "GroupMember")>
    <#assign is_gm = true />

 Then if it's true or false, I can make the page display accordingly.

 

Apparently this doesn't work for Group Roles though, because it's doesn't recognize GroupMember as a role.  So how do I modify it to check whether or not a person has a group role, as opposed to a regular role?

 

Thanks

  • Hey Jim,

    Unfortunately, there is no support to do this in our current API. But I tried it in a little different manner by using the following rest call

     restapi/vc/groups/id/[id]/default_role/users  

    where the default role for the group is 'GroupMember'. This will return all the users with that default role and then you can look for your user in this list. I understand that this might not be the optimal solution, but you can give it a try.

     

    Let me know if this helps

     

    Regards,
    Chhama

    • jmurray's avatar
      jmurray
      Champion
      If we have "GroupMembers" of other groups who show up in a different group, the call would end up treating them as though they are members of a group they are not members of. This really needs to be in the API. :(
      • ChhamaJ's avatar
        ChhamaJ
        Khoros Staff
        No actually not, since the call contains group id as well, so this will return you all users with Group Member role in a particular group. Anyhow, I have already brought this to the notice of concerned team so they have it in their roadmap.

        Regards,
        Chhama