Gets the effective group membership of this user.
499299
def effective_groups(refresh = false)
      @effective_groups = nil if refresh
      @effective_groups ||= if system_admin?
                              AccessGroup.all.map{ |g| g.to_s.upcase }
                            else
                              groups
                                  .collect{ |g| g.effective_groups }
                                  .flatten
                            end
                                .map{ |g| g.to_s.upcase }
                                .uniq
                                .sort
    end
1351806
def get_memberships(self):
        

        response = self._get_xml(self.rest_url + "/group/membership")

        if not response.ok:
            return None

        xmltree = etree.fromstring(response.content)
        memberships = {}
        for mg in xmltree.findall('membership'):
            # coerce values to unicode in a python 2 and 3 compatible way
            group = u'{}'.format(mg.get('group'))
            users = [u'{}'.format(u.get('name')) for u in mg.find('users').findall('user')]
            groups = [u'{}'.format(g.get('name')) for g in mg.find('groups').findall('group')]
            memberships[group] = {u'users': users, u'groups': groups}
        return memberships
489037
private function get_effective_groupmode() {
        $groupmode = $this->groupmode;
        if ($this->modinfo->get_course()->groupmodeforce) {
            $groupmode = $this->modinfo->get_course()->groupmode;
            if ($groupmode != NOGROUPS && !plugin_supports('mod', $this->modname, FEATURE_GROUPS, false)) {
                $groupmode = NOGROUPS;
            }
        }
        return $groupmode;
    }
126077
def AddGroupMemberships(self):
    """"""
    self.groups = {g.name: self._Members(g) for g in itervalues(self.groups)}
    # Map the groups a user is a member of, irrespective of primary/extra gid.
    for g in itervalues(self.groups):
      for user in g.members:
        membership = self.memberships.setdefault(user, set())
        membership.add(g.gid)
    # Now add the completed membership to the user account.
    for user in itervalues(self.entry):
      user.gids = self.memberships.get(user.username)
1225283
public function getMemberInfo($limit = null, $offset = 0, $memberRoleFilter = null, $memberInfoFilter = null, $appDefinedDataFilter = null)
    {
        $request = new GetGroupMemberInfoRequest($this->groupId, $limit, $offset, $memberRoleFilter, $memberInfoFilter, $appDefinedDataFilter);
        $response = new GetGroupMemberInfoResponse();
        return $this->client->sendRequest($request, $response);
    }
1001636
def get_user_tenants(user, group):
    """"""
    if user.is_active and user.is_authenticated():
        if user.is_superuser or is_group_manager(user, group.pk):
            return Tenant.objects.filter(group=group)
        else:
            return Tenant.objects.filter(group=group, tenantrole__user=user).distinct()
    else:
        return Tenant.objects.none()
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;
   }
26934
private function Groups()
    {
        if ($this->groups === null)
        {
            $this->groups = array();
            if ($this->GetMember())
            {
                $this->groups = MembergroupUtil::MemberMembergroups($this->GetMember());
            }
        }
        return $this->groups;
    }
114100
def tm_group(self):
        '''
        '''
        if self._tm_group is None:
            self._tm_group = self.tm_user
        return self._tm_group
1139820
private MembershipImpl getFromCache(String userName, String groupId, String type)
   {
      return (MembershipImpl)cache.get(cache.getMembershipKey(userName, groupId, type), CacheType.MEMBERSHIP);
   }
387960
public function getMemberUsers() {

		$memberTable = CmnTables::getTableName( CmnTables::TABLE_GROUP_MEMBER );

		return $this->hasMany( User::class, [ 'id' => 'userId' ] )
			->viaTable( $memberTable, [ 'groupId' => 'id' ] );
	}
914292
@Override
    public IGroupMember getGroupMember(EntityIdentifier underlyingEntityIdentifier)
            throws GroupsException {
        return getGroupMember(
                underlyingEntityIdentifier.getKey(), underlyingEntityIdentifier.getType());
    }
420632
@SuppressWarnings("unchecked")
    @Override
	public <T extends ApiUser> List<T> getUsersInGroup(String groupId) {
	    Collection<User> sfsUsers = getZone().getUsersInGroup(groupId);
	    List<T> anwser = new ArrayList<>();
	    for(User sfsUser : sfsUsers)
	        if(sfsUser.containsProperty(APIKey.USER))
	            anwser.add((T) sfsUser.getProperty(APIKey.USER));
	    return anwser;
	}
246942
public ManagementVertex getGroupMember(final int index) {

		if (index < this.groupMembers.size()) {
			return this.groupMembers.get(index);
		}

		return null;
	}
1102853
def in_group(self, group, dn=False):
        
        if dn:
            return group in self.groups()
        return group.check_member(self)
737402
public function getGroup()
    {
        if (! $this->_group) {
            $this->_group = $this->userLoader->getGroup($this->getGroupId());
        }

        return $this->_group;
    }
654653
def membership_in(self, organization):
        """"""
        url = self._build_url('user', 'memberships', 'orgs',
                              str(organization))
        json = self._json(self._get(url), 200)
        return Membership(json, self)