Skip to content

Commit

Permalink
Move approval request limit to a better place
Browse files Browse the repository at this point in the history
See MID-4697.

(cherry picked from commit 409ffd0)
  • Loading branch information
mederly committed Jul 26, 2018
1 parent 99537be commit 4c3d99c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
Expand Up @@ -126,14 +126,20 @@ private static void applyAdminGuiConfiguration(AdminGuiConfigurationType composi
composite.setFeedbackMessagesHook(adminGuiConfiguration.getFeedbackMessagesHook().clone());
}

if (adminGuiConfiguration.getAssignmentApprovalRequestLimit() != null) {
if (composite.getAssignmentApprovalRequestLimit() != null) {
if (adminGuiConfiguration.getRoleManagement() != null &&
adminGuiConfiguration.getRoleManagement().getAssignmentApprovalRequestLimit() != null) {
if (composite.getRoleManagement() != null && composite.getRoleManagement().getAssignmentApprovalRequestLimit() != null) {
// the greater value wins (so it is possible to give an exception to selected users)
composite.setAssignmentApprovalRequestLimit(Math.max(
adminGuiConfiguration.getAssignmentApprovalRequestLimit(),
composite.getAssignmentApprovalRequestLimit()));
Integer newValue = Math.max(
adminGuiConfiguration.getRoleManagement().getAssignmentApprovalRequestLimit(),
composite.getRoleManagement().getAssignmentApprovalRequestLimit());
composite.getRoleManagement().setAssignmentApprovalRequestLimit(newValue);
} else {
composite.setAssignmentApprovalRequestLimit(adminGuiConfiguration.getAssignmentApprovalRequestLimit());
if (composite.getRoleManagement() == null) {
composite.setRoleManagement(new AdminGuiConfigurationRoleManagementType());
}
composite.getRoleManagement().setAssignmentApprovalRequestLimit(
adminGuiConfiguration.getRoleManagement().getAssignmentApprovalRequestLimit());
}
}
}
Expand Down
Expand Up @@ -12814,7 +12814,6 @@
<xsd:annotation>
<xsd:documentation>
Administration GUI configuration.
Note: This complexType is NOT a container. We need to guarantee ordering of some sub-items (e.g. links)
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
Expand Down Expand Up @@ -12968,18 +12967,44 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="roleManagement" type="tns:AdminGuiConfigurationRoleManagementType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<p>
User-specific role management configuration.
</p>
</xsd:documentation>
<xsd:appinfo>
<a:since>3.7.3</a:since>
<a:since>3.8.1</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AdminGuiConfigurationRoleManagementType">
<xsd:annotation>
<xsd:documentation>
Role management features that are potentially user-specific i.e. assigned as part of GUI configuration.
</xsd:documentation>
<xsd:appinfo>
<a:container/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="assignmentApprovalRequestLimit" type="xsd:int" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<p>
How many assignment approvals (add/delete/modify) can be requested via any given operation?
EXPERIMENTAL. TEMPORARY. Just to validate the concept.
This parameter is checked by the model namely in the workflow hook. It should be eventually moved
to a more appropriate place, not related to the GUI.
</p>
</xsd:documentation>
<xsd:appinfo>
<a:since>3.7.3</a:since>
<a:since>3.8.1</a:since>
<a:experimental>true</a:experimental>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
Expand Down
Expand Up @@ -116,7 +116,8 @@ void extractAssignmentBasedInstructions(ObjectTreeDeltas<?> objectTreeDeltas, Pr
int instructionsAdded = instructions.size() - instructionsBefore;
LOGGER.trace("Assignment-related approval instructions: {}", instructionsAdded);
AdminGuiConfigurationType adminGuiConfiguration = modelInteractionService.getAdminGuiConfiguration(ctx.taskFromModel, result);
Integer limit = adminGuiConfiguration.getAssignmentApprovalRequestLimit();
Integer limit = adminGuiConfiguration.getRoleManagement() != null ?
adminGuiConfiguration.getRoleManagement().getAssignmentApprovalRequestLimit() : null;
LOGGER.trace("Allowed approval instructions: {}", limit);
if (limit != null && instructionsAdded > limit) {
// TODO think about better error reporting
Expand Down

0 comments on commit 4c3d99c

Please sign in to comment.