membership //////////////////////////////////////////////////////
342118
public IdentityOperationResult createMembership(String userId, String groupId) {
    checkAuthorization(Permissions.CREATE, Resources.GROUP_MEMBERSHIP, groupId);
    UserEntity user = findUserById(userId);
    GroupEntity group = findGroupById(groupId);
    MembershipEntity membership = new MembershipEntity();
    membership.setUser(user);
    membership.setGroup(group);
    getDbEntityManager().insert(membership);
    createDefaultMembershipAuthorizations(userId, groupId);
    return new IdentityOperationResult(null, IdentityOperationResult.OPERATION_CREATE);
  }
765487
def _create_membership(self, pipeline=None):
        
        Set(self._key['all'], pipeline=pipeline).add(self.id)
786204
def add_membership(self, member, role=github.GithubObject.NotSet):
        
        assert isinstance(member, github.NamedUser.NamedUser), member
        assert role is github.GithubObject.NotSet or isinstance(
            role, (str, unicode)), role
        if role is not github.GithubObject.NotSet:
            assert role in ['member', 'maintainer']
            put_parameters = {
                "role": role,
            }
        else:
            put_parameters = {
                "role": "member",
            }
        headers, data = self._requester.requestJsonAndCheck(
            "PUT",
            self.url + "/memberships/" + member._identity,
            input=put_parameters
        )
79998
def organization_membership_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/organization_memberships/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
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;
   }
350689
private void postDelete(Membership membership) throws Exception
   {
      for (MembershipEventListener listener : listeners)
      {
         listener.postDelete(membership);
      }
   }
736028
protected synchronized Member getExecutionMember() {
        Iterator<Member> it = memberIterator;
        if (it == null || !it.hasNext()) {
            memberIterator = it = serviceMembers.iterator();
        }
        return it.next();
    }
1198055
function(user) {
      if (!this._shouldAllowUser(user)) {
        return false;
      }
      user.leaveRoom();
      this.members.push(user);
      user.room = this;
      if (this.minRoomMembers !== null &&
          this.members.length >= this.minRoomMembers) {
        this._hasReachedMin = true;
      }
      this._emitEvent('newMember', this, user);
      this._serverMessageMembers(this.isLobby ? 'lobbyMemberJoined' : 'roomMemberJoined', _.pick(user, 'id', 'name'));
      user._serverMessage('joinedRoom', _.pick(this, 'name'));
      return true;
    }
324239
public boolean addMember(long commitIndex, CPMemberInfo member) {
        checkNotNull(member);
        checkMetadataGroupInitSuccessful();

        for (CPMemberInfo existingMember : activeMembers) {
            if (existingMember.getAddress().equals(member.getAddress())) {
                if (existingMember.getUuid().equals(member.getUuid())) {
                    if (logger.isFineEnabled()) {
                        logger.fine(member + " already exists.");
                    }

                    if (membershipChangeSchedule != null && member.equals(membershipChangeSchedule.getAddedMember())) {
                        membershipChangeSchedule = membershipChangeSchedule.addRetriedCommitIndex(commitIndex);
                        logger.info("CP groups are already being rebalanced for " + member);
                        return false;
                    }

                    return true;
                }

                throw new IllegalStateException(member + " cannot be added to the CP subsystem because another " + existingMember
                        + " exists with the same address!");
            }
        }

        checkState(membershipChangeSchedule == null,
                "Cannot rebalance CP groups because there is ongoing " + membershipChangeSchedule);

        Collection<CPMemberInfo> newMembers = new LinkedHashSet<>(activeMembers);
        newMembers.add(member);
        doSetActiveMembers(commitIndex, newMembers);
        logger.info("Added new " + member + ". New active CP members list: " + newMembers);

        List<CPGroupMembershipChange> changes = getGroupMembershipChangesForNewMember(member);
        if (changes.size() > 0) {
            membershipChangeSchedule = MembershipChangeSchedule.forJoiningMember(singletonList(commitIndex), member, changes);
            if (logger.isFineEnabled()) {
                logger.fine("CP group rebalancing is triggered for " + member + ", changes: " + membershipChangeSchedule);
            }

            return false;
        }

        return true;
    }
141848
function getMembers(index) {
  if (this._members === undefined) {
    this._members = _(getValue(this, 'member') || getValue(this, 'memberOf'))
      .split(/,\s*/)
      .compact()
      .sort(util.compareNatural)
      .value();
  }
  var result = this._members;
  return index === undefined ? result : result[index];
}
32182
void addMember(AsteriskQueueMemberImpl member)
    {
        synchronized (members)
        {
            // Check if member already exists
            if (members.containsValue(member))
            {
                return;
            }
            // If not, add the new member.
            logger.info("Adding new member to the queue " + getName() + ": " + member.toString());
            members.put(member.getLocation(), member);
        }

        fireMemberAdded(member);
    }
787681
def create_membership(organization_id, params)
      http.post(membership_endpoint(organization_id), body: params) do |response|
        response.parsed_body
      end
    end
663927
def organization_memberships(self, user):
        
        return self._query_zendesk(self.endpoint.organization_memberships, 'organization_membership', id=user)
952194
public void addMembership(Membership membership) throws RedmineException {
		final Project project = membership.getProject();
		if (project == null)
			throw new IllegalArgumentException("Project must be set");
		if (membership.getUser() == null)
			throw new IllegalArgumentException("User must be set");
		transport.addChildEntry(Project.class, getProjectKey(project),
				membership);
	}
561372
@Override
    public double membership(double x) {
        if (Double.isNaN(x)) {
            return Double.NaN;
        }
        return height * 1.0 / (1.0 + Math.exp(-slope * (x - inflection)));
    }
1285821
function sismember(key, member, req) {
  var val = this.getKey(key, req);
  if(val === undefined) return 0;
  return val.sismember(member);
}
780631
def has_membership(self, user, role):
        
        targetRecord = AuthMembership.objects(creator=self.client, user=user).first()
        if targetRecord:
            return role in [i.role for i in targetRecord.groups]
        return False