Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
safe-campus-bbs
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
万成波
safe-campus-bbs
Commits
25a3a8ec
Commit
25a3a8ec
authored
Oct 09, 2025
by
万成波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限字符
parent
a0f3b82d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
18 deletions
+35
-18
safe-campus-admin/src/main/java/com/tangguo/web/controller/system/SysLoginController.java
...com/tangguo/web/controller/system/SysLoginController.java
+3
-6
safe-campus-common/src/main/java/com/tangguo/common/utils/SecurityUtils.java
...src/main/java/com/tangguo/common/utils/SecurityUtils.java
+17
-0
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsMomentController.java
...n/java/com/tangguo/controller/pc/BbsMomentController.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsSensitiveWordController.java
...com/tangguo/controller/pc/BbsSensitiveWordController.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
...n/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
+5
-2
safe-campus-points/src/main/java/com/tangguo/controller/BbsPointsSettingController.java
...va/com/tangguo/controller/BbsPointsSettingController.java
+5
-5
safe-campus-points/src/main/java/com/tangguo/controller/BbsUserPointsExchangeController.java
...m/tangguo/controller/BbsUserPointsExchangeController.java
+3
-3
No files found.
safe-campus-admin/src/main/java/com/tangguo/web/controller/system/SysLoginController.java
View file @
25a3a8ec
...
@@ -159,12 +159,9 @@ public class SysLoginController {
...
@@ -159,12 +159,9 @@ public class SysLoginController {
public
AjaxResult
getUserProfile
()
{
public
AjaxResult
getUserProfile
()
{
final
String
bbsAdmin
=
"bbs_admin"
;
final
String
bbsAdmin
=
"bbs_admin"
;
SysUser
sysUser
=
SecurityUtils
.
getLoginUser
().
getUser
();
SysUser
sysUser
=
SecurityUtils
.
getLoginUser
().
getUser
();
for
(
SysRole
role
:
sysUser
.
getRoles
())
{
List
<
SysRole
>
roles
=
SecurityUtils
.
getLoginUser
().
getUser
().
getRoles
();
if
(
bbsAdmin
.
equals
(
role
.
getRoleKey
()))
{
boolean
anyMatch
=
roles
.
stream
().
anyMatch
(
r
->
bbsAdmin
.
equals
(
r
.
getRoleKey
()));
sysUser
.
setBbsAdmin
(
true
);
sysUser
.
setBbsAdmin
(
anyMatch
);
break
;
}
}
return
AjaxResult
.
success
(
sysUser
);
return
AjaxResult
.
success
(
sysUser
);
}
}
...
...
safe-campus-common/src/main/java/com/tangguo/common/utils/SecurityUtils.java
View file @
25a3a8ec
package
com
.
tangguo
.
common
.
utils
;
package
com
.
tangguo
.
common
.
utils
;
import
com.tangguo.common.constant.HttpStatus
;
import
com.tangguo.common.constant.HttpStatus
;
import
com.tangguo.common.core.domain.entity.SysRole
;
import
com.tangguo.common.core.domain.entity.SysUser
;
import
com.tangguo.common.core.domain.model.LoginUser
;
import
com.tangguo.common.core.domain.model.LoginUser
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.exception.ServiceException
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
java.util.List
;
/**
/**
* 安全服务工具类
* 安全服务工具类
*
*
...
@@ -108,4 +112,17 @@ public class SecurityUtils {
...
@@ -108,4 +112,17 @@ public class SecurityUtils {
public
static
boolean
isAdmin
(
Long
userId
)
{
public
static
boolean
isAdmin
(
Long
userId
)
{
return
userId
!=
null
&&
1L
==
userId
;
return
userId
!=
null
&&
1L
==
userId
;
}
}
/**
* 是否为移动端管理员
*
* @return
*/
public
static
boolean
isBbsAdmin
()
{
final
String
bbsAdmin
=
"bbs_admin"
;
List
<
SysRole
>
roles
=
getLoginUser
().
getUser
().
getRoles
();
return
roles
.
stream
().
anyMatch
(
r
->
bbsAdmin
.
equals
(
r
.
getRoleKey
()));
}
}
}
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsMomentController.java
View file @
25a3a8ec
...
@@ -50,7 +50,7 @@ public class BbsMomentController extends BaseController {
...
@@ -50,7 +50,7 @@ public class BbsMomentController extends BaseController {
* 导出动态列表
* 导出动态列表
*/
*/
@ApiOperation
(
"导出动态列表"
)
@ApiOperation
(
"导出动态列表"
)
@PreAuthorize
(
"@ss.hasPermi('
points:points
:export')"
)
@PreAuthorize
(
"@ss.hasPermi('
bbs:moment
:export')"
)
@Log
(
title
=
"导出动态列表"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"导出动态列表"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/list/export"
)
@PostMapping
(
"/list/export"
)
public
void
export
(
HttpServletResponse
response
,
BbsMoment
bbsMoment
)
{
public
void
export
(
HttpServletResponse
response
,
BbsMoment
bbsMoment
)
{
...
...
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsSensitiveWordController.java
View file @
25a3a8ec
...
@@ -99,7 +99,7 @@ public class BbsSensitiveWordController extends BaseController {
...
@@ -99,7 +99,7 @@ public class BbsSensitiveWordController extends BaseController {
* 导入敏感词库
* 导入敏感词库
*/
*/
@ApiOperation
(
"导入敏感词库"
)
@ApiOperation
(
"导入敏感词库"
)
@PreAuthorize
(
"@ss.hasPermi('bbs:word:
edi
t')"
)
@PreAuthorize
(
"@ss.hasPermi('bbs:word:
impor
t')"
)
@Log
(
title
=
"敏感词库"
,
businessType
=
BusinessType
.
IMPORT
)
@Log
(
title
=
"敏感词库"
,
businessType
=
BusinessType
.
IMPORT
)
@PostMapping
(
"/import"
)
@PostMapping
(
"/import"
)
public
AjaxResult
importWords
(
MultipartFile
file
)
{
public
AjaxResult
importWords
(
MultipartFile
file
)
{
...
...
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
View file @
25a3a8ec
...
@@ -223,7 +223,9 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
...
@@ -223,7 +223,9 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
if
(
Objects
.
isNull
(
dbMoment
))
{
if
(
Objects
.
isNull
(
dbMoment
))
{
throw
new
ServiceException
(
"删除失败,未查询到当前动态数据。"
);
throw
new
ServiceException
(
"删除失败,未查询到当前动态数据。"
);
}
}
if
(!
dbMoment
.
getUserName
().
equals
(
username
))
{
boolean
isBbsAdmin
=
SecurityUtils
.
isBbsAdmin
();
if
(!
dbMoment
.
getUserName
().
equals
(
username
)
&&
!
isBbsAdmin
)
{
throw
new
ServiceException
(
"删除失败,没有对当前动态数据的操作权限。"
);
throw
new
ServiceException
(
"删除失败,没有对当前动态数据的操作权限。"
);
}
}
...
@@ -407,7 +409,8 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
...
@@ -407,7 +409,8 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
}
}
String
userName
=
SecurityUtils
.
getUsername
();
String
userName
=
SecurityUtils
.
getUsername
();
if
(!
dbComment
.
getUserName
().
equals
(
userName
))
{
boolean
isBbsAdmin
=
SecurityUtils
.
isBbsAdmin
();
if
(!
dbComment
.
getUserName
().
equals
(
userName
)
&&
!
isBbsAdmin
)
{
throw
new
ServiceException
(
"删除失败,没有对当前动态评论的操作权限。"
);
throw
new
ServiceException
(
"删除失败,没有对当前动态评论的操作权限。"
);
}
}
...
...
safe-campus-points/src/main/java/com/tangguo/controller/BbsPointsSettingController.java
View file @
25a3a8ec
...
@@ -48,7 +48,7 @@ public class BbsPointsSettingController extends BaseController {
...
@@ -48,7 +48,7 @@ public class BbsPointsSettingController extends BaseController {
* 获取积分规则配置详细信息
* 获取积分规则配置详细信息
*/
*/
@ApiOperation
(
"获取积分规则配置详细信息"
)
@ApiOperation
(
"获取积分规则配置详细信息"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
query
')"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
list
')"
)
@GetMapping
(
value
=
"/{id}"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
bbsPointsSettingService
.
getById
(
id
));
return
success
(
bbsPointsSettingService
.
getById
(
id
));
...
@@ -59,7 +59,7 @@ public class BbsPointsSettingController extends BaseController {
...
@@ -59,7 +59,7 @@ public class BbsPointsSettingController extends BaseController {
* 新增积分规则配置
* 新增积分规则配置
*/
*/
@ApiOperation
(
"新增积分规则配置"
)
@ApiOperation
(
"新增积分规则配置"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
add
')"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
list
')"
)
@Log
(
title
=
"积分规则配置"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"积分规则配置"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
@PostMapping
public
AjaxResult
add
(
@RequestBody
BbsPointsSetting
setting
)
{
public
AjaxResult
add
(
@RequestBody
BbsPointsSetting
setting
)
{
...
@@ -72,7 +72,7 @@ public class BbsPointsSettingController extends BaseController {
...
@@ -72,7 +72,7 @@ public class BbsPointsSettingController extends BaseController {
* 修改积分规则配置
* 修改积分规则配置
*/
*/
@ApiOperation
(
"修改积分规则配置"
)
@ApiOperation
(
"修改积分规则配置"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
edi
t')"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
lis
t')"
)
@Log
(
title
=
"积分规则配置"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"积分规则配置"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
@PutMapping
public
AjaxResult
edit
(
@RequestBody
BbsPointsSetting
setting
)
{
public
AjaxResult
edit
(
@RequestBody
BbsPointsSetting
setting
)
{
...
@@ -85,7 +85,7 @@ public class BbsPointsSettingController extends BaseController {
...
@@ -85,7 +85,7 @@ public class BbsPointsSettingController extends BaseController {
* 修改积分规则配置
* 修改积分规则配置
*/
*/
@ApiOperation
(
"修改积分规则配置"
)
@ApiOperation
(
"修改积分规则配置"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
edi
t')"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
lis
t')"
)
@Log
(
title
=
"积分规则配置"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"积分规则配置"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/batch"
)
@PutMapping
(
"/batch"
)
public
AjaxResult
batchEdit
(
@RequestBody
Map
<
String
,
List
<
BbsPointsSetting
>>
pointMap
)
{
public
AjaxResult
batchEdit
(
@RequestBody
Map
<
String
,
List
<
BbsPointsSetting
>>
pointMap
)
{
...
@@ -104,7 +104,7 @@ public class BbsPointsSettingController extends BaseController {
...
@@ -104,7 +104,7 @@ public class BbsPointsSettingController extends BaseController {
* 删除积分规则配置
* 删除积分规则配置
*/
*/
@ApiOperation
(
"删除积分规则配置"
)
@ApiOperation
(
"删除积分规则配置"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
remove
')"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:
list
')"
)
@Log
(
title
=
"积分规则配置"
,
businessType
=
BusinessType
.
DELETE
)
@Log
(
title
=
"积分规则配置"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{id}"
)
@DeleteMapping
(
"/{id}"
)
public
AjaxResult
remove
(
@PathVariable
Long
id
)
{
public
AjaxResult
remove
(
@PathVariable
Long
id
)
{
...
...
safe-campus-points/src/main/java/com/tangguo/controller/BbsUserPointsExchangeController.java
View file @
25a3a8ec
...
@@ -37,7 +37,7 @@ public class BbsUserPointsExchangeController extends BaseController {
...
@@ -37,7 +37,7 @@ public class BbsUserPointsExchangeController extends BaseController {
* 查询用户积分兑换列表
* 查询用户积分兑换列表
*/
*/
@ApiOperation
(
"查询用户积分兑换列表"
)
@ApiOperation
(
"查询用户积分兑换列表"
)
@PreAuthorize
(
"@ss.hasPermi('points:
points
:list')"
)
@PreAuthorize
(
"@ss.hasPermi('points:
exchange
:list')"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
BbsUserPointsExchange
exchange
)
{
public
TableDataInfo
list
(
BbsUserPointsExchange
exchange
)
{
startPage
();
startPage
();
...
@@ -50,7 +50,7 @@ public class BbsUserPointsExchangeController extends BaseController {
...
@@ -50,7 +50,7 @@ public class BbsUserPointsExchangeController extends BaseController {
* 导出用户积分列表
* 导出用户积分列表
*/
*/
@ApiOperation
(
"导出用户积分列表"
)
@ApiOperation
(
"导出用户积分列表"
)
@PreAuthorize
(
"@ss.hasPermi('points:
points
:export')"
)
@PreAuthorize
(
"@ss.hasPermi('points:
exchange
:export')"
)
@Log
(
title
=
"用户积分"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"用户积分"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
BbsUserPointsExchange
exchange
)
{
public
void
export
(
HttpServletResponse
response
,
BbsUserPointsExchange
exchange
)
{
...
@@ -65,7 +65,7 @@ public class BbsUserPointsExchangeController extends BaseController {
...
@@ -65,7 +65,7 @@ public class BbsUserPointsExchangeController extends BaseController {
*/
*/
@RepeatSubmit
(
interval
=
1000
)
@RepeatSubmit
(
interval
=
1000
)
@ApiOperation
(
"用户积分兑换"
)
@ApiOperation
(
"用户积分兑换"
)
@PreAuthorize
(
"@ss.hasPermi('points:
points
:exchange')"
)
@PreAuthorize
(
"@ss.hasPermi('points:
exchange
:exchange')"
)
@Log
(
title
=
"用户积分兑换"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"用户积分兑换"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/exchange"
)
@PostMapping
(
"/exchange"
)
public
AjaxResult
exchange
(
@RequestBody
BbsUserPointsExchange
exchange
)
{
public
AjaxResult
exchange
(
@RequestBody
BbsUserPointsExchange
exchange
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment