Public: Initializes the command.

 membership - the UserGroupMembership to be accepted.
 Executes the command. Broadcasts these events:

 - :ok when everything is valid.
 - :invalid if we couldn't proceed.

 Returns nothing.
343964
def call
      return broadcast(:invalid) unless membership
      return broadcast(:invalid) if membership.role.to_s != "requested"

      transaction do
        send_notification
        reject_membership
      end

      broadcast(:ok, @user_group)
    end
787681
def create_membership(organization_id, params)
      http.post(membership_endpoint(organization_id), body: params) do |response|
        response.parsed_body
      end
    end
438221
def member_create(self, params, member_id):
        
        member_config = params.get('rsParams', {})
        server_id = params.pop('server_id', None)
        version = params.pop('version', self._version)
        proc_params = {'replSet': self.repl_id}
        proc_params.update(params.get('procParams', {}))
        if self.enable_ipv6:
            enable_ipv6_single(proc_params)
        # Make sure that auth isn't set the first time we start the servers.
        proc_params = self._strip_auth(proc_params)

        # Don't pass in auth_key the first time we start the servers.
        server_id = self._servers.create(
            name='mongod',
            procParams=proc_params,
            sslParams=self.sslParams,
            version=version,
            server_id=server_id
        )
        member_config.update({"_id": member_id,
                              "host": self._servers.hostname(server_id)})
        return member_config
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
270108
def memberships(refresh = false)
      @memberships = nil if refresh
      @memberships ||= AccessGroupGroupMember.where(member_id: id).includes(:group).map{|v| v.group}.to_a.freeze
    end
469134
@Override
    public CommandGroup createCommandGroup(String groupId, List<? extends AbstractCommand> members) {
		return createCommandGroup(groupId, members.toArray(), false, null);
	}
187171
private void checkMembers(XMember<?>[] members) {
		for (int index = 0; index < members.length; index++) {
			final XMember<?> member = members[index];
			if (!member.getMember().getDeclaringClass()
					.isAssignableFrom(getTargetClass())) {
				throw new IllegalArgumentException("Member [" + member
						+ "] does not belong to the target class ["
						+ targetClass + "].");
			}
		}
	}
1356935
def cli(ctx, group_id, users=None):
    
    return ctx.gi.groups.update_membership(group_id, users=users)
933516
def call
      return broadcast(:invalid) if membership.blank?
      return broadcast(:invalid) if membership.role != "member"
      return broadcast(:invalid) if membership.user_group != user_group

      transaction do
        promote_membership
        send_notification
      end

      broadcast(:ok)
    end
1057082
@Override
    public CommandGroup createCommandGroup(String groupId, Object[] members) {
		return createCommandGroup(groupId, members, false, null);
	}
548461
def process_invite_event(event)
      return unless event['type'] == 'm.room.member'
      return unless event['content']['membership'] == 'invite'
      @users.process_invite self, event
      sender = @users[event['sender']]
      invitee = @users[event['state_key']]
      # Return early if the user is already in the room
      return if @state.member? invitee
      broadcast(:invited, sender, invitee)
    end
1349613
@Override
    public CommandGroup createCommandGroup(List<? extends Object> members) {
		return createCommandGroup(null, members.toArray(), false, null);
	}
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;
    }
1243834
public void setGroupMembers(List<String> membershipInfo) {
        for (String line : membershipInfo) {
            String[] fields = line.split("\\|");
            if (fields.length < 2) {
                continue;
            }
            Set<String> users = StringUtils.commaDelimitedListToSet(fields[1]);
            String groupName = fields[0];
            groups.putIfAbsent(groupName, null);

            boolean groupAdmin = (3 <= fields.length && "write".equalsIgnoreCase(fields[2])) ? true : false;
            if (groupAdmin) {
                groupAdmins.put(groupName, users);
            } else {
                groupMembers.put(groupName, users);
            }
        }
        logger.debug("groups: " + groups);
        logger.debug("admins: " + groupAdmins + ", members: " + groupMembers);
    }
1119936
def check_membership(self, groups):
        '''  '''
        if not groups or groups == ['']:
            return True
        if self.request.user.is_superuser:
            return True
        user_groups = self.request.user.groups.values_list("name", flat=True)
        return set(groups).intersection(set(user_groups))
618509
def update_membership_memberships(self, group_id, membership_id, moderator=None, workflow_state=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - group_id
        """ID"""
        path["group_id"] = group_id

        # REQUIRED - PATH - membership_id
        """ID"""
        path["membership_id"] = membership_id

        # OPTIONAL - workflow_state
        """Currently, the only allowed value is "accepted""""
        if workflow_state is not None:
            self._validate_enum(workflow_state, ["accepted"])
            data["workflow_state"] = workflow_state

        # OPTIONAL - moderator
        """no description"""
        if moderator is not None:
            data["moderator"] = moderator

        self.logger.debug("PUT /api/v1/groups/{group_id}/memberships/{membership_id} with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("PUT", "/api/v1/groups/{group_id}/memberships/{membership_id}".format(**path), data=data, params=params, single_item=True)
1295924
def add_member(self, username, permissions, api=None):
        
        api = api or self._API
        data = {
            'username': username,
            'permissions': permissions
        }

        response = api.post(
            url=self._URL['members'].format(id=self.id),
            data=data
        )
        data = response.json()
        return Member(api=api, **data)