You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/03/05 07:58:17 UTC

[isis] branch master updated: ISIS-2877: action visibility: guard against missing action owner

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 6863113  ISIS-2877: action visibility: guard against missing action owner
6863113 is described below

commit 686311302b1f63dd1fe1e48a8f254c1498088835
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sat Mar 5 08:58:09 2022 +0100

    ISIS-2877: action visibility: guard against missing action owner
---
 .../isis/viewer/common/model/action/ActionFormUiModel.java     | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/ActionFormUiModel.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/ActionFormUiModel.java
index 6d165bd..af9f204 100644
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/ActionFormUiModel.java
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/ActionFormUiModel.java
@@ -25,6 +25,7 @@ import org.apache.isis.commons.collections.Can;
 import org.apache.isis.commons.internal.assertions._Assert;
 import org.apache.isis.core.metamodel.consent.Consent;
 import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
+import org.apache.isis.core.metamodel.consent.Veto;
 import org.apache.isis.core.metamodel.spec.ManagedObjects;
 import org.apache.isis.viewer.common.model.feature.ParameterUiModel;
 import org.apache.isis.viewer.common.model.mixin.HasTitle;
@@ -48,8 +49,15 @@ extends HasTitle, HasActionInteraction {
     // -- VISABILITY
 
     default Consent getVisibilityConsent() {
+
+        // guard against missing action owner
+        val actionOwner = getActionOwner();
+        if(ManagedObjects.isNullOrUnspecifiedOrEmpty(actionOwner)) {
+            return Veto.DEFAULT; // veto, so we don't render the action
+        }
+
         return getAction().isVisible(
-                getActionOwner(),
+                actionOwner,
                 InteractionInitiatedBy.USER,
                 Where.OBJECT_FORMS);
     }