diff --git a/nio-server/app/controllers/ConsentController.scala b/nio-server/app/controllers/ConsentController.scala index 8864a0c..d2130d8 100644 --- a/nio-server/app/controllers/ConsentController.scala +++ b/nio-server/app/controllers/ConsentController.scala @@ -188,13 +188,12 @@ class ConsentController( NioLogger.error(s"error.userId.is.immutable : userId in path $userId // userId on body ${o.userId}") Future.successful("error.userId.is.immutable".badRequest()) case Right(consentFact) => - val cf: ConsentFact = ConsentFact.addOrgKey(consentFact, orgKey) + val cf: ConsentFact = ConsentFact.ignoreExpirationDates(ConsentFact.addOrgKey(consentFact, orgKey)) (cf.offers, req.authInfo.offerRestrictionPatterns) match { // case ask create or update offers but no pattern allowed case (Some(offers), None) => - val errorMessages = - offers.map(o => ErrorMessage(s"offer.${o.key}.not.authorized")) + val errorMessages = offers.map(o => ErrorMessage(s"offer.${o.key}.not.authorized")) NioLogger.error(s"not authorized : ${errorMessages.map(_.message)}") Future.successful(AppErrors(errorMessages).unauthorized()) diff --git a/nio-server/app/models/ConsentFact.scala b/nio-server/app/models/ConsentFact.scala index d87f802..35919b6 100644 --- a/nio-server/app/models/ConsentFact.scala +++ b/nio-server/app/models/ConsentFact.scala @@ -658,6 +658,11 @@ object ConsentFact extends ReadableEntity[ConsentFact] { case JsError(errors) => Left(AppErrors.fromJsError(errors)) } + def ignoreExpirationDates(consentFact: ConsentFact): ConsentFact = + consentFact.copy(groups = consentFact.groups.map(g => + g.copy(consents = g.consents.map(c => c.copy(expiredAt = None))) + )) + def addOrgKey(consentFact: ConsentFact, orgKey: String): ConsentFact = consentFact.copy(orgKey = Some(orgKey)) }