Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support-3.9' into support-3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Dec 6, 2018
2 parents 57d40b3 + df8663d commit 617516e
Show file tree
Hide file tree
Showing 44 changed files with 3,193 additions and 2,583 deletions.
Expand Up @@ -131,4 +131,8 @@ protected boolean isObjectListPanelVisible(){
}

protected abstract ObjectTypes getObjectType();

protected boolean isInducement(){
return false;
}
}
Expand Up @@ -23,6 +23,7 @@
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.TabbedPanel;
import com.evolveum.midpoint.web.component.dialog.Popupable;
import com.evolveum.midpoint.web.component.prism.ContainerWrapper;
import com.evolveum.midpoint.web.component.util.EnableBehaviour;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
Expand Down Expand Up @@ -134,10 +135,10 @@ protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableB
protected ObjectTypes getObjectType(){
return ObjectTypes.ROLE;
}

@Override
protected <O extends FocusType> PrismObject<O> getTargetedAssignemntObject() {
return AssignmentPopup.this.getTargetedObject();
protected ContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return AssignmentPopup.this.getAssignmentWrapperModel();
}
};
}
Expand Down Expand Up @@ -174,10 +175,10 @@ protected ObjectTypes getObjectType(){
protected List<OrgType> getPreselectedObjects(){
return selectedOrgsList;
}

@Override
protected <O extends FocusType> PrismObject<O> getTargetedAssignemntObject() {
return AssignmentPopup.this.getTargetedObject();
protected ContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return AssignmentPopup.this.getAssignmentWrapperModel();
}
};
}
Expand Down Expand Up @@ -209,10 +210,10 @@ protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableB
protected List<OrgType> getPreselectedObjects(){
return selectedOrgsList;
}

@Override
protected <O extends FocusType> PrismObject<O> getTargetedAssignemntObject() {
return AssignmentPopup.this.getTargetedObject();
protected ContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return AssignmentPopup.this.getAssignmentWrapperModel();
}
};
}
Expand Down Expand Up @@ -245,8 +246,8 @@ protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableB
}

@Override
protected <O extends FocusType> PrismObject<O> getTargetedAssignemntObject() {
return AssignmentPopup.this.getTargetedObject();
protected ContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return AssignmentPopup.this.getAssignmentWrapperModel();
}

};
Expand Down Expand Up @@ -286,10 +287,10 @@ public String getCount() {
return tabs;
}

protected <F extends FocusType> PrismObject<F> getTargetedObject(){
return null;
protected ContainerWrapper<AssignmentType> getAssignmentWrapperModel(){
return null;
}

private boolean isTabVisible(ObjectTypes objectType){
List<ObjectTypes> availableObjectTypesList = getAvailableObjectTypesList();
return availableObjectTypesList == null || availableObjectTypesList.size() == 0 || availableObjectTypesList.contains(objectType);
Expand Down
Expand Up @@ -30,7 +30,10 @@
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.assignment.AssignmentPanel;
import com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel;
import com.evolveum.midpoint.web.component.prism.ContainerWrapper;
import com.evolveum.midpoint.web.component.prism.ObjectWrapper;
import com.evolveum.midpoint.web.security.SecurityUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AreaCategoryType;
Expand Down Expand Up @@ -100,31 +103,37 @@ protected ObjectQuery addFilterToContentQuery(ObjectQuery query){
LOGGER.debug("Loading roles which the current user has right to assign");
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_ASSIGNABLE_ROLES);
OperationResult result = task.getResult();
ObjectFilter filter = null;
try {
ModelInteractionService mis = getPageBase().getModelInteractionService();
RoleSelectionSpecification roleSpec =
mis.getAssignableRoleSpecification(getTargetedAssignemntObject(), (Class<AbstractRoleType>) getObjectType().getClassDefinition(), task, result);
filter = roleSpec.getFilter();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load available roles", ex);
result.recordFatalError("Couldn't load available roles", ex);
} finally {
result.recomputeStatus();
}
if (!result.isSuccess() && !result.isHandledError()) {
getPageBase().showResult(result);
}

ObjectFilter filter = WebComponentUtil.getAssignableRolesFilter(getTargetedAssignemntObject(), (Class<AbstractRoleType>) getObjectType().getClassDefinition(),
isInducement() ? WebComponentUtil.AssignmentOrder.INDUCEMENT : WebComponentUtil.AssignmentOrder.ASSIGNMENT, result, task, getPageBase());
if (query == null){
query = new ObjectQuery();
}
query.addFilter(filter);
return query;
}


protected boolean isInducement(){
ContainerWrapper<AssignmentType> assignmentWrapper = getAssignmentWrapperModel();
if (assignmentWrapper != null && assignmentWrapper.getPath() != null && assignmentWrapper.getPath().containsName(AbstractRoleType.F_INDUCEMENT)){
return true;
}
return false;
}

protected <O extends FocusType> PrismObject<O> getTargetedAssignemntObject() {
return null;
ContainerWrapper<AssignmentType> assignmentWrapper = getAssignmentWrapperModel();
if (assignmentWrapper == null){
return null;
}
ObjectWrapper<O> w = assignmentWrapper.getObjectWrapper();
if (w == null) {
return null;
}
return w.getObject();
}

protected ContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return null;
}

@Override
Expand Down
Expand Up @@ -63,6 +63,11 @@ protected boolean isAssignButtonVisible(){
protected List<OrgType> getPreselectedOrgsList(){
return getPreselectedObjects();
}

@Override
protected boolean isInducement(){
return OrgTreeAssignmentPopupTabPanel.this.isInducement();
}
};
orgTreePanel.setOutputMarkupId(true);
add(orgTreePanel);
Expand Down
Expand Up @@ -62,6 +62,11 @@ protected List<OrgType> getPreselectedOrgsList(){
protected boolean isAssignButtonVisible(){
return false;
}

@Override
protected boolean isInducement(){
return OrgTreeMemberPopupTabPanel.this.isInducement();
}
};
orgTreePanel.setOutputMarkupId(true);
add(orgTreePanel);
Expand Down
Expand Up @@ -445,21 +445,8 @@ protected ObjectQuery addFilterToContentQuery(ObjectQuery query) {
LOGGER.debug("Loading roles which the current user has right to assign");
Task task = TypedAssignablePanel.this.getPageBase().createSimpleTask(OPERATION_LOAD_ASSIGNABLE_ROLES);
OperationResult result = task.getResult();
ObjectFilter filter = null;
try {
ModelInteractionService mis = TypedAssignablePanel.this.getPageBase().getModelInteractionService();
RoleSelectionSpecification roleSpec =
mis.getAssignableRoleSpecification(SecurityUtils.getPrincipalUser().getUser().asPrismObject(), AbstractRoleType.class, task, result);
filter = roleSpec.getFilter();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load available roles", ex);
result.recordFatalError("Couldn't load available roles", ex);
} finally {
result.recomputeStatus();
}
if (!result.isSuccess() && !result.isHandledError()) {
TypedAssignablePanel.this.getPageBase().showResult(result);
}
ObjectFilter filter = WebComponentUtil.getAssignableRolesFilter(SecurityUtils.getPrincipalUser().getUser().asPrismObject(), AbstractRoleType.class,
WebComponentUtil.AssignmentOrder.ASSIGNMENT, result, task, TypedAssignablePanel.this.getPageBase());
if (query == null){
query = new ObjectQuery();
}
Expand Down
Expand Up @@ -257,6 +257,22 @@ public final class WebComponentUtil {

}

public enum AssignmentOrder{

ASSIGNMENT(0),
INDUCEMENT(1);

private int order;

AssignmentOrder(int order){
this.order = order;
}

public int getOrder() {
return order;
}
}

public static String nl2br(String text) {
if (text == null) {
return null;
Expand Down Expand Up @@ -2862,14 +2878,14 @@ public static void setStaticallyProvidedRelationRegistry(RelationRegistry static
WebComponentUtil.staticallyProvidedRelationRegistry = staticallyProvidedRelationRegistry;
}

public static ObjectFilter getAssignableRolesFilter(PrismObject<? extends FocusType> focusObject, Class<? extends AbstractRoleType> type,
public static ObjectFilter getAssignableRolesFilter(PrismObject<? extends FocusType> focusObject, Class<? extends AbstractRoleType> type, AssignmentOrder assignmentOrder,
OperationResult result, Task task, PageBase pageBase) {
ObjectFilter filter = null;
LOGGER.debug("Loading objects which can be assigned");
try {
ModelInteractionService mis = pageBase.getModelInteractionService();
RoleSelectionSpecification roleSpec =
mis.getAssignableRoleSpecification(focusObject, type, task, result);
mis.getAssignableRoleSpecification(focusObject, type, assignmentOrder.getOrder(), task, result);
filter = roleSpec.getFilter();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load available roles", ex);
Expand Down
Expand Up @@ -167,13 +167,9 @@ protected List<ObjectTypes> getAvailableObjectTypesList(){
}

@Override
protected <F extends FocusType> PrismObject<F> getTargetedObject() {
ObjectWrapper<F> w = AbstractRoleAssignmentPanel.this.getModelObject().getObjectWrapper();
if (w == null) {
return null;
}
return w.getObject();
}
protected ContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return AbstractRoleAssignmentPanel.this.getModelObject();
}

};
popupPanel.setOutputMarkupId(true);
Expand Down
Expand Up @@ -200,9 +200,14 @@ private ObjectFilter getAssignableItemsFilter(){
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_ASSIGNABLE_ITEMS);
OperationResult result = task.getResult();
return WebComponentUtil.getAssignableRolesFilter(getAssignmentOwnerObject().asPrismObject(), OrgType.class,
isInducement() ? WebComponentUtil.AssignmentOrder.INDUCEMENT : WebComponentUtil.AssignmentOrder.ASSIGNMENT,
result, task, getPageBase());
}

protected boolean isInducement(){
return false;
}

protected <F extends FocusType> F getAssignmentOwnerObject(){
return null;
}
Expand Down
Expand Up @@ -310,7 +310,7 @@ private ObjectFilter getAssignableRolesFilter() {
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_ASSIGNABLE_ROLES);
OperationResult result = task.getResult();
return WebComponentUtil.getAssignableRolesFilter(getTargetUser().asPrismObject(), (Class) ObjectTypes.getObjectTypeClass(getQueryType()),
result, task, getPageBase());
WebComponentUtil.AssignmentOrder.ASSIGNMENT, result, task, getPageBase());
}

protected abstract QName getQueryType();
Expand Down
Expand Up @@ -47,6 +47,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationPhaseType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrderConstraintsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

import org.aopalliance.intercept.MethodInvocation;
Expand Down Expand Up @@ -295,8 +296,8 @@ public <O extends ObjectType> ObjectSecurityConstraints compileSecurityConstrain

@Override
public <T extends ObjectType, O extends ObjectType> ObjectFilter preProcessObjectFilter(String[] operationUrls, AuthorizationPhaseType phase,
Class<T> objectType, PrismObject<O> object, ObjectFilter origFilter, String limitAuthorizationAction, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {
return securityEnforcer.preProcessObjectFilter(operationUrls, phase, objectType, object, origFilter, limitAuthorizationAction, task, result);
Class<T> objectType, PrismObject<O> object, ObjectFilter origFilter, String limitAuthorizationAction, List<OrderConstraintsType> paramOrderConstraints, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {
return securityEnforcer.preProcessObjectFilter(operationUrls, phase, objectType, object, origFilter, limitAuthorizationAction, paramOrderConstraints, task, result);
}

@Override
Expand Down
Expand Up @@ -1070,6 +1070,7 @@ PageAccounts.total=Total
PageAccounts.unlinked=Unlinked
PageAccounts.unmatched=Unmatched
PageAccount.title=Account '{0}' on '{1}'
PageAccount.tab.details=Details
pageAdmin.certification=Certification
pageAdmin.certification.description=Certifications, recertifications
pageAdmin.configuration=Configuration
Expand Down Expand Up @@ -3446,6 +3447,7 @@ roleMemberPanel.menu.removeAll=Remove all
roleMemberPanel.relation=Relation
chooseMemberForOrgPopup.otherTypesLabel=Others
AssignmentPanel.newAssignmentParameters=Parameters
AssignmentPanel.allLabel=All
SearchPanel.more=More...
SearchPanel.add=Add
SearchPanel.close=Close
Expand Down Expand Up @@ -4173,6 +4175,7 @@ AbstractRoleAssignmentPanel.relationLabel=Relation
AbstractRoleAssignmentPanel.relationKindIntentColumn=Relation or Kind/Intent
AbstractRoleAssignmentPanel.identifierLabel=Identifier
AbstractRoleMainPanel.inducedEntitlements=Induced entitlements
InducedEntitlements.value=Value
AbstractObjectMainPanel.editXmlButton=Edit raw
AbstractObjectMainPanel.confirmEditXmlRedirect=Your local changes will be lost. Do you really want to redirect?
CertCampaignStateFilter.ALL=All campaign states
Expand Down

0 comments on commit 617516e

Please sign in to comment.