Skip to content

Commit

Permalink
PIN-4255: Remove ivass certified attribute assignment (#162)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefano Perazzolo <[email protected]>
  • Loading branch information
2 people authored and nttdata-rtorsoli committed Dec 13, 2023
1 parent 666cea3 commit 3ace4a8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ interop-be-tenants-certified-attributes-updater {
ec-keys-identifiers = ${?EC_KEYS_IDENTIFIERS}
rsa-keys-identifiers = ${?RSA_KEYS_IDENTIFIERS}

ivass-assurance-attribute-code = ${IVASS_ASSURANCE_ATTRIBUTE_CODE}

services {
party-registry-proxy = ${PARTY_REGISTRY_PROXY_URL}
tenant-process = ${TENANT_PROCESS_URL}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,10 @@ object Main extends App with Dependencies {
uo <- retrieveAllInstitutions(uoRetriever, initPage, List.empty)
allInstitutions = institutions ++ aoo ++ uo
_ <- verifyInstitutionsCount(allInstitutions)
action = createAction(allInstitutions, tenants.toList, attributesIndex)
ivassAction = createIvassAction(
tenants.toList,
attributesIndex,
ApplicationConfiguration.ivassAssuranceAttributesCode
)
_ <- processActivations(
tenantUpserter,
action.activations.grouped(groupDimension).toList :+ ivassAction.activations
)
action = createAction(allInstitutions, tenants.toList, attributesIndex)
_ <- processActivations(tenantUpserter, action.activations.grouped(groupDimension).toList)
_ = logger.info(s"Activated tenants/attributes")
_ <- processRevocations(revokerCertifiedAttribute, action.revocations.toList ++ ivassAction.revocations.toList)
_ <- processRevocations(revokerCertifiedAttribute, action.revocations.toList)
_ = logger.info(s"Revoked tenants/attributes")
} yield ()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ object ApplicationConfiguration {
.toSet
.filter(_.nonEmpty)

val ivassAssuranceAttributesCode: String =
config.getString("interop-be-tenants-certified-attributes-updater.ivass-assurance-attribute-code")

require(
rsaKeysIdentifiers.nonEmpty || ecKeysIdentifiers.nonEmpty,
"You MUST provide at least one signing key (either RSA or EC)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ import it.pagopa.interop.commons.signer.service.SignerService
import it.pagopa.interop.commons.utils.Digester
import it.pagopa.interop.commons.utils.TypeConversions._
import it.pagopa.interop.partyregistryproxy.client.model.{Classification, Institution, Institutions}
import it.pagopa.interop.tenantmanagement.model.tenant.{
PersistentCertifiedAttribute,
PersistentExternalId,
PersistentTenant
}
import it.pagopa.interop.tenantmanagement.model.tenant.{PersistentExternalId, PersistentTenant}
import it.pagopa.interop.attributeregistryprocess.Utils.kindToBeExcluded
import it.pagopa.interop.tenantprocess.client.model.{ExternalId, InternalAttributeSeed, InternalTenantSeed}
import it.pagopa.interop.tenantscertifiedattributesupdater.system.ApplicationConfiguration
Expand All @@ -28,8 +24,6 @@ import scala.concurrent.{ExecutionContext, Future}

object Utils {

val IVASS_ORIGIN = "IVASS"

implicit class AttributeInfoOps(val a: AttributeInfo) extends AnyVal {
def toInternalAttributeSeed: InternalAttributeSeed = InternalAttributeSeed(a.origin, a.code)
}
Expand Down Expand Up @@ -112,35 +106,6 @@ object Utils {

}

def createIvassAction(
tenants: List[PersistentTenant],
attributesIndex: Map[UUID, AttributeInfo],
ivassAssuranceAttributesCode: String
): TenantActions = {
val ivassAttribute = attributesIndex
.find(a => a._2.origin == IVASS_ORIGIN && a._2.code == ivassAssuranceAttributesCode)
val ivassAttributeInfo = ivassAttribute.map(_._2.toInternalAttributeSeed).toList

def missingAttributes(tenant: PersistentTenant): Boolean =
tenant.attributes.collectFirst {
case a: PersistentCertifiedAttribute if ivassAttribute.exists(_._1 == a.id) && a.revocationTimestamp.isEmpty =>
()
}.isEmpty

val activations: List[InternalTenantSeed] = tenants
.filter(_.externalId.origin == IVASS_ORIGIN)
.filter(missingAttributes)
.map(tenant =>
InternalTenantSeed(
TenantId(tenant.externalId.origin, tenant.externalId.value, tenant.name).toExternalId,
ivassAttributeInfo,
tenant.name
)
)

TenantActions(activations, Map.empty)
}

def createAttributesIndex(attributes: Seq[PersistentAttribute]): Map[UUID, AttributeInfo] =
attributes
.filter(_.kind == Certified)
Expand Down

This file was deleted.

0 comments on commit 3ace4a8

Please sign in to comment.