async resetSecurity() {
    const mutex = new Mutex("resetSecurity", { timeout: 0 });

    if (!(await mutex.lock())) {
      throw kerror.get(
        "api",
        "process",
        "action_locked",
        "Kuzzle is already reseting roles, profiles and users.",
      );
    }

    const result = {};

    try {
      const options = { refresh: "wait_for" };

      result.deletedUsers = await this.ask(
        "core:security:user:truncate",
        options,
      );
      result.deletedProfiles = await this.ask(
        "core:security:profile:truncate",
        options,
      );
      result.deletedRoles = await this.ask(
        "core:security:role:truncate",
        options,
      );

      await global.kuzzle.internalIndex.createInitialSecurities();

      await this.ask(
        "core:cache:internal:del",
        `backend:init:import:permissions`,
      );
    } finally {
      await mutex.unlock();
    }

    return result;
  }
Reset all roles, profiles and users