From 8093cd45532dca4fff5c5d0ad7cbf8cba2a91e68 Mon Sep 17 00:00:00 2001 From: qiaozhanwei Date: Tue, 18 Aug 2020 10:52:32 +0800 Subject: [PATCH] modify general user can't create token (#3533) * [Feature] JVM parameter optimization , related issue #3370 * [Feature] JVM parameter optimization , related issue #3370 * test release 1.3.2 version rollback * test release 1.3.2 version rollback * test * test release 1.3.2 version rollback * modify tag 1.3.0 to HEAD * modify general user can't create token Co-authored-by: qiaozhanwei --- .../dolphinscheduler/api/service/AccessTokenService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AccessTokenService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AccessTokenService.java index 8b40a25743..8ccbff1e2f 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AccessTokenService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AccessTokenService.java @@ -120,9 +120,11 @@ public class AccessTokenService extends BaseService { */ public Map generateToken(User loginUser, int userId, String expireTime) { Map result = new HashMap<>(5); - if(check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)){ + if (!hasPerm(loginUser,userId)){ + putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } + String token = EncryptionUtils.getMd5(userId + expireTime + String.valueOf(System.currentTimeMillis())); result.put(Constants.DATA_LIST, token); putMsg(result, Status.SUCCESS);