From b317a9030ec63d0fc3e71c91feff5be198f9d4b5 Mon Sep 17 00:00:00 2001 From: Raj Tekal Date: Tue, 25 Jul 2023 16:32:34 -0400 Subject: [PATCH 1/2] CreatedActor when not present --- .../datahub/graphql/types/join/mappers/JoinMapper.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/join/mappers/JoinMapper.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/join/mappers/JoinMapper.java index bf0b80e0f8a9f..fb321959637f7 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/join/mappers/JoinMapper.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/join/mappers/JoinMapper.java @@ -84,18 +84,17 @@ private void mapJoinKey(@Nonnull Join join, @Nonnull DataMap datamap) { private void mapProperties(@Nonnull Join join, @Nonnull DataMap dataMap) { final JoinProperties joinProperties = new JoinProperties(dataMap); - if (joinProperties.getCreated().getActor() == null) { - throw new RuntimeException("Failed to get entity"); - } join.setProperties(com.linkedin.datahub.graphql.generated.JoinProperties.builder() .setName(joinProperties.getName()) .setDatasetA(createPartialDataset(joinProperties.getDatasetA())) .setDatasetB(createPartialDataset(joinProperties.getDatasetB())) .setJoinFieldMappings(mapJoinFieldMappings(joinProperties)) - .setCreatedActor(UrnToEntityMapper.map(joinProperties.getCreated().getActor())) .setCreatedTime(joinProperties.hasCreated() && joinProperties.getCreated().getTime() > 0 ? joinProperties.getCreated().getTime() : 0) .build()); + if (joinProperties.hasCreated() && joinProperties.getCreated().hasActor()) { + join.getProperties().setCreatedActor(UrnToEntityMapper.map(joinProperties.getCreated().getActor())); + } } private Dataset createPartialDataset(@Nonnull Urn datasetUrn) { From f0af033f76e0d8f2224801efbf9aec385646ceaf Mon Sep 17 00:00:00 2001 From: Raj Tekal Date: Wed, 26 Jul 2023 21:45:42 -0400 Subject: [PATCH 2/2] Create_Join_Privilege should be part of COMMON_ENTITY_PRIVILEGES --- .../metadata/authorization/PoliciesConfig.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/metadata-utils/src/main/java/com/linkedin/metadata/authorization/PoliciesConfig.java b/metadata-utils/src/main/java/com/linkedin/metadata/authorization/PoliciesConfig.java index 877843365e97f..64f5c4da8f342 100644 --- a/metadata-utils/src/main/java/com/linkedin/metadata/authorization/PoliciesConfig.java +++ b/metadata-utils/src/main/java/com/linkedin/metadata/authorization/PoliciesConfig.java @@ -210,6 +210,11 @@ public class PoliciesConfig { "Edit Embedded Content", "The ability to edit the embedded content for an entity."); + public static final Privilege CREATE_JOIN_PRIVILEGE = Privilege.of( + "CREATE_ENTITY_JOIN", + "Create join", + "The ability to add join on a dataset."); + public static final List COMMON_ENTITY_PRIVILEGES = ImmutableList.of( VIEW_ENTITY_PAGE_PRIVILEGE, EDIT_ENTITY_TAGS_PRIVILEGE, @@ -222,7 +227,8 @@ public class PoliciesConfig { EDIT_ENTITY_DATA_PRODUCTS_PRIVILEGE, EDIT_ENTITY_DEPRECATION_PRIVILEGE, EDIT_ENTITY_PRIVILEGE, - DELETE_ENTITY_PRIVILEGE + DELETE_ENTITY_PRIVILEGE, + CREATE_JOIN_PRIVILEGE ); // Dataset Privileges @@ -512,10 +518,6 @@ public class PoliciesConfig { EDIT_USER_PROFILE_PRIVILEGE, EDIT_ENTITY_PRIVILEGE) ); - public static final Privilege CREATE_JOIN_PRIVILEGE = Privilege.of( - "CREATE_ENTITY_JOIN", - "Create join", - "The ability to add join on a dataset."); // Join Privileges public static final ResourcePrivileges JOIN_PRIVILEGES = ResourcePrivileges.of(