<commit_before>package se.su.it.cognos.cognosshibauth.ldap.schema

import se.su.it.cognos.cognosshibauth.config.ConfigHandler
import java.util.logging.Logger
import java.util.logging.Level
import gldapo.Gldapo

import gldapo.GldapoSchemaRegistry
import gldapo.GldapoDirectory
import se.su.it.cognos.cognosshibauth.ldap.gldapo.DummyGldapoDirectoryRegistry

class SchemaBase implements Serializable {
  static {
    ConfigHandler configHandler = ConfigHandler.instance()
    def url = configHandler.getStringEntry("ldap.url", "ldap://sukat-ldap.it.su.se")
    def baseDn = configHandler.getStringEntry("ldap.base_dn", "dc=su,dc=se")
    def countLimit = configHandler.getIntEntry("ldap.count_limit", 500)
    def timeLimit = configHandler.getIntEntry("ldap.time_limit", 120000)

    Logger LOG = Logger.getLogger(SchemaBase.class.getName())
    LOG.log(Level.FINE, "Initializing Gldapo schema '${SchemaBase.class.getName()}'")

    Gldapo gldapo = new Gldapo()

    def gldapoDirectoryMap = [
      defaultDirectory: true,
      url: url,
      base: baseDn,
      searchControls: [
        countLimit: 500,
        timeLimit: 120000,
        searchScope: "subtree"
      ]
    ]

    GldapoSchemaRegistry gldapoSchemaRegistry = new GldapoSchemaRegistry(gldapo)
    gldapoSchemaRegistry.add(se.su.it.cognos.cognosshibauth.ldap.schema.SuPerson)
    gldapoSchemaRegistry.add(se.su.it.cognos.cognosshibauth.ldap.schema.GroupOfUniqueNames)
    gldapo.setSchemas(gldapoSchemaRegistry)

    DummyGldapoDirectoryRegistry gldapoDirectoryRegistry = new DummyGldapoDirectoryRegistry()
    GldapoDirectory gldapoDirectory = new GldapoDirectory("example", gldapoDirectoryMap)
    gldapoDirectoryRegistry.put("example", gldapoDirectory)
    gldapo.setDirectories(gldapoDirectoryRegistry)
  }
}
<commit_msg>Set countLimit and timeLimit from conf.<commit_after>package se.su.it.cognos.cognosshibauth.ldap.schema

import se.su.it.cognos.cognosshibauth.config.ConfigHandler
import java.util.logging.Logger
import java.util.logging.Level
import gldapo.Gldapo

import gldapo.GldapoSchemaRegistry
import gldapo.GldapoDirectory
import se.su.it.cognos.cognosshibauth.ldap.gldapo.DummyGldapoDirectoryRegistry

class SchemaBase implements Serializable {
  static {
    ConfigHandler configHandler = ConfigHandler.instance()
    def url = configHandler.getStringEntry("ldap.url", "ldap://sukat-ldap.it.su.se")
    def baseDn = configHandler.getStringEntry("ldap.base_dn", "dc=su,dc=se")
    def countLimit = configHandler.getIntEntry("ldap.count_limit", 500)
    def timeLimit = configHandler.getIntEntry("ldap.time_limit", 120000)

    Logger LOG = Logger.getLogger(SchemaBase.class.getName())
    LOG.log(Level.FINE, "Initializing Gldapo schema '${SchemaBase.class.getName()}'")

    Gldapo gldapo = new Gldapo()

    def gldapoDirectoryMap = [
      defaultDirectory: true,
      url: url,
      base: baseDn,
      searchControls: [
        countLimit: countLimit,
        timeLimit: timeLimit,
        searchScope: "subtree"
      ]
    ]

    GldapoSchemaRegistry gldapoSchemaRegistry = new GldapoSchemaRegistry(gldapo)
    gldapoSchemaRegistry.add(se.su.it.cognos.cognosshibauth.ldap.schema.SuPerson)
    gldapoSchemaRegistry.add(se.su.it.cognos.cognosshibauth.ldap.schema.GroupOfUniqueNames)
    gldapo.setSchemas(gldapoSchemaRegistry)

    DummyGldapoDirectoryRegistry gldapoDirectoryRegistry = new DummyGldapoDirectoryRegistry()
    GldapoDirectory gldapoDirectory = new GldapoDirectory("example", gldapoDirectoryMap)
    gldapoDirectoryRegistry.put("example", gldapoDirectory)
    gldapo.setDirectories(gldapoDirectoryRegistry)
  }
}

{'fraction_non_alphanumeric': 0.09701492537313433, 'fraction_numerical': 0.007462686567164179, 'mean_word_length': 4.735340729001585, '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': '5328090', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1198, 'n_words': 177}