From 397e0e07a5c6ad62b61ee41a2f4f44460b184d32 Mon Sep 17 00:00:00 2001 From: ronger Date: Wed, 26 Aug 2020 09:17:25 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=96=B9=E6=B3=95=E5=90=8D=E5=8F=98?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/rymcu/vertical/config/BaseShiroRealm.java | 4 +--- .../java/com/rymcu/vertical/service/PermissionService.java | 7 ++++++- .../rymcu/vertical/service/impl/PermissionServiceImpl.java | 7 ++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/rymcu/vertical/config/BaseShiroRealm.java b/src/main/java/com/rymcu/vertical/config/BaseShiroRealm.java index 7c88b93..1a0126b 100644 --- a/src/main/java/com/rymcu/vertical/config/BaseShiroRealm.java +++ b/src/main/java/com/rymcu/vertical/config/BaseShiroRealm.java @@ -42,8 +42,6 @@ public class BaseShiroRealm extends AuthorizingRealm { @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { - //Principal principal = (Principal) getAvailablePrincipal(principals); -// System.out.println("权限配置-->MyShiroRealm.doGetAuthorizationInfo()"); SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); Principal principal = (Principal)principals.getPrimaryPrincipal(); User user = new User(); @@ -55,7 +53,7 @@ public class BaseShiroRealm extends AuthorizingRealm { authorizationInfo.addRole(role.getInputCode()); } } - List permissions = permissionService.selectMenuByUser(user); + List permissions = permissionService.selectPermissionByUser(user); for (Permission perm : permissions) { if (perm.getPermissionCategory() != null) { authorizationInfo.addStringPermission(perm.getPermissionCategory()); diff --git a/src/main/java/com/rymcu/vertical/service/PermissionService.java b/src/main/java/com/rymcu/vertical/service/PermissionService.java index 74eea8c..bf577d1 100644 --- a/src/main/java/com/rymcu/vertical/service/PermissionService.java +++ b/src/main/java/com/rymcu/vertical/service/PermissionService.java @@ -14,5 +14,10 @@ import java.util.List; */ public interface PermissionService extends Service { - List selectMenuByUser(User sysUser); + /** + * 获取用户权限 + * @param sysUser + * @return + */ + List selectPermissionByUser(User sysUser); } diff --git a/src/main/java/com/rymcu/vertical/service/impl/PermissionServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/PermissionServiceImpl.java index 0631561..4e42d2b 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/PermissionServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/PermissionServiceImpl.java @@ -17,10 +17,11 @@ import java.util.List; /** - * Created by CodeGenerator on 2018/05/29. + * + * @author CodeGenerator + * @date 2018/05/29 */ @Service -@Transactional public class PermissionServiceImpl extends AbstractService implements PermissionService { @Resource private PermissionMapper permissionMapper; @@ -29,7 +30,7 @@ public class PermissionServiceImpl extends AbstractService implement private RoleService roleService; @Override - public List selectMenuByUser(User sysUser) { + public List selectPermissionByUser(User sysUser) { List list = new ArrayList(); List roles = roleService.selectRoleByUser(sysUser); roles.forEach(role -> list.addAll(permissionMapper.selectMenuByIdRole(role.getIdRole())));