Actually invite a given user
168201
def _invite(self, name, method, email, uuid, event, password=""):
        """"""

        props = {
            'uuid': std_uuid(),
            'status': 'Open',
            'name': name,
            'method': method,
            'email': email,
            'password': password,
            'timestamp': std_now()
        }
        enrollment = objectmodels['enrollment'](props)
        enrollment.save()

        self.log('Enrollment stored', lvl=debug)

        self._send_invitation(enrollment, event)

        packet = {
            'component': 'hfos.enrol.enrolmanager',
            'action': 'invite',
            'data': [True, email]
        }
        self.fireEvent(send(uuid, packet))
1017573
def accept_moderator_invite(self, subreddit):
        
        data = {'r': six.text_type(subreddit)}
        # Clear moderated subreddits and cache
        self.user._mod_subs = None  # pylint: disable=W0212
        self.evict(self.config['my_mod_subreddits'])
        return self.request_json(self.config['accept_mod_invite'], data=data)
607111
def _user(self, user, real_name):
        
        with self.lock:
            self.send('USER %s 0 * :%s' % (user, real_name))
            if self.readable():
                self._recv()
                self.stepback()
867939
def add_user(
        self,
        name, 
        **attrs
        ):
        """"""
        if self.user_exists(name):
            raise KubeConfError("user with the given name already exists.")

        users = self.get_users()
        
        # Add parameters.
        new_user = {'name': name, 'user':{}}
        attrs_ = new_user['user']
        attrs_.update(attrs)
        users.append(new_user)
228482
def allow_user(user):
    """"""
    def processor(action, argument):
        db.session.add(
            ActionUsers.allow(action, argument=argument, user_id=user.id)
        )
    return processor
878810
def run(self, invite_id, **kwargs):
        
        self.l = self.get_logger(**kwargs)
        self.l.info("Looking up the invite")
        invite = Invite.objects.get(id=invite_id)
        msg_payload = self.compile_msg_payload(invite)
        result = self.send_message(msg_payload)
        self.l.info("Creating task to update invite after send")
        post_send_update_invite.apply_async(args=[invite_id])
        self.l.info("Created task to update invite after send")
        return "Message queued for send. ID: <%s>" % str(result["id"])
96560
def _send_invitation(self, enrollment, event):
        """"""

        self.log('Sending enrollment status mail to user')

        self._send_mail(self.config.invitation_subject, self.config.invitation_mail, enrollment, event)
491991
def addUser(self, username, password,
                firstname, lastname,
                email, role):
        """"""
        self._invites.append({
            "username":username,
            "password":password,
            "firstname":firstname,
            "lastname":lastname,
            "fullname":"%s %s" % (firstname, lastname),
            "email":email,
            "role":role
        })
209832
def topoff_user(cls, user, amount):
        
        stat, _ = cls.objects.get_or_create(user=user)
        remaining = stat.invites_remaining()
        if remaining != -1 and remaining < amount:
            stat.invites_allocated += (amount - remaining)
            stat.save()
84846
function InvItem(type, hash) {
  if (!(this instanceof InvItem))
    return new InvItem(type, hash);

  this.type = type;
  this.hash = hash;
}
1175585
def add_user_invitation(self, **kwargs):
        """"""
        user_invitation = self.UserInvitationClass(**kwargs)
        self.db_adapter.add_object(user_invitation)
        return user_invitation
139985
def add_invites(cls, amount):
        
        for user in get_user_model().objects.all():
            cls.add_invites_to_user(user, amount)
1159522
function appendUser(socket, params) {
        try {
            var extra = params.extra;

            var params = socket.handshake.query;

            if (params.extra) {
                try {
                    if (typeof params.extra === 'string') {
                        params.extra = JSON.parse(params.extra);
                    }
                    extra = params.extra;
                } catch (e) {
                    extra = params.extra;
                }
            }

            listOfUsers[socket.userid] = {
                socket: socket,
                connectedWith: {},
                extra: extra || {},
                admininfo: {},
                socketMessageEvent: params.socketMessageEvent || '',
                socketCustomEvent: params.socketCustomEvent || ''
            };
        } catch (e) {
            pushLogs(config, 'appendUser', e);
        }

        sendToAdmin();
    }
333311
def project_invite(object_id, input_params={}, always_retry=False, **kwargs):
    
    return DXHTTPRequest('/%s/invite' % object_id, input_params, always_retry=always_retry, **kwargs)
596576
def invite_others_to_group(self, group_id, invitees):
        
        path = {}
        data = {}
        params = {}

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

        # REQUIRED - invitees
        """An array of email addresses to be sent invitations."""
        data["invitees"] = invitees

        self.logger.debug("POST /api/v1/groups/{group_id}/invite with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/groups/{group_id}/invite".format(**path), data=data, params=params, no_data=True)
1295466
def add_invites_to_user(cls, user, amount):
        
        stat, _ = InvitationStat.objects.get_or_create(user=user)
        if stat.invites_allocated != -1:
            stat.invites_allocated += amount
            stat.save()
347436
def invite(name, emails, perm):
    
    with Session() as session:
        try:
            assert perm in ['rw', 'ro'], \
                   'Invalid permission: {}'.format(perm)
            result = session.VFolder(name).invite(perm, emails)
            invited_ids = result.get('invited_ids', [])
            if len(invited_ids) > 0:
                print('Invitation sent to:')
                for invitee in invited_ids:
                    print('\t- ' + invitee)
            else:
                print('No users found. Invitation was not sent.')
        except Exception as e:
            print_error(e)
            sys.exit(1)