From 9c04bddce5b9f8db4788f8645c1fb21d0596bd15 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 18 Jan 2018 14:30:02 +0100 Subject: [PATCH 1/2] Fix MID-4396: Concurrent modification exception ScriptExpressionFactory.function collection was shared throughout midPoint, and was being added new elements occasionally. This caused CME and - maybe - also unwanted growth of this collection. --- .../expression/script/ScriptExpressionFactory.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/script/ScriptExpressionFactory.java b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/script/ScriptExpressionFactory.java index 1ea6201c908..164d3ab7e7f 100644 --- a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/script/ScriptExpressionFactory.java +++ b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/script/ScriptExpressionFactory.java @@ -15,9 +15,7 @@ */ package com.evolveum.midpoint.model.common.expression.script; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; +import java.util.*; import com.evolveum.midpoint.model.common.expression.functions.CustomFunctions; import com.evolveum.midpoint.model.common.expression.functions.FunctionLibrary; @@ -80,7 +78,7 @@ public void setEvaluators(Collection evaluators) { } public Collection getFunctions() { - return functions; + return Collections.unmodifiableCollection(functions); // MID-4396 } public void setFunctions(Collection functions) { @@ -95,7 +93,7 @@ public ScriptExpression createScriptExpression(ScriptExpressionEvaluatorType exp ScriptExpression expression = new ScriptExpression(getEvaluator(getLanguage(expressionType), shortDesc), expressionType); expression.setOutputDefinition(outputDefinition); expression.setObjectResolver(objectResolver); - expression.setFunctions(functions); + expression.setFunctions(new ArrayList<>(functions)); if (customFunctionLibraryCache != null) { expression.getFunctions().addAll(customFunctionLibraryCache.values()); @@ -112,7 +110,8 @@ public boolean handle(PrismObject object, OperationResult p customLibrary.setGenericFunctions(new CustomFunctions(object.asObjectable(), expressionFactory, result, task)); customLibrary.setNamespace(MidPointConstants.NS_FUNC_CUSTOM); customFunctionLibraryCache.put(object.getName().getOrig(), customLibrary); - return expression.getFunctions().add(customLibrary); + expression.getFunctions().add(customLibrary); + return true; } }; try { From 08e51f4d7916a9247dad1b9f608a04cc37423d53 Mon Sep 17 00:00:00 2001 From: kate Date: Thu, 18 Jan 2018 14:51:44 +0100 Subject: [PATCH 2/2] org members ui auths --- .../web/page/admin/users/component/OrgMemberPanel.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/OrgMemberPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/OrgMemberPanel.java index b1168c15f60..0b75568f60b 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/OrgMemberPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/OrgMemberPanel.java @@ -480,7 +480,7 @@ private void deleteMemberConfirmPerformed(QueryScope scope, QName relation, Ajax private List createManagersHeaderInlineMenu() { List headerMenuItems = new ArrayList<>(); - if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_ADD_MEMBER_ACTION_URI)) { + if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_ADD_ORG_MEMBER_ACTION_URI)) { headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.createManager"), false, new HeaderMenuAction(this) { private static final long serialVersionUID = 1L; @@ -492,7 +492,7 @@ public void onClick(AjaxRequestTarget target) { })); } - if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_ASSIGN_MEMBER_ACTION_URI)) { + if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_ASSIGN_ORG_MEMBER_ACTION_URI)) { headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.addManagers"), false, new HeaderMenuAction(this) { private static final long serialVersionUID = 1L; @@ -516,7 +516,7 @@ public void onClick(AjaxRequestTarget target) { })); } - if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_RECOMPUTE_MEMBER_ACTION_URI)) { + if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_RECOMPUTE_ORG_MEMBER_ACTION_URI)) { headerMenuItems .add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.recomputeManagersAll"), false, new HeaderMenuAction(this) {