Skip to content

Commit

Permalink
Added support to insert a reference to an organization or role into o…
Browse files Browse the repository at this point in the history
…peratorRef.

 - Members of the organizations (direct only) or roles can be used as operators of manual applications - only org:default relation.
  • Loading branch information
mokracekjan committed Jun 21, 2021
1 parent 506aaf0 commit 94e4635
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8061,7 +8061,7 @@
<xsd:annotation>
<xsd:documentation>
Reference to users that should execute operations on manual resources.
It may point to user or organization. (Currently only users are supported.)
It may point to user, role (only role members) or organization (only direct org. members).
If more than one operator is specified they are considered equivalent.
</xsd:documentation>
<xsd:appinfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,31 @@ private PrismObject<CaseType> addCase(String operation, String description, Stri
ResourceBusinessConfigurationType businessConfiguration = resource.asObjectable().getBusiness();
List<ObjectReferenceType> operators = new ArrayList<>();
if (businessConfiguration != null) {
operators.addAll(businessConfiguration.getOperatorRef());
businessConfiguration.getOperatorRef().stream().forEach((ObjectReferenceType operatorRef) -> {

if (operatorRef.getType().equals(RoleType.COMPLEX_TYPE)
|| operatorRef.getType().equals(OrgType.COMPLEX_TYPE)) {
ObjectQuery membersQuery = getPrismContext().queryFor(UserType.class)
.type(UserType.class)
.item(FocusType.F_ROLE_MEMBERSHIP_REF)
.ref(getPrismContext().itemFactory().createReferenceValue(operatorRef.getOid()))
.build();

List<PrismObject<UserType>> members = null;

try {
members = repositoryService.searchObjects(UserType.class, membersQuery, null, result);
} catch (SchemaException ex) {
LOGGER.error("Manual connector could not find members in operators role {}", ex);
}

if (members != null && !members.isEmpty()) {
operators.addAll(ObjectTypeUtil.objectListToReferences(members));
}
} else {
operators.add(operatorRef);
}
});
}
if (operators.isEmpty() && configuration.getDefaultAssignee() != null) {
ObjectQuery query = getPrismContext().queryFor(UserType.class)
Expand Down

0 comments on commit 94e4635

Please sign in to comment.