cancel
Showing results for 
Search instead for 
Did you mean: 

user is part of specific group?

g_rathod
Star Contributor
Star Contributor
Hi Friends,

I have gone through various forum posts, but I am not able to get to solve my purpose.
I want to have specific user is part of my group?

e.g. I have  MEDIA_OWNER group. and I have added  abc, xyz users in it.

Any javascript API help on this?  to confirm that my user abc is part of MEDIA_OWNER group.
not pqr  user. and if it is pqr it return false or null like thing



1 REPLY 1

douglascrp
World-Class Innovator
World-Class Innovator
I think you can use the getMembers method from people's Javascript object as described here http://docs.alfresco.com/4.0/references/API-JS-getMembers.html

Using your group name, it should be something like:


// remember to use the prefix "GROUP_" before your group name
var node = people.getGroup("GROUP_MEDIA_OWNER");
   
    if(node){
        model.members = people.getMembers(node);        
    }

Doing that, you can iterate over the members list and check if the user you are testing is a member or not.