<commit_before>package streama

import grails.transaction.Transactional
import org.apache.commons.validator.routines.UrlValidator

@Transactional
class SettingsService {

  def theMovieDbService

  def getBaseUrl() {
    return Settings.findBySettingsKey('Base URL')?.value
  }

  Boolean getAnonymousAccess() {
    return Boolean.valueOf(Settings.findByName('anonymous_access')?.value)
  }

  def enableAnonymousUser() {
    User anonymous = User.findByUsername("anonymous")<commit_msg>add getValueForName to settingService to quickly fetch correclty converted value<commit_after>package streama

import grails.transaction.Transactional
import org.apache.commons.validator.routines.UrlValidator

@Transactional
class SettingsService {

  def theMovieDbService

  def getBaseUrl() {
    return Settings.findBySettingsKey('Base URL')?.value
  }

  def getValueForName(String name){
    def setting = Settings.findByName(name)
    if(!setting){
      return
    }

    if(setting.settingsType == 'boolean'){
      return setting.value == 'true'
    }
    else if(setting.settingsType == 'integer'){
      return setting.value.isNumber() ? setting.value as Integer : null
    }
    else{
      return setting.value
    }
  }

  Boolean getAnonymousAccess() {
    return Boolean.valueOf(Settings.findByName('anonymous_access')?.value)
  }

  def enableAnonymousUser() {
    User anonymous = User.findByUsername("anonymous")
{'fraction_non_alphanumeric': 0.09725158562367865, 'fraction_numerical': 0.0, 'mean_word_length': 4.298507462686567, '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': '4147157', 'n_tokens_mistral': 410, 'n_tokens_neox': 396, 'n_words': 83}