mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-27 08:44:49 +00:00
This reverts commit ba1e930910f304e1b590bbf785d64aa8d04c2953.
This commit is contained in:
parent
ba1e930910
commit
2f18a31a0f
@ -188,10 +188,6 @@ public final class CatalogExceptionMessage {
|
||||
return String.format("Team of type %s can't own entities. Only Team of type Group can own entities.", teamType);
|
||||
}
|
||||
|
||||
public static String invalidOwnerType(String entityType) {
|
||||
return String.format("Entity of type %s can't be the owner. Only Team of type Group or a User can own entities.", entityType);
|
||||
}
|
||||
|
||||
public static String failedToParse(String message) {
|
||||
return String.format("Failed to parse - %s", message);
|
||||
}
|
||||
|
||||
@ -639,7 +639,6 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
||||
prepare(entity, update);
|
||||
setFullyQualifiedName(entity);
|
||||
validateExtension(entity);
|
||||
validateOwner(entity.getOwner());
|
||||
// Domain is already validated
|
||||
}
|
||||
|
||||
@ -1580,7 +1579,6 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
||||
|
||||
public void updateOwner(T ownedEntity, EntityReference originalOwner, EntityReference newOwner) {
|
||||
// TODO inefficient use replace instead of delete and add and check for orig and new owners being the same
|
||||
validateOwner(newOwner);
|
||||
removeOwner(ownedEntity, originalOwner);
|
||||
storeOwner(ownedEntity, newOwner);
|
||||
}
|
||||
@ -1640,9 +1638,8 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
||||
if (owner == null) {
|
||||
return null;
|
||||
}
|
||||
if (!owner.getType().equals(Entity.TEAM) && !owner.getType().equals(USER)) {
|
||||
throw new IllegalArgumentException(CatalogExceptionMessage.invalidOwnerType(owner.getType()));
|
||||
} else if (owner.getType().equals(Entity.TEAM)) { // Entities can be only owned by team of type 'group'
|
||||
// Entities can be only owned by team of type 'group'
|
||||
if (owner.getType().equals(Entity.TEAM)) {
|
||||
Team team = Entity.getEntity(Entity.TEAM, owner.getId(), "", ALL);
|
||||
if (!team.getTeamType().equals(CreateTeam.TeamType.GROUP)) {
|
||||
throw new IllegalArgumentException(CatalogExceptionMessage.invalidTeamOwner(team.getTeamType()));
|
||||
|
||||
@ -1164,16 +1164,6 @@ public abstract class EntityResourceTest<T extends EntityInterface, K extends Cr
|
||||
fieldDeleted(change, FIELD_OWNER, USER1_REF);
|
||||
patchEntityAndCheck(entity, json, ADMIN_AUTH_HEADERS, MINOR_UPDATE, change);
|
||||
checkOwnerOwns(USER1_REF, entity.getId(), false);
|
||||
|
||||
// set random type as entity. Check if the ownership validate.
|
||||
T newEntity = entity;
|
||||
String newJson = JsonUtils.pojoToJson(newEntity);
|
||||
newEntity.setOwner(TEST_DEFINITION1.getEntityReference());
|
||||
fieldUpdated(change, FIELD_OWNER, TEST_DEFINITION1, USER1_REF);
|
||||
assertResponse(
|
||||
() -> patchEntity(newEntity.getId(), newJson, newEntity, ADMIN_AUTH_HEADERS),
|
||||
BAD_REQUEST,
|
||||
"Entity of type testDefinition can't be the owner. Only Team of type Group or a User can own entities.");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user