Create a new user.
760181
def create_user(email, password, active, confirmed_at, send_email):
    
    if confirmed_at == 'now':
        confirmed_at = security.datetime_factory()
    user = user_manager.create(email=email, password=password, active=active,
                               confirmed_at=confirmed_at)
    if click.confirm(f'Are you sure you want to create {user!r}?'):
        security_service.register_user(user, allow_login=False, send_email=send_email)
        user_manager.save(user, commit=True)
        click.echo(f'Successfully created {user!r}')
    else:
        click.echo('Cancelled.')
19591
def create_user(self, username, password, name, email):
        """"""
        method = 'POST'
        endpoint = '/rest/v1/users/{}'.format(self.client.sauce_username)
        body = json.dumps({'username': username, 'password': password,
                           'name': name, 'email': email, })
        return self.client.request(method, endpoint, body)
575176
@Override
    public User createUser(User user) throws UnauthorizedException, NameConflictException {
        try {
            return userDao.createUser(user);
        } catch (DuplicateKeyException e) {
            throw new NameConflictException("User name is already in use", e);
        }
    }
962730
def create_user(self, **kwargs):
        """"""
        roles = kwargs.pop('roles', [])
        user = self.user_model(**self._prepare_create_user_args(**kwargs))
        user = self.put(user)
        for role in roles:
            self.add_role_to_user(user, role)
        self.put(user)
        return user
989096
def createuser(email, password, role=None, name=None, first_name=None):
    """"""

    if User.query.filter(User.email == email).count() > 0:
        print(f"A user with email '{email}' already exists, aborting.")
        return

    # if password is None:
    #     password = prompt_pass("Password")

    user = User(
        email=email,
        password=password,
        last_name=name,
        first_name=first_name,
        can_login=True,
    )
    db.session.add(user)

    if role in ("admin",):
        # FIXME: add other valid roles
        security = get_service("security")
        security.grant_role(user, role)

    db.session.commit()
    print(f"User {email} added")
859226
public function createUser()
    {
        /* @var User $user */
        $user = parent::createUser();

        $userStat = new UserStat();
        $user->setUserStat($userStat);
        return $user;
    }
1148542
def CreateUser(username, password=None, is_admin=False):
  """"""
  grr_api = maintenance_utils.InitGRRRootAPI()
  try:
    user_exists = grr_api.GrrUser(username).Get() is not None
  except api_errors.ResourceNotFoundError:
    user_exists = False
  if user_exists:
    raise UserAlreadyExistsError("User '%s' already exists." % username)
  user_type, password = _GetUserTypeAndPassword(
      username, password=password, is_admin=is_admin)
  grr_api.CreateGrrUser(
      username=username, user_type=user_type, password=password)
86049
def create_account(self, **params):
        """"""
        response = self._post('v2', 'accounts', data=params)
        return self._make_api_object(response, Account)
269091
def create(self, user: str, *,
               pwd: str, sgrp: str, comment: str=None) -> None:
        """"""
        data = {
            'action': 'add',
            'user': user,
            'pwd': pwd,
            'grp': 'users',
            'sgrp': sgrp
        }

        if comment:
            data['comment'] = comment

        self._request('post', URL, data=data)
771856
def create_superuser(
            self, username, email, short_name, full_name,
            institute, password, **extra_fields):
        
        return self._create_user(
            username=username, email=email,
            institute=institute, password=password,
            short_name=short_name, full_name=full_name,
            is_admin=True, **extra_fields)
1329003
def _maybe_init_user(self):
    """"""
    user_name = os.environ.get('USER', '') or os.environ.get('USERNAME', '')
    cursor = self._db.cursor()
    cursor.execute('SELECT user_id FROM Users WHERE user_name = ?',
                   (user_name,))
    row = cursor.fetchone()
    if row:
      return row[0]
    user_id = self._create_id()
    cursor.execute(
        """
        INSERT INTO USERS (user_id, user_name, inserted_time)
        VALUES (?, ?, ?)
        """,
        (user_id, user_name, time.time()))
    return user_id
998167
def create_user(self, username, password, roles):
    
    return users.create_user(self, username, password, roles)
694003
def create_user(self, user_name, path='/'):
        
        params = {'UserName' : user_name,
                  'Path' : path}
        return self.get_response('CreateUser', params)
1112401
def create_user(name,
                username,
                email,
                password,
                token_manager=None,
                app_url=defaults.APP_URL):
    
    headers = token_manager.get_access_token_headers()
    auth_url = environment.get_auth_url(app_url=app_url)
    url = "%s/api/v1/accounts" % auth_url

    payload = {
        'name': name,
        'username': username,
        'email': email,
        'password': password
    }

    response = requests.post(url,
                             data=json.dumps(payload),
                             headers=headers)

    if response.status_code == 201:
        return response.json()

    else:
        raise JutException('Error %s: %s' % (response.status_code, response.text))
817344
def user(username, password, all):
    """"""
    if current_app.config['AUTH_PROVIDER'] != 'basic':
        raise click.UsageError('Not required for {} admin users'.format(current_app.config['AUTH_PROVIDER']))
    if username and username not in current_app.config['ADMIN_USERS']:
        raise click.UsageError('User {} not an admin'.format(username))
    if not username and not all:
        raise click.UsageError('Missing option "--username".')

    def create_user(admin):
        email = admin if '@' in admin else None
        user = User(
            name='Admin user',
            login=admin,
            password=generate_password_hash(password),
            roles=['admin'],
            text='Created by alertad script',
            email=email,
            email_verified=bool(email)
        )
        try:
            db.get_db()  # init db on global app context
            user = user.create()
        except Exception as e:
            click.echo('ERROR: {}'.format(e))
        else:
            click.echo('{} {}'.format(user.id, user.name))

    if all:
        for admin in current_app.config['ADMIN_USERS']:
            create_user(admin)
    else:
        create_user(username)
1111273
def create_user(self, username, password, family_name, given_name, primary_email,
            details={}):
        
        self.assert_has_permission('scim.write')

        data = {
            'userName': username,
            'password': password,
            'name': {
                'familyName': family_name,
                'givenName': given_name,
                },
            'emails': [{
                'value': primary_email,
                'primary': True,
                }]
            }

        if details:
            data.update(details)

        return self._post_user(data)
1374929
public function createUser()
    {
        $data['name']     = $this->ask('Administrator name');
        $data['email']    = $this->ask('Administrator email');
        $data['password'] = bcrypt($this->secret('Administrator password'));
        $data['role_id']  = 1;
        User::create($data);
        $this->info('User has been created');
    }