diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java index 8fb5911db9..9972c7be37 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java @@ -1,6 +1,11 @@ package com.fr.design.mainframe.authority; import com.fr.base.CloneCollector; +import com.fr.base.Formula; +import com.fr.data.impl.NameDatabaseConnection; +import com.fr.data.impl.NameTableData; +import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.stable.FCloneable; import java.util.ArrayList; @@ -9,13 +14,24 @@ import java.util.List; public class AuthorityTargetObjectCollector extends CloneCollector { List targetObject = new ArrayList<>(); + public AuthorityTargetObjectCollector(FCloneable rootObject) { + super(rootObject); + } + @Override public void collect(Object object) { - targetObject.add(object); + if (object instanceof DSColumn || object instanceof Formula + || object instanceof NameDatabaseConnection || object instanceof NameTableData) { + targetObject.add(object); + } } - public List getTargetObject() { + public List collectTargetObject() { + CloneCollector.setCollector(this); + this.targetObject = new ArrayList<>(); + this.collect(); + CloneCollector.clearCollector(); return targetObject; } - + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java index 59257c6c96..b33f0665c9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java @@ -15,6 +15,7 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.user.UserAuthority; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -101,15 +102,14 @@ public class JTemplateAuthorityChecker { } private List getTargetObjects() { - AuthorityTargetObjectCollector authorityTargetObjectCollector = new AuthorityTargetObjectCollector(); - CloneCollector.setCollector(authorityTargetObjectCollector); + List targetObjects = new ArrayList<>(); try { - jTemplate.getTarget().clone(); - } catch (Exception ignore) { - + AuthorityTargetObjectCollector authorityTargetObjectCollector + = new AuthorityTargetObjectCollector(jTemplate.getTarget()); + targetObjects = authorityTargetObjectCollector.collectTargetObject(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); } - List targetObjects = authorityTargetObjectCollector.getTargetObject(); - CloneCollector.clearCollector(); return targetObjects; }