Creates and returns a new user from the given parameters.
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
735635
def to_user(user):
        
        from sevenbridges.models.user import User
        if not user:
            raise SbgError('User is required!')
        elif isinstance(user, User):
            return user.username
        elif isinstance(user, six.string_types):
            return user
        else:
            raise SbgError('Invalid user parameter!')
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)
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)
891605
def user_create(name, password, email, tenant_id=None,
                enabled=True, profile=None, project_id=None, description=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)

    if _OS_IDENTITY_API_VERSION > 2:
        if tenant_id and not project_id:
            project_id = tenant_id
        item = kstone.users.create(name=name,
                                   password=password,
                                   email=email,
                                   project_id=project_id,
                                   enabled=enabled,
                                   description=description)
    else:
        item = kstone.users.create(name=name,
                                   password=password,
                                   email=email,
                                   tenant_id=tenant_id,
                                   enabled=enabled)
    return user_get(item.id, profile=profile, **connection_args)
1098763
def __generate_new_sandbox_user():
    

    url = ApiEnvironmentType.SANDBOX.uri_base + __ENDPOINT_SANDBOX_USER

    headers = {
        ApiClient.HEADER_REQUEST_ID: __UNIQUE_REQUEST_ID,
        ApiClient.HEADER_CACHE_CONTROL: ApiClient._CACHE_CONTROL_NONE,
        ApiClient.HEADER_GEOLOCATION: ApiClient._GEOLOCATION_ZERO,
        ApiClient.HEADER_LANGUAGE: ApiClient._LANGUAGE_EN_US,
        ApiClient.HEADER_REGION: ApiClient._REGION_NL_NL,
    }

    response = requests.request(ApiClient._METHOD_POST, url, headers=headers)

    if response.status_code is ApiClient._STATUS_CODE_OK:
        response_json = json.loads(response.text)
        return endpoint.SandboxUser.from_json(
            json.dumps(response_json[__FIELD_RESPONSE][__INDEX_FIRST][
                           __FIELD_API_KEY]))

    raise BunqException(_ERROR_COULD_NOT_CREATE_NEW_SANDBOX_USER)
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'
        });
      }
    }
1158018
def users_request_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/users/request_create.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
273086
def create_user(**data):
    """"""
    if 'username' not in data or 'password' not in data:
        raise ValueError('username and password are required.')

    # Hash the user password
    data['password'] = generate_password_hash(
        data.pop('password'),
        method='pbkdf2:sha256'
    )

    # Here you insert the `data` in your users database
    # for this simple example we are recording in a json file
    db_users = json.load(open('users.json'))
    # add the new created user to json
    db_users[data['username']] = data
    # commit changes to database
    json.dump(db_users, open('users.json', 'w'))
    return data
504115
def create_profile(self, user, save=False, **kwargs):
        
        profile = self.get_model()(user=user, **kwargs)

        if save:
            profile.save()

        return profile
438011
def create_user(self, instance, name, password, database_names, host=None):
        
        return instance.create_user(name=name, password=password,
                database_names=database_names, host=host)
149047
public Response createUser(UserEntity userEntity) {
		return restClient.post("users", userEntity, new HashMap<String, String>());
	}
685679
public function createTemporaryUser($parameters)
    {
        $email = trim(strtolower(array_value($parameters, 'email')));
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            throw new AuthException('Invalid email address');
        }

        $insertArray = array_replace($parameters, ['enabled' => false]);

        // create the temporary user
        $userClass = $this->auth->getUserClass();
        $user = new $userClass();
        $driver = $userClass::getDriver();
        $created = $driver->createModel($user, $insertArray);

        if (!$created) {
            throw new AuthException('Could not create temporary user');
        }

        // get the new user ID
        $id = [];
        foreach ($userClass::getIDProperties() as $k) {
            $id[] = $driver->getCreatedID($user, $k);
        }

        $user = $userClass::find($id);

        // create the temporary link
        $link = new UserLink();
        $link->user_id = $user->id();
        $link->type = UserLink::TEMPORARY;
        $link->saveOrFail();
        $user->setTemporaryLink($link);

        return $user;
    }
93561
def create(self, validated_data):
        
        if 'user' not in validated_data:
            validated_data['user'] = self.context['request'].user
        return super(RefreshTokenSerializer, self).create(validated_data)
229146
def new(cls,
            username,
            password=None,
            email=None,
            first_name="",
            last_name="",
            login_method=None,
            role="MEMBER"
            ):
        
        data = {
            "first_name": first_name,
            "last_name": last_name,
            "email": email
        }

        if not password:
            password = utils.generate_random_string()

        username = username.strip().lower()
        if "@" in username and not email:
            if not utils.is_email_valid(username):
                exceptions.AuthError(_("Invalid username"))
            data["email"] = username
        elif email:
            if not utils.is_email_valid(email):
                exceptions.AuthError(_("Invalid username"))

        if not utils.is_username_valid(username):
            exceptions.AuthError(_("Invalid username"))
        if not utils.is_password_valid(password):
            raise exceptions.AuthError(_("Password is invalid"))

        if cls.get_by_username(username):
            raise exceptions.AuthError(_("Username exists already"))
        _email = data.get("email")
        if _email:
            if cls.get_by_email(_email):
                raise exceptions.AuthError(_("Email address exists already"))

        role = AuthUserRole.get_by_name(role or "MEMBER")
        if not role:
            raise exceptions.AuthError(_("Invalid user role"))

        data.update({
            "username": username,
            "password_hash": cls.encrypt_password(password),
            "email_verified": False,
            "login_method": login_method,
            "role": role,
            "status": cls.STATUS_ACTIVE
        })
        user = cls.create(**data)
        user.reset_secret_key()
        return user
618641
def create_user(user_name, path=None, region=None, key=None, keyid=None,
                profile=None):
    '''
    
    '''
    if not path:
        path = '/'
    if get_user(user_name, region, key, keyid, profile):
        return True
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    try:
        conn.create_user(user_name, path)
        log.info('Created IAM user : %s.', user_name)
        return True
    except boto.exception.BotoServerError as e:
        log.debug(e)
        log.error('Failed to create IAM user %s.', user_name)
        return False
714988
public static function create($userId, $params = null, $options = null)
    {
        return self::_userBasedCreate($userId, $params, $options);
    }