fix user update permission (#11603)
This commit is contained in:
parent
207505735c
commit
a7d1c35f85
@ -176,12 +176,18 @@ public class UserController {
|
||||
}
|
||||
IdentityContext identityContext = (IdentityContext) request.getSession()
|
||||
.getAttribute(com.alibaba.nacos.plugin.auth.constant.Constants.Identity.IDENTITY_CONTEXT);
|
||||
NacosUser user;
|
||||
if (identityContext == null
|
||||
|| (user = (NacosUser) identityContext.getParameter(AuthConstants.NACOS_USER_KEY)) == null
|
||||
|| (user = iAuthenticationManager.authenticate(request)) == null) {
|
||||
if (identityContext == null) {
|
||||
throw new HttpSessionRequiredException("session expired!");
|
||||
}
|
||||
NacosUser user = (NacosUser) identityContext.getParameter(AuthConstants.NACOS_USER_KEY);
|
||||
if (user == null) {
|
||||
user = iAuthenticationManager.authenticate(request);
|
||||
if (user == null) {
|
||||
throw new HttpSessionRequiredException("session expired!");
|
||||
}
|
||||
//get user form jwt need check permission
|
||||
iAuthenticationManager.hasGlobalAdminRole(user);
|
||||
}
|
||||
// admin
|
||||
if (user.isGlobalAdmin()) {
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user