diff --git a/connector/rest/docs/openapi/selfcare-user-docs.json b/connector/rest/docs/openapi/selfcare-user-docs.json index 0a7fc1e6..d707ea1f 100644 --- a/connector/rest/docs/openapi/selfcare-user-docs.json +++ b/connector/rest/docs/openapi/selfcare-user-docs.json @@ -60,11 +60,91 @@ } } }, + "401" : { + "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" + } + }, + "security" : [ { + "SecurityScheme" : [ ] + } ] + } + }, + "/events/sc-users" : { + "post" : { + "tags" : [ "Events" ], + "summary" : "The API resend all the users's given an institutionId and a userId after the given fromDate", + "parameters" : [ { + "name" : "fromDate", + "in" : "query", + "required" : true, + "schema" : { + "$ref" : "#/components/schemas/LocalDateTime" + } + }, { + "name" : "institutionId", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "userId", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "201" : { + "description" : "Created" + }, + "401" : { + "description" : "Not Authorized" + }, "403" : { "description" : "Not Allowed" + } + }, + "security" : [ { + "SecurityScheme" : [ ] + } ] + } + }, + "/institutions/{institutionId}" : { + "put" : { + "tags" : [ "Institution" ], + "summary" : "The API updates the description in all occurrences of userInstitution, given a certain institutionId.", + "parameters" : [ { + "name" : "institutionId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UpdateDescriptionDto" + } + } + } + }, + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { } + } }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -115,11 +195,11 @@ "application/json" : { } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -195,11 +275,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -233,11 +313,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -328,11 +408,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -353,7 +433,7 @@ }, "responses" : { "200" : { - "description" : "OK", + "description" : "User created or updated!", "content" : { "application/json" : { "schema" : { @@ -362,11 +442,14 @@ } } }, - "403" : { - "description" : "Not Allowed" + "201" : { + "description" : "User already has the active role for that product!" }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -407,11 +490,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -447,11 +530,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -497,11 +580,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -540,11 +623,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -587,11 +670,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -634,11 +717,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -689,11 +772,11 @@ "204" : { "description" : "No Content" }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -750,11 +833,11 @@ "application/json" : { } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -796,11 +879,11 @@ "application/json" : { } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -831,16 +914,19 @@ }, "responses" : { "200" : { - "description" : "OK", + "description" : "User created or updated!", "content" : { "application/json" : { } } }, - "403" : { - "description" : "Not Allowed" + "201" : { + "description" : "User already has the active role for that product!" }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -923,11 +1009,11 @@ } } }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -973,6 +1059,9 @@ } } }, + "401" : { + "description" : "Not Authorized" + }, "403" : { "description" : "Not Allowed" } @@ -1020,6 +1109,9 @@ }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -1057,11 +1149,11 @@ "204" : { "description" : "No Content" }, - "403" : { - "description" : "Not Allowed" - }, "401" : { "description" : "Not Authorized" + }, + "403" : { + "description" : "Not Allowed" } }, "security" : [ { @@ -1162,7 +1254,8 @@ "type" : "string" }, "role" : { - "$ref" : "#/components/schemas/PartyRole" + "description" : "Available values: MANAGER, DELEGATE, SUB_DELEGATE, OPERATOR", + "type" : "string" }, "env" : { "$ref" : "#/components/schemas/Env" @@ -1218,7 +1311,7 @@ } }, "PartyRole" : { - "enum" : [ "MANAGER", "DELEGATE", "SUB_DELEGATE", "OPERATOR" ], + "enum" : [ "MANAGER", "DELEGATE", "SUB_DELEGATE", "OPERATOR"], "type" : "string" }, "PermissionTypeEnum" : { @@ -1244,6 +1337,9 @@ "items" : { "type" : "string" } + }, + "delegationId" : { + "type" : "string" } } }, @@ -1282,6 +1378,19 @@ } } }, + "UpdateDescriptionDto" : { + "required" : [ "institutionDescription" ], + "type" : "object", + "properties" : { + "institutionDescription" : { + "minLength" : 1, + "type" : "string" + }, + "institutionRootName" : { + "type" : "string" + } + } + }, "UpdateUserRequest" : { "required" : [ "email" ], "type" : "object", @@ -1440,7 +1549,8 @@ "type" : "string" }, "role" : { - "$ref" : "#/components/schemas/PartyRole" + "description" : "Available values: MANAGER, DELEGATE, SUB_DELEGATE, OPERATOR", + "type" : "string" }, "status" : { "$ref" : "#/components/schemas/OnboardedProductState" @@ -1574,7 +1684,8 @@ "type" : "string" }, "role" : { - "$ref" : "#/components/schemas/PartyRole" + "description" : "Available values: MANAGER, DELEGATE, SUB_DELEGATE, OPERATOR", + "type" : "string" }, "productRole" : { "type" : "string" diff --git a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/InstitutionMapper.java b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/InstitutionMapper.java index 1b1dd267..35a38911 100644 --- a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/InstitutionMapper.java +++ b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/InstitutionMapper.java @@ -25,7 +25,7 @@ public interface InstitutionMapper { @Mapping(target = "id", source = "institutionId") @Mapping(target = "name", source = "institutionName") @Mapping(target = "parentDescription", source = "institutionRootName") - @Mapping(target = "userRole", expression = "java(institutionProducts.getRole().name())") + @Mapping(target = "userRole", expression = "java(institutionProducts.getRole())") @Mapping(target = "status", expression = "java(institutionProducts.getStatus().name())") InstitutionBase toInstitutionBase(UserInstitutionRoleResponse institutionProducts); diff --git a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/UserMapper.java b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/UserMapper.java index b12e745c..12e50ec5 100644 --- a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/UserMapper.java +++ b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/UserMapper.java @@ -94,7 +94,7 @@ default Map toProductInfoMap(List productInfo.setId(onboardedProduct.getProductId()); roleInfo.setRole(onboardedProduct.getProductRole()); roleInfo.setStatus(onboardedProduct.getStatus().name()); - roleInfo.setSelcRole(it.pagopa.selfcare.commons.base.security.PartyRole.valueOf(onboardedProduct.getRole().name()).getSelfCareAuthority()); + roleInfo.setSelcRole(it.pagopa.selfcare.commons.base.security.PartyRole.valueOf(onboardedProduct.getRole()).getSelfCareAuthority()); if (productInfo.getRoleInfos() == null) productInfo.setRoleInfos(new ArrayList<>()); productInfo.getRoleInfos().add(roleInfo); @@ -114,7 +114,7 @@ default Map toProductInfoMap(List @Mapping(target = "status", expression = "java(it.pagopa.selfcare.dashboard.connector.model.institution.RelationshipState.valueOf(onboardedProductResponse.getStatus().name()))") @Mapping(target = "env", expression = "java(it.pagopa.selfcare.commons.base.utils.Env.valueOf(onboardedProductResponse.getEnv().name()))") - @Mapping(target = "role", expression = "java(it.pagopa.selfcare.commons.base.security.PartyRole.valueOf(onboardedProductResponse.getRole().name()))") + @Mapping(target = "role", expression = "java(it.pagopa.selfcare.commons.base.security.PartyRole.valueOf(onboardedProductResponse.getRole()))") OnboardedProduct toOnboardedProducts(OnboardedProductResponse onboardedProductResponse); }