Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Apr 1, 2020
2 parents 9921e3d + 983bad0 commit 107139b
Show file tree
Hide file tree
Showing 13 changed files with 4,264 additions and 4,166 deletions.
Expand Up @@ -1996,8 +1996,10 @@ private void createSelfServiceMenu(SideBarMenuItem menu) {
}

//GDPR feature.. temporary disabled MID-4281
// addMainMenuItem(menu, GuiStyleConstants.CLASS_ICON_CONSENT, "PageAdmin.menu.consent",
// PageSelfConsents.class);
if (WebModelServiceUtils.isEnableExperimentalFeature(this)) {
addMainMenuItem(menu, GuiStyleConstants.CLASS_ICON_CONSENT, "PageAdmin.menu.consent",
PageSelfConsents.class);
}
}

private void createAdditionalMenu(SideBarMenuItem menu) {
Expand Down
Expand Up @@ -112,7 +112,7 @@ protected PrismPropertyWrapper<String> createWrapper(PrismContainerValueWrapper<

private String normalizeHandler(String handler) {
handler = StringUtils.remove(handler, "-3");
handler = StringUtils.removeStart(handler, "http://").replace("-", "/").replace("#", "/");
handler = StringUtils.removeStart(handler, "http://midpoint.evolveum.com/xml/ns/public/").replace("-", "/").replace("#", "/");
String[] split = handler.split("/");
handler = "TaskHandlerSelector." + StringUtils.join(split, ".");
return handler;
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -7,8 +7,12 @@
package com.evolveum.midpoint.web.component.assignment;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.schema.constants.ObjectTypes;

import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
Expand All @@ -22,6 +26,8 @@
import com.evolveum.midpoint.web.component.data.column.CheckBoxColumn;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;

import javax.xml.namespace.QName;

public class GdprAssignmentPanel extends AbstractRoleAssignmentPanel {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -79,6 +85,11 @@ public Boolean getObject() {
// super.addSelectedAssignmentsPerformed(target, assignmentsList, SchemaConstants.ORG_CONSENT, kind, intent);
// }

@Override
protected QName getPredefinedRelation() {
return SchemaConstants.ORG_CONSENT;
}

protected ObjectQuery createObjectQuery() {
return getParentPage().getPrismContext().queryFor(AssignmentType.class)
.block()
Expand All @@ -87,4 +98,9 @@ protected ObjectQuery createObjectQuery() {
.endBlock()
.build();
}

@Override
protected List<ObjectTypes> getObjectTypesList() {
return Arrays.asList(ObjectTypes.ROLE, ObjectTypes.ORG, ObjectTypes.SERVICE);
}
}
Expand Up @@ -6,6 +6,15 @@
*/
package com.evolveum.midpoint.web.component.assignment;

import com.evolveum.midpoint.prism.delta.ObjectDelta;

import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.security.util.SecurityUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -34,6 +43,8 @@ public class SelfConsentPanel extends BasePanel<AssignmentType> {

private static final long serialVersionUID = 1L;

private static final transient Trace LOGGER = TraceManager.getTrace(SelfConsentPanel.class);

private static final String ID_DISPLAY_NAME = "displayName";
private static final String ID_DESCRIPTION = "description";
private static final String ID_CONSENT_ICON = "consentIcon";
Expand All @@ -45,6 +56,7 @@ public class SelfConsentPanel extends BasePanel<AssignmentType> {

private static final String DOT_CLASS = SelfConsentPanel.class.getSimpleName() + ".";
private static final String OPERATION_LOAD_TARGET = DOT_CLASS + "loadTargetRef";
private static final String OPERATION_SAVE_CONSENT_DECISION = DOT_CLASS + "saveCOnsentDecision";
// private PageBase parentPage;

public SelfConsentPanel(String id, IModel<AssignmentType> model, PageBase parentPage) {
Expand Down Expand Up @@ -92,6 +104,7 @@ private void initLayout(final AbstractRoleType abstractRole) {
@Override
public void onClick(AjaxRequestTarget target) {
SelfConsentPanel.this.getModelObject().setLifecycleState(SchemaConstants.LIFECYCLE_FAILED);
saveConsentDecision(target, SchemaConstants.LIFECYCLE_FAILED);
target.add(SelfConsentPanel.this);
}
};
Expand All @@ -105,6 +118,7 @@ public void onClick(AjaxRequestTarget target) {
@Override
public void onClick(AjaxRequestTarget target) {
SelfConsentPanel.this.getModelObject().setLifecycleState(SchemaConstants.LIFECYCLE_ACTIVE);
saveConsentDecision(target, SchemaConstants.LIFECYCLE_ACTIVE);
target.add(SelfConsentPanel.this);
}
};
Expand All @@ -118,6 +132,7 @@ public void onClick(AjaxRequestTarget target) {
@Override
public void onClick(AjaxRequestTarget target) {
SelfConsentPanel.this.getModelObject().setLifecycleState(SchemaConstants.LIFECYCLE_FAILED);
saveConsentDecision(target, SchemaConstants.LIFECYCLE_FAILED);
target.add(SelfConsentPanel.this);
}
};
Expand All @@ -126,6 +141,23 @@ public void onClick(AjaxRequestTarget target) {

}

protected void saveConsentDecision(AjaxRequestTarget target, String newLifecycleState) {
OperationResult result = new OperationResult(OPERATION_SAVE_CONSENT_DECISION);
try {
ObjectDelta<UserType> delta = getPageBase().getPrismContext().deltaFor(UserType.class)
.property(ItemPath.create(getModelObject().asPrismContainerValue().getPath(), AssignmentType.F_LIFECYCLE_STATE))
.replace(newLifecycleState).asObjectDelta(SecurityUtils.getPrincipalUser().getOid());
WebModelServiceUtils.save(delta, result, getPageBase());
} catch (SchemaException e) {
LOGGER.error("Cannot save consent decision {}, reason: {}", newLifecycleState, e.getMessage(), e);
result.recordFatalError("Failed to save consent decision, " + e.getMessage());
}

result.computeStatusIfUnknown();
getPageBase().showResult(result, false);
target.add(getPageBase().getFeedbackPanel());
}

private VisibleEnableBehaviour createActiveConsentBehaviour() {
return new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
Expand Down
Expand Up @@ -18,7 +18,7 @@
<div wicket:id="policyRuleTypeAssignments" />
<div wicket:id="entitlementAssignments" />
<div wicket:id="focusMappingAssignments" />
<!--<div wicket:id="consentAssignments" />-->
<div wicket:id="consentAssignments" />
<div wicket:id="showIndirectAssignmentsButton" style="margin-left: 30px;"/>
</div>
<div wicket:id="assignmentsPanel"/>
Expand Down

0 comments on commit 107139b

Please sign in to comment.