mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
修复用户模块权限问题
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<!-- jar部署:pom war部署:war-->
|
||||
<packaging>war</packaging>
|
||||
<artifactId>ruoyi-admin</artifactId>
|
||||
|
||||
<description>
|
||||
|
||||
@@ -124,7 +124,7 @@ public class SysUserController extends BaseController
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增用户", notes = "新增用户")
|
||||
@@ -149,6 +149,33 @@ public class SysUserController extends BaseController
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
*/
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/register")
|
||||
@ApiOperation(value = "用户注册", notes = "用户注册")
|
||||
public AjaxResult register(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName())))
|
||||
{
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
{
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setDelFlag("0");
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
// 过滤请求
|
||||
.authorizeRequests()
|
||||
// 对于登录login 验证码captchaImage 允许匿名访问
|
||||
.antMatchers("/login", "/captchaImage").anonymous()
|
||||
.antMatchers("/login", "/captchaImage","/system/user/register").anonymous()
|
||||
.antMatchers(
|
||||
HttpMethod.GET,
|
||||
"/*.html",
|
||||
@@ -113,7 +113,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
.antMatchers("/webjars/**").anonymous()
|
||||
.antMatchers("/*/api-docs").anonymous()
|
||||
.antMatchers("/druid/**").anonymous()
|
||||
.antMatchers("/system/user/**").anonymous()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
|
||||
Reference in New Issue
Block a user