Skip to content

Commit

Permalink
Merge pull request #3366 from atlanhq/disc-367-glossary-filter
Browse files Browse the repository at this point in the history
nit: simplify and reuse the codebase
  • Loading branch information
sumandas0 authored Jul 24, 2024
2 parents 26b291b + 1d566de commit 2291cda
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import static org.apache.atlas.repository.util.AccessControlUtils.ACCESS_READ_PERSONA_GLOSSARY;
import static org.apache.atlas.repository.util.AccessControlUtils.ACCESS_READ_PERSONA_PRODUCT;
import static org.apache.atlas.repository.util.AccessControlUtils.ACCESS_READ_PERSONA_SUB_DOMAIN;
import static org.apache.atlas.repository.util.AccessControlUtils.GLOSSARY_QUALIFIED_NAME_ATTRIBUTE;
import static org.apache.atlas.repository.util.AccessControlUtils.getConnectionQualifiedNameFromPolicyAssets;
import static org.apache.atlas.repository.util.AccessControlUtils.getESAliasName;
import static org.apache.atlas.repository.util.AccessControlUtils.getIsAllowPolicy;
Expand All @@ -62,6 +61,7 @@
import static org.apache.atlas.repository.util.AccessControlUtils.getPolicyConnectionQN;
import static org.apache.atlas.repository.util.AccessControlUtils.getPurposeTags;
import static org.apache.atlas.repository.util.AtlasEntityUtils.mapOf;
import static org.apache.atlas.type.Constants.GLOSSARY_PROPERTY_KEY;


@Component
Expand Down Expand Up @@ -209,14 +209,11 @@ private void personaPolicyToESDslClauses(List<AtlasEntity> policies,
terms.add(connectionQName);

} else if (getPolicyActions(policy).contains(ACCESS_READ_PERSONA_GLOSSARY)) {
List<String> glossaryQualifiedNames = assets.stream()
.peek(terms::add)
.collect(Collectors.toList());
if (!glossaryQualifiedNames.isEmpty()) {
allowClauseList.add(mapOf("terms", mapOf(GLOSSARY_QUALIFIED_NAME_ATTRIBUTE, glossaryQualifiedNames)));
if (CollectionUtils.isNotEmpty(assets)) {
terms.addAll(assets);
allowClauseList.add(mapOf("terms", mapOf(QUALIFIED_NAME, assets)));
}
} else if (getPolicyActions(policy).contains(ACCESS_READ_PERSONA_DOMAIN)) {

for (String asset : assets) {
if(!isAllDomain(asset)) {
terms.add(asset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ public final class AccessControlUtils {
public static final String ACCESS_READ_PERSONA_METADATA = "persona-asset-read";
public static final String ACCESS_READ_PERSONA_GLOSSARY = "persona-glossary-read";
public static final String ACCESS_READ_PERSONA_DOMAIN = "persona-domain-read";

public static final String GLOSSARY_QUALIFIED_NAME_ATTRIBUTE = "__glossary";
public static final String ACCESS_READ_PERSONA_SUB_DOMAIN = "persona-domain-sub-domain-read";
public static final String ACCESS_READ_PERSONA_PRODUCT = "persona-domain-product-read";
public static final String ACCESS_READ_DOMAIN = "domain-entity-read";
Expand Down

0 comments on commit 2291cda

Please sign in to comment.