From d58d3e76feef601a97c63d243f4be5026d98be1c Mon Sep 17 00:00:00 2001 From: To-om Date: Wed, 27 Jan 2021 11:43:35 +0100 Subject: [PATCH] #1731 Use implicit parameter for FieldsParser in Query --- .../connector/cortex/controllers/v0/ActionCtrl.scala | 1 - .../cortex/controllers/v0/AnalyzerTemplateCtrl.scala | 1 - .../thehive/connector/cortex/controllers/v0/JobCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v0/AuditCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v0/CaseCtrl.scala | 1 - .../org/thp/thehive/controllers/v0/CaseTemplateCtrl.scala | 1 - .../org/thp/thehive/controllers/v0/CustomFieldCtrl.scala | 1 - .../app/org/thp/thehive/controllers/v0/DashboardCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v0/LogCtrl.scala | 1 - .../thp/thehive/controllers/v0/ObservableTypeCtrl.scala | 1 - .../org/thp/thehive/controllers/v0/OrganisationCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v0/PageCtrl.scala | 1 - .../app/org/thp/thehive/controllers/v0/ProfileCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v0/TagCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v0/TaskCtrl.scala | 7 ++----- thehive/app/org/thp/thehive/controllers/v0/UserCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v1/AlertCtrl.scala | 4 +--- thehive/app/org/thp/thehive/controllers/v1/AuditCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala | 1 - .../org/thp/thehive/controllers/v1/CaseTemplateCtrl.scala | 1 - .../org/thp/thehive/controllers/v1/CustomFieldCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v1/LogCtrl.scala | 3 --- .../org/thp/thehive/controllers/v1/ObservableCtrl.scala | 1 - .../thp/thehive/controllers/v1/ObservableTypeCtrl.scala | 1 - .../org/thp/thehive/controllers/v1/OrganisationCtrl.scala | 1 - .../app/org/thp/thehive/controllers/v1/PatternCtrl.scala | 1 - .../app/org/thp/thehive/controllers/v1/ProcedureCtrl.scala | 1 - .../app/org/thp/thehive/controllers/v1/ProfileCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v1/ShareCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v1/TaskCtrl.scala | 1 - thehive/app/org/thp/thehive/controllers/v1/UserCtrl.scala | 1 - 32 files changed, 3 insertions(+), 40 deletions(-) diff --git a/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/ActionCtrl.scala b/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/ActionCtrl.scala index bcbe1ba3e9..1d8c6ecc44 100644 --- a/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/ActionCtrl.scala +++ b/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/ActionCtrl.scala @@ -88,7 +88,6 @@ class PublicAction @Inject() (actionSrv: ActionSrv, organisationSrv: Organisatio ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Action], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, actionSteps, _) => actionSteps.richPage(range.from, range.to, withTotal = true)(_.richAction) ) override val outputQuery: Query = Query.output[RichAction, Traversal.V[Action]](_.richAction) diff --git a/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/AnalyzerTemplateCtrl.scala b/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/AnalyzerTemplateCtrl.scala index 98c666a259..acc665c1b2 100644 --- a/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/AnalyzerTemplateCtrl.scala +++ b/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/AnalyzerTemplateCtrl.scala @@ -105,7 +105,6 @@ class PublicAnalyzerTemplate @Inject() (analyzerTemplateSrv: AnalyzerTemplateSrv override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[AnalyzerTemplate], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, analyzerTemplateTraversal, _) => analyzerTemplateTraversal.page(range.from, range.to, withTotal = true) ) override val outputQuery: Query = Query.output[AnalyzerTemplate with Entity] diff --git a/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/JobCtrl.scala b/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/JobCtrl.scala index 44f6b5d07a..ccc79a5f79 100644 --- a/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/JobCtrl.scala +++ b/cortex/connector/src/main/scala/org/thp/thehive/connector/cortex/controllers/v0/JobCtrl.scala @@ -84,7 +84,6 @@ class PublicJob @Inject() (jobSrv: JobSrv) extends PublicData with JobRenderer { override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Job], IteratorOutput]( "page", - FieldsParser[OutputParam], { case (OutputParam(from, to, _, withParents), jobSteps, authContext) if withParents > 0 => jobSteps.richPage(from, to, withTotal = true)(_.richJobWithCustomRenderer(jobParents(_)(authContext))(authContext)) diff --git a/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala index 9a492db79c..e6dc4f4e12 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala @@ -363,7 +363,6 @@ class PublicAlert @Inject() ( override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Alert], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, alertSteps, _) => alertSteps .richPage(range.from, range.to, withTotal = true) { alerts => diff --git a/thehive/app/org/thp/thehive/controllers/v0/AuditCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/AuditCtrl.scala index a410039e3d..dfb523862a 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/AuditCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/AuditCtrl.scala @@ -79,7 +79,6 @@ class PublicAudit @Inject() (auditSrv: AuditSrv, organisationSrv: OrganisationSr override val pageQuery: ParamQuery[org.thp.thehive.controllers.v0.OutputParam] = Query.withParam[OutputParam, Traversal.V[Audit], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, auditSteps, _) => auditSteps.richPage(range.from, range.to, withTotal = true)(_.richAudit) ) override val outputQuery: Query = Query.output[RichAudit, Traversal.V[Audit]](_.richAudit) diff --git a/thehive/app/org/thp/thehive/controllers/v0/CaseCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/CaseCtrl.scala index 8aa555e6ba..3dd093bbcb 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/CaseCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/CaseCtrl.scala @@ -203,7 +203,6 @@ class PublicCase @Inject() ( override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Case], IteratorOutput]( "page", - FieldsParser[OutputParam], { case (OutputParam(from, to, withStats, _), caseSteps, authContext) => caseSteps diff --git a/thehive/app/org/thp/thehive/controllers/v0/CaseTemplateCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/CaseTemplateCtrl.scala index b3bf3e8dc2..33d8ee4801 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/CaseTemplateCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/CaseTemplateCtrl.scala @@ -107,7 +107,6 @@ class PublicCaseTemplate @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[CaseTemplate], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, caseTemplateSteps, _) => caseTemplateSteps.richPage(range.from, range.to, withTotal = true)(_.richCaseTemplate) ) override val outputQuery: Query = Query.output[RichCaseTemplate, Traversal.V[CaseTemplate]](_.richCaseTemplate) diff --git a/thehive/app/org/thp/thehive/controllers/v0/CustomFieldCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/CustomFieldCtrl.scala index 5ae48ebb51..2e19b83402 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/CustomFieldCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/CustomFieldCtrl.scala @@ -92,7 +92,6 @@ class PublicCustomField @Inject() (customFieldSrv: CustomFieldSrv) extends Publi override val initialQuery: Query = Query.init[Traversal.V[CustomField]]("listCustomField", (graph, _) => customFieldSrv.startTraversal(graph)) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[CustomField], IteratorOutput]( "page", - FieldsParser[OutputParam], { case (OutputParam(from, to, _, _), customFieldSteps, _) => customFieldSteps.page(from, to, withTotal = true) diff --git a/thehive/app/org/thp/thehive/controllers/v0/DashboardCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/DashboardCtrl.scala index 31e0e76e92..19eca002fb 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/DashboardCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/DashboardCtrl.scala @@ -101,7 +101,6 @@ class PublicDashboard @Inject() ( val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Dashboard], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, dashboardSteps, _) => dashboardSteps.richPage(range.from, range.to, withTotal = true)(_.richDashboard) ) override val outputQuery: Query = Query.output[RichDashboard, Traversal.V[Dashboard]](_.richDashboard) diff --git a/thehive/app/org/thp/thehive/controllers/v0/LogCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/LogCtrl.scala index bd4922c696..20e953b941 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/LogCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/LogCtrl.scala @@ -83,7 +83,6 @@ class PublicLog @Inject() (logSrv: LogSrv, organisationSrv: OrganisationSrv) ext ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Log], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, logSteps, _) => logSteps.richPage(range.from, range.to, withTotal = true)(_.richLog) ) override val outputQuery: Query = Query.output[RichLog, Traversal.V[Log]](_.richLog) diff --git a/thehive/app/org/thp/thehive/controllers/v0/ObservableTypeCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/ObservableTypeCtrl.scala index a3998ad0fc..283c5320cd 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/ObservableTypeCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/ObservableTypeCtrl.scala @@ -54,7 +54,6 @@ class PublicObservableType @Inject() (observableTypeSrv: ObservableTypeSrv) exte override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[ObservableType], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, observableTypeSteps, _) => observableTypeSteps.richPage(range.from, range.to, withTotal = true)(identity) ) override val outputQuery: Query = Query.output[ObservableType with Entity] diff --git a/thehive/app/org/thp/thehive/controllers/v0/OrganisationCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/OrganisationCtrl.scala index 60f9b53473..1f3972b130 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/OrganisationCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/OrganisationCtrl.scala @@ -133,7 +133,6 @@ class PublicOrganisation @Inject() (organisationSrv: OrganisationSrv) extends Pu Query.init[Traversal.V[Organisation]]("listOrganisation", (graph, authContext) => organisationSrv.startTraversal(graph).visible(authContext)) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Organisation], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, organisationSteps, _) => organisationSteps.page(range.from, range.to, withTotal = true) ) override val outputQuery: Query = Query.output[Organisation with Entity] diff --git a/thehive/app/org/thp/thehive/controllers/v0/PageCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/PageCtrl.scala index ff6317cd8e..39490e2dc9 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/PageCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/PageCtrl.scala @@ -78,7 +78,6 @@ class PublicPage @Inject() (pageSrv: PageSrv, organisationSrv: OrganisationSrv) ) val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Page], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, pageSteps, _) => pageSteps.page(range.from, range.to, withTotal = true) ) override val outputQuery: Query = Query.output[Page with Entity] diff --git a/thehive/app/org/thp/thehive/controllers/v0/ProfileCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/ProfileCtrl.scala index d075ca7788..cdb66c4928 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/ProfileCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/ProfileCtrl.scala @@ -83,7 +83,6 @@ class PublicProfile @Inject() (profileSrv: ProfileSrv) extends PublicData { val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Profile], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, profileSteps, _) => profileSteps.page(range.from, range.to, withTotal = true) ) override val outputQuery: Query = Query.output[Profile with Entity] diff --git a/thehive/app/org/thp/thehive/controllers/v0/TagCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/TagCtrl.scala index 970be79137..e90c8f623a 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/TagCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/TagCtrl.scala @@ -105,7 +105,6 @@ class PublicTag @Inject() (tagSrv: TagSrv) extends PublicData { override val initialQuery: Query = Query.init[Traversal.V[Tag]]("listTag", (graph, _) => tagSrv.startTraversal(graph)) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Tag], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, tagSteps, _) => tagSteps.page(range.from, range.to, withTotal = true) ) override val outputQuery: Query = Query.output[Tag with Entity] diff --git a/thehive/app/org/thp/thehive/controllers/v0/TaskCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/TaskCtrl.scala index 42b29ae153..0d9c0a9e5b 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/TaskCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/TaskCtrl.scala @@ -1,8 +1,5 @@ package org.thp.thehive.controllers.v0 -import org.apache.tinkerpop.gremlin.process.traversal.P - -import javax.inject.{Inject, Named, Singleton} import org.thp.scalligraph.controllers._ import org.thp.scalligraph.models.{Database, UMapping} import org.thp.scalligraph.query._ @@ -14,12 +11,13 @@ import org.thp.thehive.dto.v0.InputTask import org.thp.thehive.models._ import org.thp.thehive.services.CaseOps._ import org.thp.thehive.services.OrganisationOps._ -import org.thp.thehive.services.ShareOps._ import org.thp.thehive.services.TaskOps._ import org.thp.thehive.services._ import play.api.libs.json.Json import play.api.mvc.{Action, AnyContent, Results} +import javax.inject.{Inject, Named, Singleton} + @Singleton class TaskCtrl @Inject() ( override val entrypoint: Entrypoint, @@ -106,7 +104,6 @@ class PublicTask @Inject() (taskSrv: TaskSrv, organisationSrv: OrganisationSrv, //organisationSrv.get(authContext.organisation)(graph).shares.tasks) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Task], IteratorOutput]( "page", - FieldsParser[OutputParam], { case (OutputParam(from, to, _, 0), taskSteps, _) => taskSteps.richPage(from, to, withTotal = true)(_.richTask.domainMap(_ -> (None: Option[RichCase]))) diff --git a/thehive/app/org/thp/thehive/controllers/v0/UserCtrl.scala b/thehive/app/org/thp/thehive/controllers/v0/UserCtrl.scala index ff406e5f67..e2211b72c5 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/UserCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/UserCtrl.scala @@ -237,7 +237,6 @@ class PublicUser @Inject() (userSrv: UserSrv, organisationSrv: OrganisationSrv) ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[User], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, userSteps, authContext) => userSteps.richUser(authContext).page(range.from, range.to, withTotal = true) ) override val outputQuery: Query = diff --git a/thehive/app/org/thp/thehive/controllers/v1/AlertCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/AlertCtrl.scala index 0acbd3a959..dc3f3243e3 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/AlertCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/AlertCtrl.scala @@ -46,7 +46,6 @@ class AlertCtrl @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Alert], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, alertSteps, authContext) => alertSteps .richPage(range.from, range.to, range.extraData.contains("total"))( @@ -55,7 +54,7 @@ class AlertCtrl @Inject() ( ) override val outputQuery: Query = Query.output[RichAlert, Traversal.V[Alert]](_.richAlert) val caseProperties: PublicProperties = properties.`case` ++ properties.metaProperties - val caseFilterParser: FieldsParser[Option[InputQuery[Traversal.Unk, Traversal.Unk]]] = + implicit val caseFilterParser: FieldsParser[Option[InputQuery[Traversal.Unk, Traversal.Unk]]] = FilterQuery.default(caseProperties).paramParser(ru.typeOf[Traversal.V[Case]]).optional.on("caseFilter") override val extraQueries: Seq[ParamQuery[_]] = Seq( Query[Traversal.V[Alert], Traversal.V[Observable]]("observables", (alertSteps, _) => alertSteps.observables), @@ -66,7 +65,6 @@ class AlertCtrl @Inject() ( Converter[JsValue, JMap[String, Any]] ]]( "similarCases", - caseFilterParser, { (maybeCaseFilterQuery, alertSteps, authContext) => val caseFilter: Option[Traversal.V[Case] => Traversal.V[Case]] = maybeCaseFilterQuery.map(f => cases => f(caseProperties, ru.typeOf[Traversal.V[Case]], cases.cast, authContext).cast) diff --git a/thehive/app/org/thp/thehive/controllers/v1/AuditCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/AuditCtrl.scala index 4f048c935d..46b5af472e 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/AuditCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/AuditCtrl.scala @@ -39,7 +39,6 @@ class AuditCtrl @Inject() ( val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Audit], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, auditSteps, _) => auditSteps.richPage(range.from, range.to, range.extraData.contains("total"))(_.richAudit) ) override val outputQuery: Query = Query.output[RichAudit, Traversal.V[Audit]](_.richAudit) diff --git a/thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala index 5ed8e95d55..24e9a8d014 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala @@ -48,7 +48,6 @@ class CaseCtrl @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Case], IteratorOutput]( "page", - FieldsParser[OutputParam], { case (OutputParam(from, to, extraData), caseSteps, authContext) => caseSteps.richPage(from, to, extraData.contains("total")) { diff --git a/thehive/app/org/thp/thehive/controllers/v1/CaseTemplateCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/CaseTemplateCtrl.scala index 6b9d3ae7ce..9f39060ddc 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/CaseTemplateCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/CaseTemplateCtrl.scala @@ -38,7 +38,6 @@ class CaseTemplateCtrl @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[CaseTemplate], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, caseTemplateSteps, _) => caseTemplateSteps.richPage(range.from, range.to, range.extraData.contains("total"))(_.richCaseTemplate) ) override val outputQuery: Query = Query.output[RichCaseTemplate, Traversal.V[CaseTemplate]](_.richCaseTemplate) diff --git a/thehive/app/org/thp/thehive/controllers/v1/CustomFieldCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/CustomFieldCtrl.scala index a10bdb96e8..62369c8e50 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/CustomFieldCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/CustomFieldCtrl.scala @@ -21,7 +21,6 @@ class CustomFieldCtrl @Inject() (entrypoint: Entrypoint, db: Database, customFie override val initialQuery: Query = Query.init[Traversal.V[CustomField]]("listCustomField", (graph, _) => customFieldSrv.startTraversal(graph)) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[CustomField], IteratorOutput]( "page", - FieldsParser[OutputParam], { case (OutputParam(from, to, _), customFieldSteps, _) => customFieldSteps.page(from, to, withTotal = true) diff --git a/thehive/app/org/thp/thehive/controllers/v1/LogCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/LogCtrl.scala index 4859fc569b..72c5e2d9fd 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/LogCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/LogCtrl.scala @@ -10,8 +10,6 @@ import org.thp.thehive.controllers.v1.Conversion._ import org.thp.thehive.dto.v1.InputLog import org.thp.thehive.models.{Log, Permissions, RichLog} import org.thp.thehive.services.LogOps._ -import org.thp.thehive.services.OrganisationOps._ -import org.thp.thehive.services.ShareOps._ import org.thp.thehive.services.TaskOps._ import org.thp.thehive.services.{LogSrv, OrganisationSrv, TaskSrv} import play.api.Logger @@ -41,7 +39,6 @@ class LogCtrl @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Log], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, logSteps, authContext) => logSteps.richPage(range.from, range.to, range.extraData.contains("total"))( _.richLogWithCustomRenderer(logStatsRenderer(range.extraData - "total")(authContext)) diff --git a/thehive/app/org/thp/thehive/controllers/v1/ObservableCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/ObservableCtrl.scala index 479d5e7cb9..1c52c79703 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/ObservableCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/ObservableCtrl.scala @@ -65,7 +65,6 @@ class ObservableCtrl @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Observable], IteratorOutput]( "page", - FieldsParser[OutputParam], { case (OutputParam(from, to, extraData), observableSteps, authContext) => observableSteps.richPage(from, to, extraData.contains("total")) { diff --git a/thehive/app/org/thp/thehive/controllers/v1/ObservableTypeCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/ObservableTypeCtrl.scala index 9cd2ac6499..126e5e5172 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/ObservableTypeCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/ObservableTypeCtrl.scala @@ -26,7 +26,6 @@ class ObservableTypeCtrl @Inject() ( override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[ObservableType], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, observableTypeSteps, _) => observableTypeSteps.richPage(range.from, range.to, withTotal = true)(identity) ) override val outputQuery: Query = Query.output[ObservableType with Entity] diff --git a/thehive/app/org/thp/thehive/controllers/v1/OrganisationCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/OrganisationCtrl.scala index b82f0853c2..68c0c68720 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/OrganisationCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/OrganisationCtrl.scala @@ -37,7 +37,6 @@ class OrganisationCtrl @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Organisation], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, organisationSteps, _) => organisationSteps.richPage(range.from, range.to, range.extraData.contains("total"))(_.richOrganisation) ) override val outputQuery: Query = Query.output[RichOrganisation, Traversal.V[Organisation]](_.richOrganisation) diff --git a/thehive/app/org/thp/thehive/controllers/v1/PatternCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/PatternCtrl.scala index c2356f091f..adb672f072 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/PatternCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/PatternCtrl.scala @@ -36,7 +36,6 @@ class PatternCtrl @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Pattern], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, patternSteps, _) => patternSteps.richPage(range.from, range.to, range.extraData.contains("total"))(_.richPattern) ) override val outputQuery: Query = Query.output[RichPattern, Traversal.V[Pattern]](_.richPattern) diff --git a/thehive/app/org/thp/thehive/controllers/v1/ProcedureCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/ProcedureCtrl.scala index 02d4f20476..747cf74dc4 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/ProcedureCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/ProcedureCtrl.scala @@ -32,7 +32,6 @@ class ProcedureCtrl @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Procedure], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, procedureSteps, _) => procedureSteps.richPage(range.from, range.to, range.extraData.contains("total"))(_.richProcedure) ) override val outputQuery: Query = Query.output[RichProcedure, Traversal.V[Procedure]](_.richProcedure) diff --git a/thehive/app/org/thp/thehive/controllers/v1/ProfileCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/ProfileCtrl.scala index 7b02d8ef51..2811e22ea2 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/ProfileCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/ProfileCtrl.scala @@ -37,7 +37,6 @@ class ProfileCtrl @Inject() ( val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Profile], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, profileSteps, _) => profileSteps.page(range.from, range.to, range.extraData.contains("total")) ) override val outputQuery: Query = Query.output[Profile with Entity] diff --git a/thehive/app/org/thp/thehive/controllers/v1/ShareCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/ShareCtrl.scala index acbd82f670..3b0159ca6e 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/ShareCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/ShareCtrl.scala @@ -38,7 +38,6 @@ class ShareCtrl @Inject() ( Query.init[Traversal.V[Share]]("listShare", (graph, authContext) => organisationSrv.startTraversal(graph).visible(authContext).shares) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Share], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, shareSteps, _) => shareSteps.richPage(range.from, range.to, range.extraData.contains("total"))(_.richShare) ) override val outputQuery: Query = Query.outputWithContext[RichShare, Traversal.V[Share]]((shareSteps, _) => shareSteps.richShare) diff --git a/thehive/app/org/thp/thehive/controllers/v1/TaskCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/TaskCtrl.scala index 591f3bd4cd..6993fcfabd 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/TaskCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/TaskCtrl.scala @@ -41,7 +41,6 @@ class TaskCtrl @Inject() ( ) override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[Task], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, taskSteps, authContext) => taskSteps.richPage(range.from, range.to, range.extraData.contains("total"))( _.richTaskWithCustomRenderer(taskStatsRenderer(range.extraData)(authContext)) diff --git a/thehive/app/org/thp/thehive/controllers/v1/UserCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/UserCtrl.scala index e0220e0ba8..61d0eaecc9 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/UserCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/UserCtrl.scala @@ -51,7 +51,6 @@ class UserCtrl @Inject() ( override val pageQuery: ParamQuery[OutputParam] = Query.withParam[OutputParam, Traversal.V[User], IteratorOutput]( "page", - FieldsParser[OutputParam], (range, userSteps, authContext) => userSteps.richUser(authContext).page(range.from, range.to, range.extraData.contains("total")) ) override val outputQuery: Query =