Skip to content

Commit

Permalink
Merge pull request #6287 from popa-raluca/classifications
Browse files Browse the repository at this point in the history
Remove entity proxy validation on classify/reclassify/declassify
  • Loading branch information
popa-raluca authored Mar 9, 2022
2 parents 0f90fd8 + f66d6e1 commit 5d7c9c1
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4317,24 +4317,32 @@ private void addLatestChangeToAnchor(EntityDetail anchorEntity,
catch (ClassificationErrorException newClassificationNeeded)
{
/*
* This is not an error - it just means that the classification is not present on the anchor entity.
*/
repositoryHandler.classifyEntity(localServerUserId,
null,
null,
anchorEntity.getGUID(),
anchorEntity,
guidParameterName,
anchorEntity.getType().getTypeDefName(),
OpenMetadataAPIMapper.LATEST_CHANGE_CLASSIFICATION_TYPE_GUID,
OpenMetadataAPIMapper.LATEST_CHANGE_CLASSIFICATION_TYPE_NAME,
ClassificationOrigin.ASSIGNED,
null,
newProperties,
false,
false,
new Date(),
methodName);
* This is not an error - it just means that the classification is not present on the anchor entity.
*/
try
{
repositoryHandler.classifyEntity(localServerUserId,
null,
null,
anchorEntity.getGUID(),
anchorEntity,
guidParameterName,
anchorEntity.getType().getTypeDefName(),
OpenMetadataAPIMapper.LATEST_CHANGE_CLASSIFICATION_TYPE_GUID,
OpenMetadataAPIMapper.LATEST_CHANGE_CLASSIFICATION_TYPE_NAME,
ClassificationOrigin.ASSIGNED,
null,
newProperties,
false,
false,
new Date(),
methodName);
}
catch (PropertyServerException e)
{
// Ignore exception, possibly a race condition - the entity is already classified
}

}
catch (InvalidParameterException | TypeErrorException error)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1090,48 +1090,48 @@ public void validateUserForEntityUpdate(String userId,


/**
* Tests for whether a specific user should have the right to add a classification to an entity instance
* Tests for whether a specific user should have the right to add a classification to an entity proxy
* within a repository.
*
* @param userId identifier of user
* @param metadataCollectionName configurable name of the metadata collection
* @param instance instance details
* @param instance instance proxy
* @param classificationName String name for the classification.
* @param properties list of properties for the classification.
* @throws UserNotAuthorizedException the user is not authorized to maintain instances
*/
@Override
public void validateUserForEntityClassificationAdd(String userId,
String metadataCollectionName,
EntityDetail instance,
EntityProxy instance,
String classificationName,
InstanceProperties properties) throws UserNotAuthorizedException
{
if (repositorySecurityConnector != null)
{
repositorySecurityConnector.validateUserForEntityClassificationAdd(userId,
metadataCollectionName,
instance,
classificationName,
properties);
metadataCollectionName,
instance,
classificationName,
properties);
}
}

/**
* Tests for whether a specific user should have the right to add a classification to an entity proxy
* Tests for whether a specific user should have the right to add a classification to an entity instance
* within a repository.
*
* @param userId identifier of user
* @param metadataCollectionName configurable name of the metadata collection
* @param instance instance proxy
* @param instance instance details
* @param classificationName String name for the classification.
* @param properties list of properties for the classification.
* @throws UserNotAuthorizedException the user is not authorized to maintain instances
*/
@Override
public void validateUserForEntityClassificationAdd(String userId,
String metadataCollectionName,
EntityProxy instance,
EntitySummary instance,
String classificationName,
InstanceProperties properties) throws UserNotAuthorizedException
{
Expand All @@ -1147,48 +1147,48 @@ public void validateUserForEntityClassificationAdd(String userId,


/**
* Tests for whether a specific user should have the right to update the classification for an entity instance
* Tests for whether a specific user should have the right to update the classification for an entity proxy
* within a repository.
*
* @param userId identifier of user
* @param metadataCollectionName configurable name of the metadata collection
* @param instance instance details
* @param instance instance proxy
* @param classificationName String name for the classification.
* @param properties list of properties for the classification.
* @throws UserNotAuthorizedException the user is not authorized to maintain instances
*/
@Override
public void validateUserForEntityClassificationUpdate(String userId,
String metadataCollectionName,
EntityDetail instance,
EntityProxy instance,
String classificationName,
InstanceProperties properties) throws UserNotAuthorizedException
{
if (repositorySecurityConnector != null)
{
repositorySecurityConnector.validateUserForEntityClassificationUpdate(userId,
metadataCollectionName,
instance,
classificationName,
properties);
metadataCollectionName,
instance,
classificationName,
properties);
}
}

/**
* Tests for whether a specific user should have the right to update the classification for an entity proxy
* Tests for whether a specific user should have the right to update the classification for an entity instance
* within a repository.
*
* @param userId identifier of user
* @param metadataCollectionName configurable name of the metadata collection
* @param instance instance proxy
* @param instance instance details
* @param classificationName String name for the classification.
* @param properties list of properties for the classification.
* @throws UserNotAuthorizedException the user is not authorized to maintain instances
*/
@Override
public void validateUserForEntityClassificationUpdate(String userId,
String metadataCollectionName,
EntityProxy instance,
EntitySummary instance,
String classificationName,
InstanceProperties properties) throws UserNotAuthorizedException
{
Expand All @@ -1202,20 +1202,21 @@ public void validateUserForEntityClassificationUpdate(String user
}
}


/**
* Tests for whether a specific user should have the right to delete a classification from an entity instance
* Tests for whether a specific user should have the right to delete a classification from an entity proxy
* within a repository.
*
* @param userId identifier of user
* @param metadataCollectionName configurable name of the metadata collection
* @param instance instance details
* @param instance instance proxy
* @param classificationName String name for the classification.
* @throws UserNotAuthorizedException the user is not authorized to maintain instances
*/
@Override
public void validateUserForEntityClassificationDelete(String userId,
String metadataCollectionName,
EntityDetail instance,
EntityProxy instance,
String classificationName) throws UserNotAuthorizedException
{
if (repositorySecurityConnector != null)
Expand All @@ -1228,19 +1229,19 @@ public void validateUserForEntityClassificationDelete(String user
}

/**
* Tests for whether a specific user should have the right to delete a classification from an entity proxy
* Tests for whether a specific user should have the right to delete a classification from an entity instance
* within a repository.
*
* @param userId identifier of user
* @param metadataCollectionName configurable name of the metadata collection
* @param instance instance proxy
* @param instance instance details
* @param classificationName String name for the classification.
* @throws UserNotAuthorizedException the user is not authorized to maintain instances
*/
@Override
public void validateUserForEntityClassificationDelete(String userId,
String metadataCollectionName,
EntityProxy instance,
EntitySummary instance,
String classificationName) throws UserNotAuthorizedException
{
if (repositorySecurityConnector != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ public void validateUserForEntityUpdate(String userId,
{
}


/**
* Tests for whether a specific user should have the right to add a classification to an entity instance
* within a repository.
Expand All @@ -273,13 +272,12 @@ public void validateUserForEntityUpdate(String userId,
@Override
public void validateUserForEntityClassificationAdd(String userId,
String metadataCollectionName,
EntityDetail instance,
EntitySummary instance,
String classificationName,
InstanceProperties properties)
{
}


/**
* Tests for whether a specific user should have the right to update the classification for an entity instance
* within a repository.
Expand All @@ -293,7 +291,7 @@ public void validateUserForEntityClassificationAdd(String userId,
@Override
public void validateUserForEntityClassificationUpdate(String userId,
String metadataCollectionName,
EntityDetail instance,
EntitySummary instance,
String classificationName,
InstanceProperties properties)
{
Expand All @@ -312,7 +310,7 @@ public void validateUserForEntityClassificationUpdate(String user
@Override
public void validateUserForEntityClassificationDelete(String userId,
String metadataCollectionName,
EntityDetail instance,
EntitySummary instance,
String classificationName)
{
}
Expand Down
Loading

0 comments on commit 5d7c9c1

Please sign in to comment.