修改问题
这个提交包含在:
+23
@@ -0,0 +1,23 @@
|
||||
package cn.aixunkeji.datagov.dataproduct.api.reporting;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/** Authorized fixed dataset references; complete reads and non-snapshot previews remain distinct. */
|
||||
public interface ReportingDatasetDirectory {
|
||||
String VERSION = "1.0.0";
|
||||
String GROUP = "aixun-datagov-reporting-dataset";
|
||||
Page candidates(String keyword, int page, int size);
|
||||
Dataset resolve(String datasetId);
|
||||
default Rows read(Read request) { throw new IllegalStateException("REPORTING_READ_UNAVAILABLE"); }
|
||||
default Rows preview(Read request) { throw new IllegalStateException("REPORTING_PREVIEW_UNAVAILABLE"); }
|
||||
default void authorize(Read request,String authorizationSha256) { throw new IllegalStateException("REPORTING_AUTHORIZATION_UNAVAILABLE"); }
|
||||
record Filter(String field,String operator,List<String> values) implements Serializable { }
|
||||
record Read(Dataset dataset,List<String> columns,List<Filter> filters) implements Serializable { }
|
||||
record Rows(Dataset dataset,List<String> columns,List<java.util.Map<String,String>> rows,
|
||||
String authorizationSha256,String observedAt,boolean complete) implements Serializable { }
|
||||
record Field(String name, String label, String type, boolean nullable) implements Serializable { }
|
||||
record Dataset(String id, String code, String name, long version, String releaseId,
|
||||
String schemaVersionId, String schemaSha256, List<Field> fields) implements Serializable { }
|
||||
record Page(List<Dataset> rows, long total) implements Serializable { }
|
||||
}
|
||||
+6
-1
@@ -10,8 +10,13 @@ public interface NativeQueryPolicyApi {
|
||||
String GROUP="aixun-datagov-native-query-policy";
|
||||
Decision prepare(Request request);
|
||||
Receipt complete(Completion completion);
|
||||
/** Current authorization only; no query ticket or execution receipt is created. */
|
||||
default Decision authorize(Request request) { throw new IllegalStateException("POLICY_REAUTHORIZATION_UNAVAILABLE"); }
|
||||
record Request(long actorId,long departmentId,String tableId,long sourceVersion,long metadataRevision,
|
||||
String engineType,String action,List<String> sourceColumns,String querySha256,String purpose) implements Serializable {
|
||||
String engineType,String action,List<String> sourceColumns,String querySha256,String purpose,boolean completeRead) implements Serializable {
|
||||
public Request(long actorId,long departmentId,String tableId,long sourceVersion,long metadataRevision,String engineType,String action,List<String> sourceColumns,String querySha256,String purpose) {
|
||||
this(actorId,departmentId,tableId,sourceVersion,metadataRevision,engineType,action,sourceColumns,querySha256,purpose,false);
|
||||
}
|
||||
public Request(long actorId,long departmentId,String tableId,long sourceVersion,long metadataRevision,
|
||||
String engineType,String action,List<String> sourceColumns,String querySha256) {
|
||||
this(actorId,departmentId,tableId,sourceVersion,metadataRevision,engineType,action,sourceColumns,querySha256,"BI_QUERY");
|
||||
|
||||
+3
@@ -10,6 +10,9 @@ public interface DataSourceBiQueryApi {
|
||||
String VERSION = "1.0.0";
|
||||
String GROUP = "aixun-datagov-native-bi-query";
|
||||
AnalyticsQuery.Result query(Query query);
|
||||
/** One complete export statement; rejects overflow rather than returning a preview page. */
|
||||
default AnalyticsQuery.Result complete(Query query) { throw new IllegalStateException("COMPLETE_READ_UNAVAILABLE"); }
|
||||
default String authorizeComplete(Query query) { throw new IllegalStateException("COMPLETE_READ_AUTHORIZATION_UNAVAILABLE"); }
|
||||
record Query(long actorId, long departmentId, String tableId, List<String> allowedColumns,
|
||||
AnalyticsQuery.Plan plan,String action,AnalyticsExecution execution) implements Serializable {
|
||||
public Query(long actorId,long departmentId,String tableId,List<String> allowedColumns,AnalyticsQuery.Plan plan,String action){
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public interface PrivateBusinessFileOwner {
|
||||
String bytesSha256, long byteLength, String mime,
|
||||
String derivedFromFileId, String derivationPolicyVersion) implements Serializable {
|
||||
public Target {
|
||||
if (!java.util.Set.of("dataproduct", "governance", "dataops").contains(businessOwner)) throw invalid();
|
||||
if (!java.util.Set.of("dataproduct", "governance", "dataops", "integration").contains(businessOwner)) throw invalid();
|
||||
text(objectType); text(objectId); positive(artifactVersion); Objects.requireNonNull(use);
|
||||
text(purpose); text(recipientRef); text(originalName); sha(bytesSha256); positive(byteLength); text(mime);
|
||||
if (originalName.length() > 255 || originalName.contains("/") || originalName.contains("\\")
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package cn.aixunkeji.resource.api.assetupgrade;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.util.HexFormat;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/** The explicit 32-character MD5 attachment convention; never guesses a 16-character variant. */
|
||||
public final class ReportingAttachmentPolicy {
|
||||
private ReportingAttachmentPolicy() { }
|
||||
public static final int MAX_FILES = 50;
|
||||
public static final int MAX_BYTES = 8 * 1024 * 1024;
|
||||
private static final Map<String,String> TYPES = Map.ofEntries(
|
||||
Map.entry("pdf","application/pdf"),Map.entry("png","image/png"),
|
||||
Map.entry("jpg","image/jpeg"),Map.entry("jpeg","image/jpeg"),
|
||||
Map.entry("txt","text/plain"),Map.entry("csv","text/csv"),Map.entry("json","application/json"),
|
||||
Map.entry("doc","application/msword"),
|
||||
Map.entry("docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"));
|
||||
public static String originalName(String packagedName) {
|
||||
if(packagedName==null||!packagedName.matches("[A-F0-9]{32}_[^/\\\\\\p{Cntrl}]{1,160}")
|
||||
||packagedName.contains("..")||packagedName.contains(":"))throw invalid();
|
||||
String original=packagedName.substring(33);
|
||||
if(!original.equals(original.strip())||original.startsWith(".")||original.endsWith("."))throw invalid();
|
||||
mime(original);return original;
|
||||
}
|
||||
public static String mime(String original) {
|
||||
if(original==null||original.lastIndexOf('.')<1)throw invalid();
|
||||
String type=TYPES.get(original.substring(original.lastIndexOf('.')+1).toLowerCase(Locale.ROOT));
|
||||
if(type==null)throw invalid();return type;
|
||||
}
|
||||
public static String md5(byte[] bytes) {
|
||||
try{return HexFormat.of().withUpperCase().formatHex(MessageDigest.getInstance("MD5").digest(bytes));}
|
||||
catch(java.security.NoSuchAlgorithmException e){throw new IllegalStateException(e);}
|
||||
}
|
||||
public static void verify(String packagedName,byte[] bytes) {
|
||||
originalName(packagedName);
|
||||
if(bytes==null||bytes.length==0||bytes.length>MAX_BYTES||!packagedName.startsWith(md5(bytes)+"_"))throw invalid();
|
||||
}
|
||||
private static IllegalArgumentException invalid(){return new IllegalArgumentException("REPORTING_ATTACHMENT_INVALID");}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户