소스 검색

校验权限,避免权限提升

lyon 1 년 전
부모
커밋
f60ed652b6

+ 3 - 1
maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ChangePasswodController.java

@@ -69,7 +69,9 @@ public class ChangePasswodController {
 	public ResponseEntity<?> changePasswod(
 			@RequestBody ChangePassword changePassword,
 			@CurrentUser UserInfo currentUser) {
-
+		if(!currentUser.getId().equals(changePassword.getId())){
+			return null;
+		}
 		changePassword.setUserId(currentUser.getId());
 		changePassword.setUsername(currentUser.getUsername());
 		changePassword.setInstId(currentUser.getInstId());

+ 3 - 1
maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ProfileController.java

@@ -66,7 +66,9 @@ public class ProfileController {
 				@CurrentUser UserInfo currentUser,
                 BindingResult result) {
         logger.debug(userInfo.toString());
-
+        if(!currentUser.getId().equals(userInfo.getId())){
+            return null;
+        }
 //		if(userInfo.getExtraAttributeValue()!=null){
 //			String []extraAttributeLabel=userInfo.getExtraAttributeName().split(",");
 //			String []extraAttributeValue=userInfo.getExtraAttributeValue().split(",");