async createOrReplaceProfile(request) {
    const id = request.getId();
    const content = request.getBody();
    const userId = request.getKuid();

    // Assert: must have a "policies" array
    request.getBodyArray("policies");

    const profile = await this.ask(
      "core:security:profile:createOrReplace",
      id,
      content,
      {
        refresh: request.getRefresh("wait_for"),
        strict: request.getBoolean("strict"),
        userId,
      },
    );

    global.kuzzle.log.info(
      `[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${
        request.input.action
      }" on profile "${profile._id}."`,
    );

    return formatProcessing.serializeProfile(profile);
  }
Create or replace a Profile

@param {Request} request
@returns {Promise<Object>}