Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
barry cho
Person System
Commits
f55f2d78
Commit
f55f2d78
authored
4 years ago
by
过期的豆豆糖
Browse files
Options
Download
Email Patches
Plain Diff
更新权限
parent
0c4ba373
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
person-admin/src/main/java/com/person/modules/sys/shiro/UserRealm.java
+7
-2
...src/main/java/com/person/modules/sys/shiro/UserRealm.java
with
7 additions
and
2 deletions
+7
-2
person-admin/src/main/java/com/person/modules/sys/shiro/UserRealm.java
+
7
-
2
View file @
f55f2d78
...
...
@@ -12,6 +12,7 @@ import com.person.common.utils.Constant;
import
com.person.modules.sys.dao.SysMenuDao
;
import
com.person.modules.sys.dao.SysUserDao
;
import
com.person.modules.sys.entity.SysUserEntity
;
import
com.person.modules.sys.service.SysUserRoleService
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.shiro.authc.*
;
import
org.apache.shiro.authc.credential.CredentialsMatcher
;
...
...
@@ -39,7 +40,8 @@ public class UserRealm extends AuthorizingRealm {
private
SysMenuDao
sysMenuDao
;
@Autowired
UserDocService
userDocService
;
@Autowired
private
SysUserRoleService
sysUserRoleService
;
/**
* 授权(验证权限时调用)
*/
...
...
@@ -87,6 +89,8 @@ public class UserRealm extends AuthorizingRealm {
if
(
null
!=
userDoc
)
{
Long
userId
=
userDoc
.
getUserId
();
user
=
sysUserDao
.
selectById
(
userId
);
List
<
Long
>
roleIdList
=
sysUserRoleService
.
queryRoleIdList
(
userId
);
user
.
setRoleIdList
(
roleIdList
);
}
else
{
//查询用户信息
user
=
sysUserDao
.
selectOne
(
new
QueryWrapper
<
SysUserEntity
>().
eq
(
"username"
,
token
.
getUsername
()));
...
...
@@ -100,7 +104,8 @@ public class UserRealm extends AuthorizingRealm {
if
(
user
.
getStatus
()
==
0
)
{
throw
new
LockedAccountException
(
"账号已被锁定,请联系管理员"
);
}
List
<
Long
>
roleIdList
=
sysUserRoleService
.
queryRoleIdList
(
user
.
getUserId
());
user
.
setRoleIdList
(
roleIdList
);
SimpleAuthenticationInfo
info
=
new
SimpleAuthenticationInfo
(
user
,
user
.
getPassword
(),
ByteSource
.
Util
.
bytes
(
user
.
getSalt
()),
getName
());
return
info
;
}
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help