Skip to content

Commit

Permalink
Merge pull request #62 from openstandia/fix-4.0
Browse files Browse the repository at this point in the history
fix: improve forceUpdateCredential and resolver by name
  • Loading branch information
wadahiro authored Jan 18, 2024
2 parents dd63ecb + e998978 commit a20be93
Show file tree
Hide file tree
Showing 4 changed files with 544 additions and 344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,15 @@ protected void updateCredential(MidPointTaskContext ctx, String oldCred, String
final ObjectDelta<UserType> objectDelta = prismContext.deltaFactory().object().createModifyDelta(user.getOid(), 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 @@ -1007,7 +1012,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 @@ -1084,7 +1089,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 @@ -1161,7 +1166,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 @@ -1743,7 +1748,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 @@ -1804,7 +1809,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 a20be93

Please sign in to comment.