Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIN-4255: Remove ivass certified attribute assignment #162

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading