You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/05/18 02:50:29 UTC
[GitHub] [incubator-dolphinscheduler] lgcareer opened a new pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
lgcareer opened a new pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732
## What is the purpose of the pull request
*fix #2598:allow to update resource suffix,but if it is authorized to other users,it is not allowed.*
## Brief change log
*add RESOURCE_IS_AUTHORIZED status*
*support update resource suffix*
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-dolphinscheduler] lenboo commented on a change in pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
Posted by GitBox <gi...@apache.org>.
lenboo commented on a change in pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732#discussion_r426354405
##########
File path: dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
##########
@@ -355,12 +352,21 @@ public Result updateResource(User loginUser,
String nameWithSuffix = name;
if (!resource.isDirectory()) {
- //get the file suffix
- String suffix = originResourceName.substring(originResourceName.lastIndexOf("."));
-
- //if the name without suffix then add it ,else use the origin name
- if(!name.endsWith(suffix)){
- nameWithSuffix = nameWithSuffix + suffix;
+ //get the origin file suffix
+ String originSuffix = FileUtils.suffix(originFullName);
+ String suffix = FileUtils.suffix(fullName);
+ if (!suffix.equals(originSuffix)) {
+ //need verify whether this resource is authorized to other users
+ Map<String, Object> columnMap = new HashMap<String, Object>();
+ columnMap.put("resources_id", resourceId);
+
+ List<ResourcesUser> resourcesUsers = resourceUserMapper.selectByMap(columnMap);
+ if (CollectionUtils.isNotEmpty(resourcesUsers)) {
+ String users = resourcesUsers.stream().map(t -> t.getUserId()).collect(Collectors.toList()).toString();
+ logger.error("resource is authorized to user {},suffix not allowed to be modified", users);
Review comment:
change the message the user name is better.
##########
File path: dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
##########
@@ -355,12 +352,21 @@ public Result updateResource(User loginUser,
String nameWithSuffix = name;
if (!resource.isDirectory()) {
- //get the file suffix
- String suffix = originResourceName.substring(originResourceName.lastIndexOf("."));
-
- //if the name without suffix then add it ,else use the origin name
- if(!name.endsWith(suffix)){
- nameWithSuffix = nameWithSuffix + suffix;
+ //get the origin file suffix
+ String originSuffix = FileUtils.suffix(originFullName);
+ String suffix = FileUtils.suffix(fullName);
+ if (!suffix.equals(originSuffix)) {
+ //need verify whether this resource is authorized to other users
+ Map<String, Object> columnMap = new HashMap<String, Object>();
+ columnMap.put("resources_id", resourceId);
+
+ List<ResourcesUser> resourcesUsers = resourceUserMapper.selectByMap(columnMap);
+ if (CollectionUtils.isNotEmpty(resourcesUsers)) {
+ String users = resourcesUsers.stream().map(t -> t.getUserId()).collect(Collectors.toList()).toString();
+ logger.error("resource is authorized to user {},suffix not allowed to be modified", users);
Review comment:
or do not print user name?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] removed a comment on pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732#issuecomment-629986816
Kudos, SonarCloud Quality Gate passed!
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) to review)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [3 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/25.png' alt='37.5%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list) [37.5% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-dolphinscheduler] lenboo merged pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
Posted by GitBox <gi...@apache.org>.
lenboo merged pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] commented on pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732#issuecomment-629986816
Kudos, SonarCloud Quality Gate passed!
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) to review)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [3 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/25.png' alt='37.5%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list) [37.5% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-dolphinscheduler] codecov-io commented on pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732#issuecomment-629985731
# [Codecov](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732?src=pr&el=h1) Report
> Merging [#2732](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732?src=pr&el=desc) into [dev-1.3.0](https://codecov.io/gh/apache/incubator-dolphinscheduler/commit/90d1701ad5aa6816e36c9c13d37a634e32f59fc5&el=desc) will **increase** coverage by `0.93%`.
> The diff coverage is `35.29%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/graphs/tree.svg?width=650&height=150&src=pr&token=bv9iXXRLi9)](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## dev-1.3.0 #2732 +/- ##
===============================================
+ Coverage 36.14% 37.08% +0.93%
- Complexity 2470 2540 +70
===============================================
Files 431 433 +2
Lines 19862 19947 +85
Branches 2422 2430 +8
===============================================
+ Hits 7180 7397 +217
+ Misses 12038 11882 -156
- Partials 644 668 +24
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...apache/dolphinscheduler/alert/utils/Constants.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1hbGVydC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9hbGVydC91dGlscy9Db25zdGFudHMuamF2YQ==) | `0.00% <ø> (ø)` | `0.00 <0.00> (ø)` | |
| [...nscheduler/api/service/ProcessInstanceService.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvUHJvY2Vzc0luc3RhbmNlU2VydmljZS5qYXZh) | `78.16% <0.00%> (ø)` | `33.00 <0.00> (ø)` | |
| [...che/dolphinscheduler/api/service/UsersService.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvVXNlcnNTZXJ2aWNlLmphdmE=) | `71.17% <0.00%> (ø)` | `66.00 <0.00> (ø)` | |
| [...e/dolphinscheduler/remote/command/CommandType.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1yZW1vdGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvcmVtb3RlL2NvbW1hbmQvQ29tbWFuZFR5cGUuamF2YQ==) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
| [...heduler/server/master/runner/MasterExecThread.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1zZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL21hc3Rlci9ydW5uZXIvTWFzdGVyRXhlY1RocmVhZC5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...dolphinscheduler/service/log/LogClientService.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1zZXJ2aWNlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kb2xwaGluc2NoZWR1bGVyL3NlcnZpY2UvbG9nL0xvZ0NsaWVudFNlcnZpY2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...lphinscheduler/service/process/ProcessService.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1zZXJ2aWNlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kb2xwaGluc2NoZWR1bGVyL3NlcnZpY2UvcHJvY2Vzcy9Qcm9jZXNzU2VydmljZS5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...inscheduler/service/quartz/ProcessScheduleJob.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1zZXJ2aWNlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kb2xwaGluc2NoZWR1bGVyL3NlcnZpY2UvcXVhcnR6L1Byb2Nlc3NTY2hlZHVsZUpvYi5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...dolphinscheduler/api/service/ResourcesService.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvUmVzb3VyY2VzU2VydmljZS5qYXZh) | `55.86% <21.05%> (-1.21%)` | `67.00 <0.00> (ø)` | |
| [...inscheduler/server/log/LoggerRequestProcessor.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1zZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL2xvZy9Mb2dnZXJSZXF1ZXN0UHJvY2Vzc29yLmphdmE=) | `37.83% <47.36%> (+37.83%)` | `5.00 <0.00> (+5.00)` | |
| ... and [31 more](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732?src=pr&el=footer). Last update [f52bad5...ad33b8b](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/2732?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] removed a comment on pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732#issuecomment-630030861
Kudos, SonarCloud Quality Gate passed!
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) to review)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [3 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/25.png' alt='36.4%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list) [36.4% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] commented on pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732#issuecomment-630030861
Kudos, SonarCloud Quality Gate passed!
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) to review)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [3 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/25.png' alt='36.4%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list) [36.4% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] commented on pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732#issuecomment-630075625
Kudos, SonarCloud Quality Gate passed!
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=BUG)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=SECURITY_HOTSPOT) to review)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=2732&resolved=false&types=CODE_SMELL)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/25.png' alt='36.4%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list) [36.4% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_coverage&view=list)
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=2732&metric=new_duplicated_lines_density&view=list)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-dolphinscheduler] lgcareer commented on a change in pull request #2732: fix #2598::allow to update resource suffix,but if it is authorized to other users,it is not allowed
Posted by GitBox <gi...@apache.org>.
lgcareer commented on a change in pull request #2732:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/2732#discussion_r426457881
##########
File path: dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
##########
@@ -355,12 +352,21 @@ public Result updateResource(User loginUser,
String nameWithSuffix = name;
if (!resource.isDirectory()) {
- //get the file suffix
- String suffix = originResourceName.substring(originResourceName.lastIndexOf("."));
-
- //if the name without suffix then add it ,else use the origin name
- if(!name.endsWith(suffix)){
- nameWithSuffix = nameWithSuffix + suffix;
+ //get the origin file suffix
+ String originSuffix = FileUtils.suffix(originFullName);
+ String suffix = FileUtils.suffix(fullName);
+ if (!suffix.equals(originSuffix)) {
+ //need verify whether this resource is authorized to other users
+ Map<String, Object> columnMap = new HashMap<String, Object>();
+ columnMap.put("resources_id", resourceId);
+
+ List<ResourcesUser> resourcesUsers = resourceUserMapper.selectByMap(columnMap);
+ if (CollectionUtils.isNotEmpty(resourcesUsers)) {
+ String users = resourcesUsers.stream().map(t -> t.getUserId()).collect(Collectors.toList()).toString();
+ logger.error("resource is authorized to user {},suffix not allowed to be modified", users);
Review comment:
I agree with you,The message now shows the user name instead of user id.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org