Example: Given a "member" "Admin" belonging to "Admin Group"

@Given /^(?:(an|a|the) )"member" "(?<id>[^"]+)" belonging to "(?<groupId>[^"]+)"$/
178316
public function stepCreateMemberWithGroup($id, $groupId) {
		$group = $this->fixtureFactory->get('Group', $groupId);
		if(!$group) $group = $this->fixtureFactory->createObject('Group', $groupId);
		
		$member = $this->fixtureFactory->createObject('Member', $id);
		$member->Groups()->add($group);
	}
273851
def is_member(self, m):
        """"""
        if not m:
            return False
        elif isinstance(m, basestring):
            jid = m
        else:
            jid = m['JID']

        is_member = len(filter(lambda m: m['JID'] == jid and m.get('STATUS') in ('ACTIVE', 'INVITED'), self.params['MEMBERS'])) > 0

        return is_member
218502
def user_in_group?(user, group)
      group = normalize_group(group)
      return user_is_admin?(user) if group == "admins"
      redis.sismember(group, user.id)
    end
360593
def srandmember(self, key, count=None, *, encoding=_NOTSET):
        """"""
        args = [key]
        count is not None and args.append(count)
        return self.execute(b'SRANDMEMBER', *args, encoding=encoding)
47758
private Collection<Membership> findMembershipsByGroup(Session session, Group group) throws Exception
   {
      Node groupNode;
      NodeIterator refUsers;
      try
      {
         groupNode = utils.getGroupNode(session, group);
         refUsers = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNodes();
      }
      catch (PathNotFoundException e)
      {
         return new ArrayList<Membership>();
      }

      List<Membership> memberships = new ArrayList<Membership>();
      while (refUsers.hasNext())
      {
         Node refUserNode = refUsers.nextNode();
         memberships.addAll(findMembershipsByUserAndGroup(session, refUserNode, groupNode));
      }

      return memberships;
   }
753967
def team_id(team, org)
      /^\d+$/.match(team.to_s) ? team : team_id_by_slug(team, org)
    end
1009306
def belongs_to_ldap_group?(username, groupname)
      return false if service.nil?
      group_filter = Net::LDAP::Filter.equals('cn', groupname)
      member_filter = Net::LDAP::Filter.equals('member', "cn=#{username},#{account_tree}")
      entry = service.search(base: tree,
                             filter: group_filter & member_filter,
                             attributes: ['cn'])
      entry.count > 0
    end
504569
def group_membership_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/group_memberships/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
1371579
def _processMembers(self, node, contextTag):
        
        restrictionLevel = self._checkMemberName(node.name)
        if restrictionLevel:
            workTag = '{0}{1}# @{2}'.format(contextTag,
                                            linesep,
                                            restrictionLevel)
        else:
            workTag = contextTag
        return workTag
686529
final public function whereStringContains(string $memberExpression, $value)
    {
        return $this->where($memberExpression, ConditionOperator::STRING_CONTAINS, $value);
    }
838328
def part_of_scopes(root = nil)
      scope_ids = part_of
      scope_ids.select! { |id| id == root.id || !root.part_of.member?(id) } if root
      organization.scopes.where(id: scope_ids).sort { |s1, s2| part_of.index(s2.id) <=> part_of.index(s1.id) }
    end
830142
function (a, b) {
        var me = this,
            membersOfA = Object.keys(a);
        // a members comparison with b
        if (!membersOfA.every(function (member) {
            return me.like(a[member], b[member]);
        })) {
            return true;
        }
        // Difference on members count?
        return membersOfA.length  !== Object.keys(b).length;
    }
1102853
def in_group(self, group, dn=False):
        
        if dn:
            return group in self.groups()
        return group.check_member(self)
500366
@Override
    public boolean contains(IEntityGroup group, IGroupMember member) throws GroupsException {
        boolean found = false;
        Iterator itr = (member.isGroup()) ? findMemberGroups(group) : findEntitiesForGroup(group);
        while (itr.hasNext() && !found) {
            found = member.equals(itr.next());
        }
        return found;
    }
657992
private MembershipByUserGroupTypeWrapper findMembership(Session session, String id) throws Exception
   {
      IdComponents ids;
      try
      {
         ids = utils.splitId(id);
      }
      catch (IndexOutOfBoundsException e)
      {
         throw new ItemNotFoundException("Can not find membership by id=" + id, e);
      }

      Node groupNode = session.getNodeByUUID(ids.groupNodeId);
      Node refUserNode = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNode(ids.userName);
      Node refTypeNode =
         refUserNode.getNode(ids.type.equals(MembershipTypeHandler.ANY_MEMBERSHIP_TYPE)
            ? JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY : ids.type);

      String groupId = utils.getGroupIds(groupNode).groupId;

      MembershipImpl membership = new MembershipImpl();
      membership.setId(id);
      membership.setGroupId(groupId);
      membership.setMembershipType(ids.type);
      membership.setUserName(ids.userName);

      putInCache(membership);

      return new MembershipByUserGroupTypeWrapper(membership, refUserNode, refTypeNode);
   }
481267
@Override
    public Set<Entity> getGroupsForMember(String memberName) {
        Set<Entity> groups = new HashSet<Entity>();
        if (StringUtils.isNotEmpty(memberName)) {
            EntityIdentifier[] identifiers =
                    GroupService.searchForEntities(
                            memberName,
                            GroupService.SearchMethod.DISCRETE,
                            EntityEnum.PERSON.getClazz());
            for (EntityIdentifier entityIdentifier : identifiers) {
                if (entityIdentifier.getType().equals(EntityEnum.PERSON.getClazz())) {
                    IGroupMember groupMember = GroupService.getGroupMember(entityIdentifier);
                    if (memberName.equalsIgnoreCase(groupMember.getKey())) {
                        Iterator it = GroupService.findParentGroups(groupMember);
                        while (it.hasNext()) {
                            IEntityGroup g = (IEntityGroup) it.next();
                            Entity e =
                                    EntityFactory.createEntity(
                                            g, EntityEnum.getEntityEnum(g.getLeafType(), true));
                            groups.add(e);
                        }
                        return groups;
                    }
                }
            }
        }
        return groups;
    }
963136
function(members) {
              users = {};
              members.each(function(member) {
                if(member.id !== 'anonymous' && member.id !== 'undefined') {
                  if(settings.randomColor && member.info.color === undefined) {
                    member.info.color = settings.templates.color(member.id);
                  }
                  // sort list with admin first
                  html = (member.info.isAdmin)
                    ? settings.templates.userList(member.info) + html
                    : html + settings.templates.userList(member.info)
                  ;
                  users[ member.id ] = member.info;
                }
              });
              $module
                .data('users', users)
                .data('user', users[members.me.id] )
                .removeClass(className.loading)
              ;
              $userList
                .html(html)
              ;
              module.user.updateCount();
              $.proxy(settings.onJoin, $userList.children())();
            }