<commit_before>
import org.apache.shiro.SecurityUtils

import aaf.fr.foundation.*

class ReportingSecurityFilters {
  def filters = {

    authn(controller: "(federationReports|complianceReports|identityProviderReports|serviceProviderReports)") {
      before = {
        accessControl { true }
      }
      after = {
        log.info("Completed authenticated access for $subject to $params.controller/$params.action")
      }
    }

    federationReportRestriction(controller: 'federationReports', action:'*', actionExclude: 'reportsummary*') {
      before = {
        def allow = federationGuard(params)
        if(!allow) {
          response.sendError(403)
          return false
        }
      }
    }

    idpReportRestriction(controller: 'identityProviderReports', action: 'report*') {
      before = {
        def allow = idpGuard(params)
        if(!allow) {
          response.sendError(403)
          return false
        }
      }
    }

    spReportRestriction(controller: 'serviceProviderReports', action: 'report*') {
      before = {
        def allow = spGuard(params)<commit_msg>adding logging to indicate CSV export<commit_after>
import org.apache.shiro.SecurityUtils

import aaf.fr.foundation.*

class ReportingSecurityFilters {

  def filters = {

    authn(controller: "(federationReports|complianceReports|identityProviderReports|serviceProviderReports)") {
      before = {
        accessControl { true }
      }
      after = {
        log.info("Completed authenticated access for $subject to $params.controller/$params.action ${params.type == 'csv' ? 'exporting CSV':''}")
      }
    }

    federationReportRestriction(controller: 'federationReports', action:'*', actionExclude: 'reportsummary*') {
      before = {
        def allow = federationGuard(params)
        if(!allow) {
          response.sendError(403)
          return false
        }
      }  
    }

    idpReportRestriction(controller: 'identityProviderReports', action: 'report*') {
      before = {
        def allow = idpGuard(params)
        if(!allow) {
          response.sendError(403)
          return false
        }
      }
    }

    spReportRestriction(controller: 'serviceProviderReports', action: 'report*') {
      before = {
        def allow = spGuard(params)
{'fraction_non_alphanumeric': 0.10915492957746478, 'fraction_numerical': 0.00528169014084507, 'mean_word_length': 2.677993527508091, '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': '1891260', 'n_tokens_mistral': 661, 'n_tokens_neox': 625, 'n_words': 118}