Skip to content

Commit

Permalink
fix: remove unwanted funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
sumandas0 committed Jun 5, 2024
1 parent a029480 commit b9b38ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,6 @@ public boolean updateAlias(AtlasEntity.AtlasEntityWithExtInfo accessControl, Atl
return true;
}

public void rebuildAlias(AtlasEntity.AtlasEntityWithExtInfo accessControl) throws AtlasBaseException {
String aliasName = getAliasName(accessControl.getEntity());

Map<String, Object> filter;

if (PERSONA_ENTITY_TYPE.equals(accessControl.getEntity().getTypeName())) {
filter = getFilterForPersona(accessControl);
} else {
filter = getFilterForPurpose(accessControl.getEntity());
}

ESAliasRequestBuilder requestBuilder = new ESAliasRequestBuilder();
requestBuilder.addAction(ADD, new AliasAction(getIndexNameFromAliasIfExists(VERTEX_INDEX_NAME), aliasName, filter));

graph.createOrUpdateESAlias(requestBuilder);
}

@Override
public boolean deleteAlias(String aliasName) throws AtlasBaseException {
graph.deleteESAlias(getIndexNameFromAliasIfExists(VERTEX_INDEX_NAME), aliasName);
Expand All @@ -178,17 +161,6 @@ private Map<String, Object> getFilterForPersona(AtlasEntity.AtlasEntityWithExtIn
return esClausesToFilter(allowClauseList);
}

private Map<String, Object> getFilterForPersona(AtlasEntity.AtlasEntityWithExtInfo persona) throws AtlasBaseException {
List<Map<String, Object>> allowClauseList = new ArrayList<>();

List<AtlasEntity> policies = getPolicies(persona);
if (CollectionUtils.isNotEmpty(policies)) {
personaPolicyToESDslClauses(policies, allowClauseList);
}

return esClausesToFilter(allowClauseList);
}

private Map<String, Object> getFilterForPurpose(AtlasEntity purpose) throws AtlasBaseException {

List<Map<String, Object>> allowClauseList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2716,10 +2716,6 @@ public void repairAccesscontrolAlias(String guid) throws AtlasBaseException {

AtlasAuthorizationUtils.verifyAccess(new AtlasEntityAccessRequest(typeRegistry, AtlasPrivilege.ENTITY_UPDATE, new AtlasEntityHeader(accesscontrolEntity.getEntity())));

if (accesscontrolEntity == null) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
}

// Validate accesscontrolEntity status
if (accesscontrolEntity.getEntity().getStatus() != ACTIVE) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_DELETED, guid);
Expand All @@ -2728,7 +2724,7 @@ public void repairAccesscontrolAlias(String guid) throws AtlasBaseException {
// Validate accesscontrolEntity type
String entityType = accesscontrolEntity.getEntity().getTypeName();
if (!PERSONA_ENTITY_TYPE.equals(entityType)) {
throw new AtlasBaseException(AtlasErrorCode.INVALID_OBJECT_ID, entityType);
throw new AtlasBaseException(AtlasErrorCode.OPERATION_NOT_SUPPORTED, entityType);
}

List<AtlasObjectId> policies = (List<AtlasObjectId>) accesscontrolEntity.getEntity().getRelationshipAttribute(REL_ATTR_POLICIES);
Expand All @@ -2737,7 +2733,7 @@ public void repairAccesscontrolAlias(String guid) throws AtlasBaseException {
}

// Rebuild alias
this.esAliasStore.rebuildAlias(accesscontrolEntity);
this.esAliasStore.updateAlias(accesscontrolEntity, null);

RequestContext.get().endMetricRecord(metric);
}
Expand Down

0 comments on commit b9b38ae

Please sign in to comment.