Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
e0ea026d
Commit
e0ea026d
authored
Mar 20, 2021
by
Zheng Jie
Browse files
Merge branch 'master' of
https://github.com/elunez/eladmin
parents
e1c434b8
3b802fd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java
View file @
e0ea026d
...
@@ -27,6 +27,8 @@ import me.zhengjie.modules.system.service.dto.UserDto;
...
@@ -27,6 +27,8 @@ import me.zhengjie.modules.system.service.dto.UserDto;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
...
@@ -41,6 +43,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
...
@@ -41,6 +43,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
private
final
RoleService
roleService
;
private
final
RoleService
roleService
;
private
final
DataService
dataService
;
private
final
DataService
dataService
;
private
final
LoginProperties
loginProperties
;
private
final
LoginProperties
loginProperties
;
public
void
setEnableCache
(
boolean
enableCache
)
{
public
void
setEnableCache
(
boolean
enableCache
)
{
this
.
loginProperties
.
setCacheEnable
(
enableCache
);
this
.
loginProperties
.
setCacheEnable
(
enableCache
);
}
}
...
@@ -58,6 +61,10 @@ public class UserDetailsServiceImpl implements UserDetailsService {
...
@@ -58,6 +61,10 @@ public class UserDetailsServiceImpl implements UserDetailsService {
JwtUserDto
jwtUserDto
=
null
;
JwtUserDto
jwtUserDto
=
null
;
if
(
loginProperties
.
isCacheEnable
()
&&
userDtoCache
.
containsKey
(
username
))
{
if
(
loginProperties
.
isCacheEnable
()
&&
userDtoCache
.
containsKey
(
username
))
{
jwtUserDto
=
userDtoCache
.
get
(
username
);
jwtUserDto
=
userDtoCache
.
get
(
username
);
// 检查dataScope是否修改
List
<
Long
>
dataScopes
=
jwtUserDto
.
getDataScopes
();
dataScopes
.
clear
();
dataScopes
.
addAll
(
dataService
.
getDeptIds
(
jwtUserDto
.
getUser
()));
searchDb
=
false
;
searchDb
=
false
;
}
}
if
(
searchDb
)
{
if
(
searchDb
)
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java
View file @
e0ea026d
...
@@ -113,6 +113,8 @@ public class DeptServiceImpl implements DeptService {
...
@@ -113,6 +113,8 @@ public class DeptServiceImpl implements DeptService {
resources
.
setSubCount
(
0
);
resources
.
setSubCount
(
0
);
// 清理缓存
// 清理缓存
updateSubCnt
(
resources
.
getPid
());
updateSubCnt
(
resources
.
getPid
());
// 清理自定义角色权限的datascope缓存
delCaches
(
resources
.
getPid
());
}
}
@Override
@Override
...
...
Write
Preview
Supports
Markdown
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