<commit_before>package app.services.ldap

import scala.collection.mutable

import com.typesafe.config.ConfigFactory
import com.unboundid.ldap.sdk._

import utils.types.UserId

trait LDAPConnectionProvider {

  private val configuration = ConfigFactory.load
  private val host = configuration.getString("ldap.host")
  private val port = configuration.getInt("ldap.port")
  private val ldaps = configuration.getBoolean("ldap.ldaps")
  private val bindDN = configuration.getString("ldap.bindDN")
  private val password = configuration.getString("ldap.password")
  private val initialConnextions = configuration.getInt("ldap.initialConnextions")
  private val maxConnections = configuration.getInt("ldap.maxConnections")
  protected val baseDN = configuration.getString("ldap.baseDN")
  protected val uidAttributeName = configuration.getString("ldap.uidAttributeName")

  private def getConnectionOptions: LDAPConnectionOptions = {
    val connectionOption = new LDAPConnectionOptions
    connectionOption.setConnectTimeoutMillis(configuration.getInt("ldap.connectTimeout"))
    connectionOption.setResponseTimeoutMillis(configuration.getInt("ldap.responseTimeout"))
    connectionOption.setAbandonOnTimeout(configuration.getBoolean("ldap.abandonOnTimeOut"))
    connectionOption
  }

  case class UserConnection(
    dn: String,
    connection: LDAPConnection
  //TODO: Add user's role.<commit_msg>Little fix<commit_after>package app.services.ldap

import scala.collection.mutable

import com.typesafe.config.ConfigFactory
import com.unboundid.ldap.sdk._

import utils.types.UserId

trait LDAPConnectionProvider {

  private val configuration = ConfigFactory.load
  private val host = configuration.getString("ldap.host")
  private val port = configuration.getInt("ldap.port")
  private val ldaps = configuration.getBoolean("ldap.ldaps")
  private val bindDN = configuration.getString("ldap.bindDN")
  private val password = configuration.getString("ldap.password")
  private val initialConnextions = configuration.getInt("ldap.initialConnextions")
  private val maxConnections = configuration.getInt("ldap.maxConnections")
  protected val baseDN = configuration.getString("ldap.baseDN")
  protected val uidAttributeName = configuration.getString("ldap.uidAttributeName")

  private val connectionOption = new LDAPConnectionOptions
  private def getConnectionOptions: LDAPConnectionOptions = {
    connectionOption.setConnectTimeoutMillis(configuration.getInt("ldap.connectTimeout"))
    connectionOption.setResponseTimeoutMillis(configuration.getInt("ldap.responseTimeout"))
    connectionOption.setAbandonOnTimeout(configuration.getBoolean("ldap.abandonOnTimeOut"))
    connectionOption
  }

  case class UserConnection(
    dn: String,
    connection: LDAPConnection
  //TODO: Add user's role.
{'fraction_non_alphanumeric': 0.08807733619763695, 'fraction_numerical': 0.0, 'mean_word_length': 6.10941475826972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7240752', 'n_tokens_mistral': 737, 'n_tokens_neox': 743, 'n_words': 151}