Add users to 'banned', 'contributor', or 'moderator'.
495248
def add_users(self, category):
        """"""
        mapping = {'banned': 'ban', 'contributor': 'make_contributor',
                   'moderator': 'make_moderator'}

        if category not in mapping:
            print('{!r} is not a valid option for --add'.format(category))
            return
        func = getattr(self.sub, mapping[category])
        print('Enter user names (any separation should suffice):')
        data = sys.stdin.read().strip()
        for name in re.split('[^A-Za-z0-9_]+', data):
            func(name)
            print('Added {!r} to {}'.format(name, category))
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()
443464
def add_contributor(self, project_id, name, email, language_code):
        
        self._run(
            url_path="contributors/add",
            id=project_id,
            name=name,
            email=email,
            language=language_code
        )
        return True
164080
protected function submitAddUser()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->setSubmittedJson('data');

        $this->validateComponent('user');
        $this->addUser();
    }
245803
def do_invite(self, sender, body, args):
        """"""
        for invitee in args:
            new_member = { 'JID': invitee }
            self.invite_user(new_member, inviter=sender)
1175585
def add_user_invitation(self, **kwargs):
        """"""
        user_invitation = self.UserInvitationClass(**kwargs)
        self.db_adapter.add_object(user_invitation)
        return user_invitation
1151699
def chain_user_names(users, exclude_user, truncate=35):
    """"""
    if not users or not isinstance(exclude_user, get_user_model()):
        return ''
    return truncatechars(
        ', '.join(u'{}'.format(u) for u in users.exclude(pk=exclude_user.pk)),
        truncate)
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)
216115
def update_membership_users(self, user_id, group_id, moderator=None, workflow_state=None):
        
        path = {}
        data = {}
        params = {}

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

        # REQUIRED - PATH - user_id
        """ID"""
        path["user_id"] = user_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}/users/{user_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}/users/{user_id}".format(**path), data=data, params=params, single_item=True)
1371824
def add_user(self, username, password):
        """"""
        self.server.user_dict[username] = password
        self.server.isAuth = True
533985
def add_role(*_, role_handle=None, user_id=None):
    
    click.echo(green('\nAdding role to user:'))
    click.echo(green('-' * 40))
    with get_app().app_context():
        user = find_user(dict(id=user_id))
        if not user:
            click.echo(red('User not found\n'))
            return

        role = role_service.first(handle=role_handle)
        if not role:
            click.echo(red('No such role ({})\n'.format(role_handle)))
            return

        user_service.add_role_to_user(user, role)
        msg = 'Added role "{}" to user "{}"'.format(role.handle, user.email)
        click.echo(green(msg))
        return
541619
def add_user(self, nick, prefixes=None):
        """"""
        if nick not in self._user_nicks:
            self._user_nicks.append(nick)

        self.prefixes[nick] = prefixes
325481
def ban_user(self, room_id, user_id, reason=""):
        
        body = {
            "user_id": user_id,
            "reason": reason
        }
        return self._send("POST", "/rooms/" + room_id + "/ban", body)
795487
def invite_other_parties(self, possible_owners):
        
        signals.lane_user_change.send(sender=self.user,
                                      current=self,
                                      old_lane=self.old_lane,
                                      possible_owners=possible_owners
                                      )
244896
def add_janitor(self, janitor):
        """"""

        if not self.owner and not self.admin:
            raise RuntimeError("Not enough street creed to do this")

        janitor = janitor.strip().lower()
        if not janitor:
            raise ValueError("Empty strings cannot be janitors")

        if janitor in self.config.janitors:
            return

        self.config.janitors.append(janitor)
        self.__set_config_value("janitors", self.config.janitors)
763901
def upsert_users_from_legacy_publication_trigger(plpy, td):
    """"""
    modified_state = "OK"
    authors = td['new']['authors'] and td['new']['authors'] or []
    maintainers = td['new']['maintainers'] and td['new']['maintainers'] or []
    licensors = td['new']['licensors'] and td['new']['licensors'] or []
    is_legacy_publication = td['new']['version'] is not None

    if not is_legacy_publication:
        return modified_state

    # Upsert all roles into the users table.
    users = []
    users.extend(authors)
    users.extend(maintainers)
    users.extend(licensors)
    users = list(set(users))

    plan = plpy.prepare("""\
SELECT username FROM users WHERE username = any($1)""",
                        ['text[]'])
    existing_users = set([r['username'] for r in plpy.execute(plan, (users,))])

    new_users = set(users).difference(existing_users)
    for username in new_users:
        plan = plpy.prepare("""\
INSERT INTO users (username, first_name, last_name, full_name, title)
SELECT personid, firstname, surname, fullname, honorific
FROM persons where personid = $1""", ['text'])
        plpy.execute(plan, (username,))

    return modified_state
1237219
def alter_database_admin(self, username, is_admin):
        """"""
        url = "db/{0}/users/{1}".format(self._database, username)

        data = {'admin': is_admin}

        self.request(
            url=url,
            method='POST',
            data=data,
            expected_response_code=200
        )

        return True