Create a new user.
198127
def createuser(ctx, email, password, superuser, no_password, prompt):
    ''

    if prompt:
        if not email:
            email = click.prompt('Email')

        if not (password or no_password):
            password = click.prompt('Password')

        if superuser is None:
            superuser = click.confirm('Should this user be a superuser?', default=False)

    if superuser is None:
        superuser = False

    if not email:
        raise click.ClickException('Invalid or missing email address.')

    if not no_password and not password:
        raise click.ClickException('No password set and --no-password not passed.')

    import django
    django.setup()

    from bitcaster.models import User

    user = User.objects.filter(email=email).first()

    if user:
        if prompt:
            change = click.confirm(f'User {email} already exists. Proceed updating it?', default=False)
            if not change:
                ctx.exit()
            user.set_password(password)
            if superuser:
                user.is_superuser = superuser

            op = 'updated'
        else:
            click.echo('Nothing to do. User exists', err=True, color='red')
            sys.exit(1)
    else:
        op = 'created'
        user = User(
            email=email,
            is_superuser=superuser,
            is_staff=superuser,
            is_active=True,
        )
        if password:
            user.set_password(password)

    try:
        user.save()
    except Exception as e:
        raise click.ClickException(e)

    click.echo(f'User {email} {op}')
31800
def create_user(name, email, datum = nil)
      current_path = '/api/v1/users'
      payload = { name: name, mail: email }
      payload.merge!(datum) unless datum.nil?
      @conn.post(current_path, payload.to_json)
    end
998167
def create_user(self, username, password, roles):
    
    return users.create_user(self, username, password, roles)
702632
def create_user(self, login=None, password=None, user_name=None, envs=[], query='/users/'):
        
        login = login.lower()

        data = {'login': login,
                'password': password[0],
                'name': user_name}

        juicer.utils.Log.log_debug("Create User: %s ('%s')", login, user_name)

        for env in envs:
            if envs.index(env) != 0 and juicer.utils.env_same_host(env, envs[envs.index(env) - 1]):
                juicer.utils.Log.log_info("environment `%s` shares a host with environment `%s`... skipping!",
                                          (env, envs[envs.index(env) - 1]))
                continue
            elif juicer.utils.user_exists_p(login, self.connectors[env]):
                juicer.utils.Log.log_info("user `%s` already exists in %s... skipping!",
                                          (login, env))
                continue
            else:
                _r = self.connectors[env].post(query, data)
                if _r.status_code == Constants.PULP_POST_CREATED:
                    juicer.utils.Log.log_info("created user `%s` with login `%s` in %s",
                                              (user_name, login, env))
                else:
                    _r.raise_for_status()
        return True
382235
def add_user(self, name: str, email: str) -> models.User:
        """"""
        new_user = self.User(name=name, email=email)
        self.add_commit(new_user)
        return new_user
180957
def create_user(self, user):
        
        self.run("useradd -m %s" % user)
        usr =  getpwnam(user)
        return usr
492418
def create(self, name):
        """"""
        with contextlib.closing(self.database.cursor()) as cursor:
            cursor.execute('INSERT INTO users(name) VALUES (?)', (name,))
            return cursor.lastrowid
448649
function createUser(form) {
      // refuse to work with invalid data
      if (vm.user._id || (form && !form.$valid)) {
        return;
      }

      Auth.createUser(vm.user)
        .then(createUserSuccess)
        .catch(createUserCatch);

      function createUserSuccess(newUser) {
        Toast.show({
          type: 'success',
          text: 'User ' + newUser.name + ' has been created',
          link: {state: 'admin.user.list.detail', params: {id: newUser._id}}
        });
        vm.close();
      }

      function createUserCatch(err) {
        if (form && err) {
          form.setResponseErrors(err);
        }

        Toast.show({
          type: 'warn',
          text: 'Error while creating a new user'
        });
      }
    }
537688
async def create(cls, user_id: Union[int, str],
                     is_active: bool = True,
                     is_admin: bool = False,
                     resource_policy: str = None,
                     rate_limit: int = None,
                     fields: Iterable[str] = None) -> dict:
        '''
        
        '''
        if fields is None:
            fields = ('access_key', 'secret_key')
        uid_type = 'Int!' if isinstance(user_id, int) else 'String!'
        q = 'mutation($user_id: {0}, $input: KeyPairInput!) {{'.format(uid_type) + \
            '  create_keypair(user_id: $user_id, props: $input) {' \
            '    ok msg keypair { $fields }' \
            '  }' \
            '}'
        q = q.replace('$fields', ' '.join(fields))
        variables = {
            'user_id': user_id,
            'input': {
                'is_active': is_active,
                'is_admin': is_admin,
                'resource_policy': resource_policy,
                'rate_limit': rate_limit,
            },
        }
        rqst = Request(cls.session, 'POST', '/admin/graphql')
        rqst.set_json({
            'query': q,
            'variables': variables,
        })
        async with rqst.fetch() as resp:
            data = await resp.json()
            return data['create_keypair']
428586
def im_create(self, username, **kwargs):
        """"""
        return self.__call_api_post('im.create', username=username, kwargs=kwargs)
1329944
def create_user(server_context, email, container_path=None, send_email=False):
    
    url = server_context.build_url(security_controller, 'createNewUser.api', container_path)
    payload = {
        'email': email,
        'sendEmail': send_email
    }

    return server_context.make_request(url, payload)
583939
def create_admin(ctx):
    """"""

    try:
        admin = _create_user(ctx)
        admin.roles.append('admin')

        admin.save()
        log("Done")
    except KeyError:
        log('User already exists', lvl=warn)
74627
def user(context, name, email):
    """"""
    existing_user = context.obj['store'].user(email)
    if existing_user:
        click.echo(existing_user.to_dict())
    elif name:
        new_user = context.obj['store'].add_user(name, email)
        click.echo(click.style(f"New user added: {email} ({new_user.id})", fg='green'))
    else:
        click.echo(click.style('User not found', fg='yellow'))
1010675
def run(self):
        
        from zengine.models import User
        user = User(username=self.manager.args.username, superuser=self.manager.args.super)
        user.set_password(self.manager.args.password)
        user.save()
        print("New user created with ID: %s" % user.key)
723673
def create_user(self, username, first_name=None, last_name=None):
		
		
		url = api_url+'users/'
		payload = {
			'username':username
		}
		if first_name:
			payload['first_name'] = first_name
		if last_name:
			payload['last_name'] = last_name
		r = requests.post(url, data=json.dumps(payload), headers=self.headers)
		print(request_status(r))
		r.raise_for_status()
		return User(r.json())
31709
def create_inactive_user(self, form):
        """"""
        new_user = form.save(commit=False)
        new_user.is_active = False
        new_user.save()
        return new_user
859226
public function createUser()
    {
        /* @var User $user */
        $user = parent::createUser();

        $userStat = new UserStat();
        $user->setUserStat($userStat);
        return $user;
    }