Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DISC-367 : Update Glossary policy alias filtering query #3364

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import javax.inject.Inject;
import java.util.*;
import java.util.stream.Collectors;

import static org.apache.atlas.ESAliasRequestBuilder.ESAliasAction.ADD;
import static org.apache.atlas.repository.Constants.PERSONA_ENTITY_TYPE;
Expand All @@ -51,6 +52,7 @@
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 Down Expand Up @@ -207,10 +209,11 @@ private void personaPolicyToESDslClauses(List<AtlasEntity> policies,
terms.add(connectionQName);

} else if (getPolicyActions(policy).contains(ACCESS_READ_PERSONA_GLOSSARY)) {

for (String glossaryQName : assets) {
terms.add(glossaryQName);
allowClauseList.add(mapOf("wildcard", mapOf(QUALIFIED_NAME, "*@" + glossaryQName)));
List<String> glossaryQualifiedNames = assets.stream()
.peek(terms::add)
.collect(Collectors.toList());
if (!glossaryQualifiedNames.isEmpty()) {
allowClauseList.add(mapOf("terms", mapOf(GLOSSARY_QUALIFIED_NAME_ATTRIBUTE, glossaryQualifiedNames)));
nikhilbonte21 marked this conversation as resolved.
Show resolved Hide resolved
nikhilbonte21 marked this conversation as resolved.
Show resolved Hide resolved
}
} else if (getPolicyActions(policy).contains(ACCESS_READ_PERSONA_DOMAIN)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ 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";

Expand Down
Loading