Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public R<DsDetailVO> dsDetail(@RequestBody DsInfoIdParam dsInfoIdParam) {
@Override
protected DsDetailVO process() throws TaierDefineException {
Asserts.notNull(dsInfoIdParam.getDataInfoId(), "数据源Id不能为空");
DsInfo dsInfo = dsInfoService.dsInfoDetail(dsInfoIdParam.getDataInfoId());
DsInfo dsInfo = dsInfoService.dsInfoDetail(dsInfoIdParam.getDataInfoId(),dsInfoIdParam.getTenantId());
return DsDetailTransfer.INSTANCE.toInfoVO(dsInfo);
}
}.execute();
Expand All @@ -115,7 +115,7 @@ public R<Boolean> deleteById(@RequestBody DsInfoIdParam dsInfoIdParam) {
@Override
protected Boolean process() throws TaierDefineException {
Asserts.notNull(dsInfoIdParam.getDataInfoId(), "数据源Id不能为空");
return dsInfoService.delDsInfo(dsInfoIdParam.getDataInfoId());
return dsInfoService.delDsInfo(dsInfoIdParam.getDataInfoId(), dsInfoIdParam.getTenantId());
}
}.execute();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,41 @@ public DsInfo dsInfoDetail(Long dataInfoId) {
return dsInfo;
}

public DsInfo dsInfoDetail(Long dataInfoId, Long tenantId) {
DsInfo dsInfo = lambdaQuery()
.eq(DsInfo::getId, dataInfoId)
.eq(DsInfo::getTenantId, tenantId)
.one();

if (dsInfo == null) {
throw new TaierDefineException(ErrorCode.PERMISSION_LIMIT);
}

String dataJson = dsInfo.getDataJson();
JSONObject dataSourceJson = DataSourceUtils.getDataSourceJson(dataJson);
if (DataSourceUtils.judgeOpenKerberos(dataJson) && null == dataSourceJson.getString(FormNames.PRINCIPAL)) {
JSONObject kerberosConfig = dataSourceJson.getJSONObject(FormNames.KERBEROS_CONFIG);
dataSourceJson.put(FormNames.PRINCIPAL, kerberosConfig.getString(FormNames.PRINCIPAL));
}
if (DataSourceUtils.judgeOpenKerberos(dsInfo.getDataJson()) && dsInfo.getDataType().equals(DataSourceTypeEnum.KAFKA.getDataType())) {
//kafka开启了kerberos认证
dataSourceJson.put(FormNames.AUTHENTICATION, FormNames.KERBROS);
}
return dsInfo;
}

/**
* 删除一条数据源信息
*
* @param dataInfoId
* @return
*/
@Transactional(rollbackFor = Exception.class)
public Boolean delDsInfo(Long dataInfoId) {
public Boolean delDsInfo(Long dataInfoId, Long tenantId) {
DsInfo dsInfo = this.getOneById(dataInfoId);
if (dsInfo == null || !Objects.equals(dsInfo.getTenantId(), tenantId)) {
throw new TaierDefineException(ErrorCode.PERMISSION_LIMIT);
}
if (Objects.equals(dsInfo.getIsMeta(), 1)) {
throw new TaierDefineException(ErrorCode.CAN_NOT_DEL_META_DS);
}
Expand Down
Loading