Skip to content

Commit

Permalink
Check last edit time only for authpoliy
Browse files Browse the repository at this point in the history
Without this check, policy download API check could take the
Persona or Purpose update time to be last edit time
for which it will not find a policy since no policy
exist for this mistakenly considered timestamp.
  • Loading branch information
krsoninikhil committed Aug 13, 2024
1 parent fba51ff commit 5faba35
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions webapp/src/main/java/org/apache/atlas/web/rest/AuthREST.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,16 @@ private Long getLastEditTime(String serviceName, long lastUpdatedTime) {
dsl.put("sort", sortList);

parameters.setDsl(dsl);
Long lastEditTime = 0L;
Long lastEditTime = 0L; // this timestamp is used to verify if the found policies are synced with any policy create or update op on cassandra

try {
EntityAuditSearchResult result = auditRepository.searchEvents(parameters.getQueryString());
if (result != null) {
if (!CollectionUtils.isEmpty(result.getEntityAudits())) {
EntityAuditEventV2 lastAuditLog = result.getEntityAudits().get(0);
if (!EntityAuditEventV2.EntityAuditActionV2.getDeleteActions().contains(lastAuditLog.getAction())) {
if (!EntityAuditEventV2.EntityAuditActionV2.getDeleteActions().contains(lastAuditLog.getAction()) &&
lastAuditLog.getTypeName().equals(POLICY_ENTITY_TYPE)
) {
lastEditTime = lastAuditLog.getTimestamp();
} else {
LOG.info("ES_SYNC_FIX: {}: found delete action, so ignoring the last edit time: {}", serviceName, lastAuditLog.getTimestamp());
Expand Down

0 comments on commit 5faba35

Please sign in to comment.