Skip to content

Commit

Permalink
test: test abac issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sumandas0 committed Jan 18, 2024
1 parent 84f075d commit 8618b43
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on:
- development
- master
- staging
- lineageondemand
- test-at

jobs:
build:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,27 +170,27 @@ public ServicePolicies getPolicies(String serviceName, String pluginId, Long las
}
}

//Process abac based policies
String abacServiceName = (String) service.getAttribute(ATTR_SERVICE_ABAC_SERVICE);
if (StringUtils.isNotEmpty(abacServiceName)) {
AtlasEntityHeader abacService = getServiceEntity(abacServiceName);

if (abacService != null) {
allPolicies.addAll(getServicePolicies(abacService));

ServicePolicies.AbacPolicies abacPolicies = new ServicePolicies.AbacPolicies();

abacPolicies.setServiceName(abacServiceName);
abacPolicies.setPolicyUpdateTime(new Date());
abacPolicies.setServiceId(abacService.getGuid());
abacPolicies.setPolicyVersion(-1L);

String abacServiceDefName = String.format(RESOURCE_SERVICE_DEF_PATTERN, abacService.getAttribute(NAME));
abacPolicies.setServiceDef(getResourceAsObject(abacServiceDefName, RangerServiceDef.class));

servicePolicies.setAbacPolicies(abacPolicies);
}
}
// //Process abac based policies
// String abacServiceName = (String) service.getAttribute(ATTR_SERVICE_ABAC_SERVICE);
// if (StringUtils.isNotEmpty(abacServiceName)) {
// AtlasEntityHeader abacService = getServiceEntity(abacServiceName);
//
// if (abacService != null) {
// allPolicies.addAll(getServicePolicies(abacService));
//
// ServicePolicies.AbacPolicies abacPolicies = new ServicePolicies.AbacPolicies();
//
// abacPolicies.setServiceName(abacServiceName);
// abacPolicies.setPolicyUpdateTime(new Date());
// abacPolicies.setServiceId(abacService.getGuid());
// abacPolicies.setPolicyVersion(-1L);
//
// String abacServiceDefName = String.format(RESOURCE_SERVICE_DEF_PATTERN, abacService.getAttribute(NAME));
// abacPolicies.setServiceDef(getResourceAsObject(abacServiceDefName, RangerServiceDef.class));
//
// servicePolicies.setAbacPolicies(abacPolicies);
// }
// }

AtlasPerfMetrics.MetricRecorder recorderFilterPolicies = RequestContext.get().startMetricRecord("filterPolicies");
//filter out policies based on serviceName
Expand All @@ -202,7 +202,7 @@ public ServicePolicies getPolicies(String serviceName, String pluginId, Long las
try {
policiesA = allPolicies.stream().filter(x -> serviceName.equals(x.getService())).collect(Collectors.toList());
policiesB = allPolicies.stream().filter(x -> tagServiceName.equals(x.getService())).collect(Collectors.toList());
policiesC = allPolicies.stream().filter(x -> abacServiceName.equals(x.getService())).collect(Collectors.toList());
// policiesC = allPolicies.stream().filter(x -> abacServiceName.equals(x.getService())).collect(Collectors.toList());
}
catch (NullPointerException exception) {}

Expand Down

0 comments on commit 8618b43

Please sign in to comment.