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

Fix CREATE collection by member, evaluator API #2571

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -301,7 +301,10 @@ private static boolean validateResourcesForCreateEntity(List<RangerPolicy> resou

if ("entity".equals(resource)) {
String assetQualifiedName = (String) entity.getAttribute(QUALIFIED_NAME);
Optional<String> match = values.stream().filter(x -> assetQualifiedName.matches(x.replace("*", ".*"))).findFirst();
Optional<String> match = values.stream().filter(x -> assetQualifiedName.matches(x
.replace("{USER}", getCurrentUserName())
.replace("*", ".*")))
.findFirst();

if (!match.isPresent()) {
resourcesMatched = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ public List<AtlasEvaluatePolicyResponse> evaluatePolicies(List<AtlasEvaluatePoli
AtlasEntityAccessRequest entityAccessRequest = requestBuilder.build();

// AtlasAuthorizationUtils.verifyAccess(entityAccessRequest, entities.get(i).getAction() + "guid=" + entities.get(i).getEntityGuid());
verifyAccess(entities.get(i).getEntityGuid(), AtlasPrivilege.valueOf(entities.get(i).getAction()).getType());
if (ENTITY_CREATE.name().equals(action)) {
verifyAccess(new AtlasEntity(entityHeader), ENTITY_CREATE, "create entity: type=" + entityHeader.getTypeName());
} else {
verifyAccess(entities.get(i).getEntityGuid(), AtlasPrivilege.valueOf(entities.get(i).getAction()).getType());
}
response.add(new AtlasEvaluatePolicyResponse(entities.get(i).getTypeName(), entities.get(i).getEntityGuid(), entities.get(i).getAction(), entities.get(i).getEntityId(), true, null , entities.get(i).getBusinessMetadata()));
} catch (AtlasBaseException e) {
AtlasErrorCode code = e.getAtlasErrorCode();
Expand Down
Loading