diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/partial-import.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/partial-import.html
index 4005b0ddda..4a82f41767 100644
--- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/partial-import.html
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/partial-import.html
@@ -92,6 +92,7 @@
Action |
Type |
Name |
+ Id |
@@ -99,6 +100,7 @@
{{result.action}} |
{{result.resourceType}} |
{{result.resourceName}} |
+ {{result.id}} |
diff --git a/services/src/main/java/org/keycloak/partialimport/AbstractPartialImport.java b/services/src/main/java/org/keycloak/partialimport/AbstractPartialImport.java
index a85a574919..74392a2cc0 100644
--- a/services/src/main/java/org/keycloak/partialimport/AbstractPartialImport.java
+++ b/services/src/main/java/org/keycloak/partialimport/AbstractPartialImport.java
@@ -34,6 +34,7 @@ public abstract class AbstractPartialImport implements PartialImport {
public abstract List getRepList(PartialImportRepresentation partialImportRep);
public abstract String getName(T resourceRep);
+ public abstract String getModelId(RealmModel realm, KeycloakSession session, T resourceRep);
public abstract boolean exists(RealmModel realm, KeycloakSession session, T resourceRep);
public abstract String existsMessage(T resourceRep);
public abstract ResourceType getResourceType();
@@ -61,16 +62,16 @@ public abstract class AbstractPartialImport implements PartialImport {
return new ErrorResponseException(error);
}
- protected PartialImportResult overwritten(T resourceRep){
- return PartialImportResult.overwritten(getResourceType(), getName(resourceRep), resourceRep);
+ protected PartialImportResult overwritten(String modelId, T resourceRep){
+ return PartialImportResult.overwritten(getResourceType(), getName(resourceRep), modelId, resourceRep);
}
- protected PartialImportResult skipped(T resourceRep) {
- return PartialImportResult.skipped(getResourceType(), getName(resourceRep), resourceRep);
+ protected PartialImportResult skipped(String modelId, T resourceRep) {
+ return PartialImportResult.skipped(getResourceType(), getName(resourceRep), modelId, resourceRep);
}
- protected PartialImportResult added(T resourceRep) {
- return PartialImportResult.added(getResourceType(), getName(resourceRep), resourceRep);
+ protected PartialImportResult added(String modelId, T resourceRep) {
+ return PartialImportResult.added(getResourceType(), getName(resourceRep), modelId, resourceRep);
}
@Override
@@ -91,12 +92,14 @@ public abstract class AbstractPartialImport implements PartialImport {
throw new ErrorResponseException(ErrorResponse.error(e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR));
}
- results.addResult(overwritten(resourceRep));
+ String modelId = getModelId(realm, session, resourceRep);
+ results.addResult(overwritten(modelId, resourceRep));
}
for (T resourceRep : toSkip) {
System.out.println("skipping " + getResourceType() + " " + getName(resourceRep));
- results.addResult(skipped(resourceRep));
+ String modelId = getModelId(realm, session, resourceRep);
+ results.addResult(skipped(modelId, resourceRep));
}
for (T resourceRep : repList) {
@@ -106,7 +109,8 @@ public abstract class AbstractPartialImport implements PartialImport {
try {
System.out.println("adding " + getResourceType() + " " + getName(resourceRep));
create(realm, session, resourceRep);
- results.addResult(added(resourceRep));
+ String modelId = getModelId(realm, session, resourceRep);
+ results.addResult(added(modelId, resourceRep));
} catch (Exception e) {
//e.printStackTrace();
throw new ErrorResponseException(ErrorResponse.error(e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR));
diff --git a/services/src/main/java/org/keycloak/partialimport/ClientRolesPartialImport.java b/services/src/main/java/org/keycloak/partialimport/ClientRolesPartialImport.java
index f772d843fb..fc524f2e56 100644
--- a/services/src/main/java/org/keycloak/partialimport/ClientRolesPartialImport.java
+++ b/services/src/main/java/org/keycloak/partialimport/ClientRolesPartialImport.java
@@ -135,16 +135,16 @@ public class ClientRolesPartialImport implements PartialImport {
return new ErrorResponseException(error);
}
- protected PartialImportResult overwritten(String clientId, RoleRepresentation roleRep) {
- return PartialImportResult.overwritten(getResourceType(), getCombinedName(clientId, roleRep), roleRep);
+ protected PartialImportResult overwritten(String clientId, String modelId, RoleRepresentation roleRep) {
+ return PartialImportResult.overwritten(getResourceType(), getCombinedName(clientId, roleRep), modelId, roleRep);
}
- protected PartialImportResult skipped(String clientId, RoleRepresentation roleRep) {
- return PartialImportResult.skipped(getResourceType(), getCombinedName(clientId, roleRep), roleRep);
+ protected PartialImportResult skipped(String clientId, String modelId, RoleRepresentation roleRep) {
+ return PartialImportResult.skipped(getResourceType(), getCombinedName(clientId, roleRep), modelId, roleRep);
}
- protected PartialImportResult added(String clientId, RoleRepresentation roleRep) {
- return PartialImportResult.added(getResourceType(), getCombinedName(clientId, roleRep), roleRep);
+ protected PartialImportResult added(String clientId, String modelId, RoleRepresentation roleRep) {
+ return PartialImportResult.added(getResourceType(), getCombinedName(clientId, roleRep), modelId, roleRep);
}
@Override
@@ -166,14 +166,16 @@ public class ClientRolesPartialImport implements PartialImport {
throw new ErrorResponseException(ErrorResponse.error(e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR));
}
- results.addResult(overwritten(clientId, roleRep));
+ String modelId = getModelId(realm, clientId);
+ results.addResult(overwritten(clientId, modelId, roleRep));
}
}
for (String clientId : toSkip.keySet()) {
for (RoleRepresentation roleRep : toSkip.get(clientId)) {
System.out.println("skipping " + getResourceType() + " " + getCombinedName(clientId, roleRep));
- results.addResult(skipped(clientId, roleRep));
+ String modelId = getModelId(realm, clientId);
+ results.addResult(skipped(clientId, modelId, roleRep));
}
}
@@ -185,7 +187,8 @@ public class ClientRolesPartialImport implements PartialImport {
try {
System.out.println("adding " + getResourceType() + " " + getCombinedName(clientId, roleRep));
create(realm, session, clientId, roleRep);
- results.addResult(added(clientId, roleRep));
+ String modelId = getModelId(realm, clientId);
+ results.addResult(added(clientId, modelId, roleRep));
} catch (Exception e) {
//e.printStackTrace();
throw new ErrorResponseException(ErrorResponse.error(e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR));
@@ -196,4 +199,7 @@ public class ClientRolesPartialImport implements PartialImport {
return results;
}
+ private String getModelId(RealmModel realm, String clientId) {
+ return realm.getClientByClientId(clientId).getId();
+ }
}
diff --git a/services/src/main/java/org/keycloak/partialimport/ClientsPartialImport.java b/services/src/main/java/org/keycloak/partialimport/ClientsPartialImport.java
index 860c0ff113..ad633cc558 100644
--- a/services/src/main/java/org/keycloak/partialimport/ClientsPartialImport.java
+++ b/services/src/main/java/org/keycloak/partialimport/ClientsPartialImport.java
@@ -42,6 +42,11 @@ public class ClientsPartialImport extends AbstractPartialImport