Skip to content

Commit

Permalink
Merge pull request #64 from openstandia/fix-4.4
Browse files Browse the repository at this point in the history
fix: improve forceUpdateCredential and resolver by name (for midPoint 4.4)
  • Loading branch information
wadahiro authored Jan 18, 2024
2 parents 4d96cf0 + c950106 commit f1fb876
Show file tree
Hide file tree
Showing 5 changed files with 548 additions and 343 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -856,10 +856,15 @@ protected void updateCredential(MidPointTaskContext ctx, String oldCred, String
final ObjectDelta<UserType> objectDelta = prismContext.deltaFactory().object().createModifyDelta(userOid, delta, UserType.class);

// delta for nonce
NonceType nonce = user.getCredentials().getNonce();
if (clearNonce && nonce != null) {
objectDelta.addModificationDeleteContainer(ItemPath.create(UserType.F_CREDENTIALS, CredentialsType.F_NONCE),
nonce.clone());
if (clearNonce) {
CredentialsType credentials = user.getCredentials();
if (credentials != null) {
NonceType nonce = credentials.getNonce();
if (nonce != null) {
objectDelta.addModificationDeleteContainer(ItemPath.create(UserType.F_CREDENTIALS, CredentialsType.F_NONCE),
nonce.clone());
}
}
}

// delta for lifecycleState
Expand Down Expand Up @@ -993,7 +998,7 @@ public void getRole(GetRoleRequest request, StreamObserver<GetRoleResponse> resp

OperationResult parentResult = task.getResult().createSubresult(OPERATION_GET_ROLE);

String oid = resolveOid(UserType.class, request.getOid(), request.getName(), task, parentResult);
String oid = resolveOid(RoleType.class, request.getOid(), request.getName(), task, parentResult);

List<String> options = request.getOptionsList();
List<String> include = request.getIncludeList();
Expand Down Expand Up @@ -1070,7 +1075,7 @@ public void getOrg(GetOrgRequest request, StreamObserver<GetOrgResponse> respons

OperationResult parentResult = task.getResult().createSubresult(OPERATION_GET_ORG);

String oid = resolveOid(UserType.class, request.getOid(), request.getName(), task, parentResult);
String oid = resolveOid(OrgType.class, request.getOid(), request.getName(), task, parentResult);

List<String> options = request.getOptionsList();
List<String> include = request.getIncludeList();
Expand Down Expand Up @@ -1147,7 +1152,7 @@ public void getService(GetServiceRequest request, StreamObserver<GetServiceRespo

OperationResult parentResult = task.getResult().createSubresult(OPERATION_GET_SERVICE);

String oid = resolveOid(UserType.class, request.getOid(), request.getName(), task, parentResult);
String oid = resolveOid(ServiceType.class, request.getOid(), request.getName(), task, parentResult);

List<String> options = request.getOptionsList();
List<String> include = request.getIncludeList();
Expand Down Expand Up @@ -1729,7 +1734,7 @@ public void deleteObject(DeleteObjectRequest request, StreamObserver<DeleteObjec
clazz = ObjectTypes.getObjectTypeClass(qname);
}

String oid = resolveOid(UserType.class, request.getOid(), request.getName(), task, parentResult);
String oid = resolveOid(clazz, request.getOid(), request.getName(), task, parentResult);

List<String> options = request.getOptionsList();

Expand Down Expand Up @@ -1790,7 +1795,7 @@ public void recomputeObject(RecomputeObjectRequest request, StreamObserver<Recom
throw exception;
}

String oid = resolveOid(UserType.class, request.getOid(), request.getName(), task, parentResult);
String oid = resolveOid(clazz, request.getOid(), request.getName(), task, parentResult);
ModelExecuteOptions options = ModelExecuteOptions.createReconcile();

ObjectDelta<? extends FocusType> emptyDelta = prismContext.deltaFactory().object()
Expand Down
Loading

0 comments on commit f1fb876

Please sign in to comment.