Skip to content

Commit b5f8a0a

Browse files
authored
Merge branch 'master' into ref-theme-config-logo
2 parents 08bdf57 + 0641aa4 commit b5f8a0a

File tree

18 files changed

+620
-47
lines changed

18 files changed

+620
-47
lines changed

datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/resolvers/files/GetPresignedUploadUrlResolver.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,24 @@ private void validateInput(final QueryContext context, final GetPresignedUploadU
8585
private void validateInputForAssetDocumentationScenario(
8686
final QueryContext context, final GetPresignedUploadUrlInput input) {
8787
String assetUrn = input.getAssetUrn();
88+
String schemaFieldUrn = input.getSchemaFieldUrn();
8889

8990
if (assetUrn == null) {
9091
throw new IllegalArgumentException("assetUrn is required for ASSET_DOCUMENTATION scenario");
9192
}
9293

93-
if (!DescriptionUtils.isAuthorizedToUpdateDescription(context, UrnUtils.getUrn(assetUrn))) {
94-
throw new AuthorizationException("Unauthorized to edit documentation for asset: " + assetUrn);
94+
// FYI: for schema field we have to apply another rules to check permissions
95+
if (schemaFieldUrn != null) {
96+
if (!DescriptionUtils.isAuthorizedToUpdateFieldDescription(
97+
context, UrnUtils.getUrn(assetUrn))) {
98+
throw new AuthorizationException(
99+
"Unauthorized to edit documentation for schema field: " + schemaFieldUrn);
100+
}
101+
} else {
102+
if (!DescriptionUtils.isAuthorizedToUpdateDescription(context, UrnUtils.getUrn(assetUrn))) {
103+
throw new AuthorizationException(
104+
"Unauthorized to edit documentation for asset: " + assetUrn);
105+
}
95106
}
96107
}
97108

datahub-graphql-core/src/main/resources/files.graphql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,17 @@ input GetPresignedUploadUrlInput {
2727
The scenario for the upload (e.g., ASSET_DOCUMENTATION, PROFILE_IMAGE).
2828
"""
2929
scenario: UploadDownloadScenario!
30+
3031
"""
3132
The URN of the asset associated with the upload (required when scenario is ASSET_DOCUMENTATION).
3233
"""
3334
assetUrn: String
3435

36+
"""
37+
The dataset schema field this file is referenced by
38+
"""
39+
schemaFieldUrn: String
40+
3541
"""
3642
Optional content type of file e.g. "application/pdf"
3743
"""

0 commit comments

Comments
 (0)