Adds someone to a group

        :param group_jid: The JID of the group into which to add a user
        :param peer_jid: The JID of the user to add
557181
def add_peer_to_group(self, group_jid, peer_jid):
        
        log.info("[+] Requesting to add user {} into the group {}".format(peer_jid, group_jid))
        return self._send_xmpp_element(group_adminship.AddToGroupRequest(group_jid, peer_jid))
218606
def sync_to_peers(peer_interface, user, paths=None, verbose=False, cmd=None,
                  gid=None, fatal=False):
    
    if paths:
        for host in collect_authed_hosts(peer_interface):
            sync_to_peer(host, user, paths, verbose, cmd, gid, fatal)
922860
def add_user_to_group(self, username, group_name):
        
        url = 'rest/api/2/group/user'
        params = {'groupname': group_name}
        data = {'name': username}

        return self.post(url, params=params, data=data)
109545
private synchronized boolean addPeer(final PeerInfo peer) {

		final String uuid = peer.getUuid();

		if (!peers.containsKey(uuid)) {

			peers.put(uuid, peer);

			peer.setLastSeen(System.currentTimeMillis());
			onAddPeer(peer);

			return true;
		}

		// not added
		return false;
	}
932990
def add(name, gid=None, **kwargs):
    '''
    
    '''
    ### NOTE: **kwargs isn't used here but needs to be included in this
    ### function for compatibility with the group.present state
    if info(name):
        raise CommandExecutionError(
            'Group \'{0}\' already exists'.format(name)
        )
    if salt.utils.stringutils.contains_whitespace(name):
        raise SaltInvocationError('Group name cannot contain whitespace')
    if name.startswith('_'):
        raise SaltInvocationError(
            'Salt will not create groups beginning with underscores'
        )
    if gid is not None and not isinstance(gid, int):
        raise SaltInvocationError('gid must be an integer')
    # check if gid is already in use
    gid_list = _list_gids()
    if six.text_type(gid) in gid_list:
        raise CommandExecutionError(
            'gid \'{0}\' already exists'.format(gid)
        )

    cmd = ['dseditgroup', '-o', 'create']
    if gid:
        cmd.extend(['-i', gid])
    cmd.append(name)
    return __salt__['cmd.retcode'](cmd, python_shell=False) == 0
574983
def add_group(self, L):
        
        if len(L) == 1:
            self.add(L[0])
        elif len(L) >= 2:
            x = PQ_node(P_shape)
            x.add_all(L)
            self.add(x)
152858
def add(name, gid=None, **kwargs):
    '''
    
    '''
    kwargs = salt.utils.args.clean_kwargs(**kwargs)
    if salt.utils.data.is_true(kwargs.pop('system', False)):
        log.warning('pw_group module does not support the \'system\' argument')
    if kwargs:
        log.warning('Invalid kwargs passed to group.add')

    cmd = 'pw groupadd '
    if gid:
        cmd += '-g {0} '.format(gid)
    cmd = '{0} -n {1}'.format(cmd, name)
    ret = __salt__['cmd.run_all'](cmd, python_shell=False)

    return not ret['retcode']
1304669
def add_group(self, groupname):
        
        url = self._options['server'] + '/rest/api/latest/group'

        # implementation based on
        # https://docs.atlassian.com/jira/REST/ondemand/#d2e5173

        x = OrderedDict()

        x['name'] = groupname

        payload = json.dumps(x)

        self._session.post(url, data=payload)

        return True
421216
def user_add_to_group_action(model, request):
    
    group_id = request.params.get('id')
    if not group_id:
        group_ids = request.params.getall('id[]')
    else:
        group_ids = [group_id]
    try:
        user = model.model
        validate_add_users_to_groups(model, [user.id], group_ids)
        groups = user.root.groups
        for group_id in group_ids:
            groups[group_id].add(user.name)
        groups()
        model.parent.invalidate(user.name)
        localizer = get_localizer(request)
        message = localizer.translate(_(
            'added_user_to_group',
            default="Added user '${uid}' to group '${gid}'.",
            mapping={
                'uid': user.id,
                'gid': ', '.join(group_ids)
            }
        ))
        return {
            'success': True,
            'message': message
        }
    except ManageMembershipError as e:
        if e.reason is not LM_TARGET_GID_NOT_ALLOWED:
            raise Exception(u"Unknown ManageMembershipError reason.")
        localizer = get_localizer(request)
        message = localizer.translate(_(
            'lm_add_target_gid_not_allowed',
            default=(
                "Failed adding user '${uid}' to group '${gid}'. "
                "Manage membership denied for target group."
            ),
            mapping={
                'uid': user.id,
                'gid': e.data
            }
        ))
        return {
            'success': False,
            'message': message
        }
    except Exception as e:
        return {
            'success': False,
            'message': str(e)
        }
787438
def add_new_peers( self, count, new_peers, current_peers, con=None, path=None, peer_table=None ):
        

        if self.ping_timeout is None:
            self.ping_timeout = atlas_ping_timeout()
 
        if path is None:
            path = self.atlasdb_path

        # only handle a few peers for now
        cnt = 0
        i = 0
        added = []
        present = []
        filtered = []
        while i < len(new_peers) and cnt < min(count, len(new_peers)):
            peer = self.canonical_peer( new_peers[i] )
            i += 1

            if peer == self.my_hostport:
                filtered.append(peer)
                continue

            if peer in current_peers:
                log.debug("%s is already known" % peer)
                present.append(peer)
                continue 

            cnt += 1

            # test the peer before adding
            res = atlas_peer_getinfo( peer, timeout=self.ping_timeout, peer_table=peer_table )
            if res is None:
                # didn't respond successfully
                filtered.append(peer)
                continue

            if not res.has_key('server_version'):
                # too old.  TODO: ban them
                filtered.append(peer)
                continue

            if (BLOCKSTACK_PUBLIC_TESTNET and res['server_version'] != MIN_ATLAS_VERSION) or (not BLOCKSTACK_PUBLIC_TESTNET and semver_newer(res['server_version'], MIN_ATLAS_VERSION)):
                # mainnet: too old to be a valid atlas node for this network version
                # testnet: not the same version == don't connect
                filtered.append(peer)
                log.debug("%s is too old to be an atlas node (version %s)" % (peer, res['server_version']))

                # TODO: ban them
                continue
            
            # advance our consensus hashes
            our_last_block = get_last_block(self.working_dir)
            if not self.consensus_hashes.has_key(our_last_block):
                cur_last_block = max(self.consensus_hashes.keys())
                new_consensus_hashes = get_snapshots(self.working_dir, start_block=cur_last_block, end_block=our_last_block+1)
                self.consensus_hashes.update(new_consensus_hashes)

            if self.consensus_hashes.has_key(our_last_block):

                their_last_block = res['last_block_processed']
                if their_last_block <= our_last_block and res['consensus'] not in self.consensus_hashes.values():
                    # on different consensus rules than us
                    log.debug("Peer {} has ({},{}), but we have ({},{}). Ignoring.".format(peer, their_last_block, res['consensus'], our_last_block, self.consensus_hashes[our_last_block]))

                    # TODO: drop them from the peer table, and don't reconnect with them for a while.
                    continue

            if res:
                log.debug("Add newly-discovered peer %s" % peer)
                atlasdb_add_peer( peer, con=con, path=path, peer_table=peer_table )
                added.append(peer)
            else:
                filtered.append(peer)

        return added, present, filtered
55278
def insertPeer(self, peer):
        
        try:
            models.Peer.create(
                url=peer.getUrl(),
                attributes=json.dumps(peer.getAttributes()))
        except Exception as e:
            raise exceptions.RepoManagerException(e)
1048228
def add_member(self, user):
        
        user = Transform.to_user(user)
        data = {
            'id': user
        }
        extra = {
            'resource': self.__class__.__name__,
            'query': {
                'id': self.id,
                'data': data,
            }
        }
        logger.info('Adding team member using id', extra=extra)
        response = self._api.post(
            url=self._URL['members_query'].format(id=self.id), data=data)
        member_data = response.json()
        return TeamMember(api=self._api, **member_data)
121002
def send_is_typing(self, peer_jid: str, is_typing: bool):
        
        if self.is_group_jid(peer_jid):
            return self._send_xmpp_element(chatting.OutgoingGroupIsTypingEvent(peer_jid, is_typing))
        else:
            return self._send_xmpp_element(chatting.OutgoingIsTypingEvent(peer_jid, is_typing))
1232257
def add_resourcegroup(group, network_id,**kwargs):
    
    group_i                   = ResourceGroup()
    group_i.name              = group.name
    group_i.description       = group.description
    group_i.status            = group.status
    group_i.network_id        = network_id
    db.DBSession.add(group_i)
    db.DBSession.flush()
    return group_i
162230
def ban_member_from_group(self, group_jid, peer_jid):
        
        log.info("[+] Requesting ban of user {} from group {}".format(peer_jid, group_jid))
        return self._send_xmpp_element(group_adminship.BanMemberRequest(group_jid, peer_jid))
646593
def add_user_to_group(self, user, group_name):
        
        group, _ = Group.objects.get_or_create(name = group_name)
        group.user_set.add(user)
1220398
def member_add(self, member_id=None, params=None):
        """"""
        member_id = member_id or str(uuid4())
        if self.enable_ipv6:
            common.enable_ipv6_repl(params)
        if 'members' in params:
            # is replica set
            for member in params['members']:
                if not member.get('rsParams', {}).get('arbiterOnly', False):
                    member.setdefault('procParams', {})['shardsvr'] = True
            rs_params = params.copy()
            # Turn 'rs_id' -> 'id', to be consistent with 'server_id' below.
            rs_params['id'] = rs_params.pop('rs_id', None)
            rs_params.update({'sslParams': self.sslParams})

            rs_params['version'] = params.pop('version', self._version)
            rs_params['members'] = [
                self._strip_auth(params) for params in rs_params['members']]
            rs_id = ReplicaSets().create(rs_params)
            members = ReplicaSets().members(rs_id)
            cfgs = rs_id + r"/" + ','.join([item['host'] for item in members])
            result = self._add(cfgs, member_id)
            if result.get('ok', 0) == 1:
                self._shards[result['shardAdded']] = {'isReplicaSet': True, '_id': rs_id}
                # return self._shards[result['shardAdded']].copy()
                return self.member_info(member_id)

        else:
            # is single server
            params.setdefault('procParams', {})['shardsvr'] = True
            params.update({'autostart': True, 'sslParams': self.sslParams})
            params = params.copy()
            params['procParams'] = self._strip_auth(
                params.get('procParams', {}))
            params.setdefault('version', self._version)
            logger.debug("servers create params: {params}".format(**locals()))
            server_id = Servers().create('mongod', **params)
            result = self._add(Servers().hostname(server_id), member_id)
            if result.get('ok', 0) == 1:
                self._shards[result['shardAdded']] = {'isServer': True, '_id': server_id}
                return self.member_info(member_id)