caishunfeng commented on code in PR #15757:
URL:
https://github.com/apache/dolphinscheduler/pull/15757#discussion_r1536981276
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java:
##########
@@ -1306,16 +1292,13 @@ public Result<Object> queryResourceBaseDir(User
loginUser, ResourceType type) {
*/
private boolean isUserTenantValid(boolean isAdmin, String userTenantCode,
String resTenantCode) throws
ServiceException {
- if (!isAdmin) {
- resTenantCode = resTenantCode == null ? "" : resTenantCode;
- if (!StringUtils.isBlank(resTenantCode) &&
!resTenantCode.equals(userTenantCode)) {
- // if an ordinary user directly send a query API with a
different tenantCode and fullName "",
- // still he/she does not have read permission.
- return false;
- }
+ if (isAdmin) {
+ return true;
}
-
- return true;
+ if (StringUtils.isEmpty(resTenantCode)) {
+ return true;
+ }
+ return resTenantCode.equals(userTenantCode);
Review Comment:
Yes, when resource create or upload, the resource tenant code is empty. But
the better way is to remove checking if not need. I will update it.
https://github.com/apache/dolphinscheduler/blob/dcc9d64ef6c5a8353722aa371eb4920d33d6d756/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java#L130
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]