🎨 方法名变更
This commit is contained in:
parent
2b3b7b5ac4
commit
397e0e07a5
@ -42,8 +42,6 @@ public class BaseShiroRealm extends AuthorizingRealm {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
|
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
|
||||||
//Principal principal = (Principal) getAvailablePrincipal(principals);
|
|
||||||
// System.out.println("权限配置-->MyShiroRealm.doGetAuthorizationInfo()");
|
|
||||||
SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
|
SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
|
||||||
Principal principal = (Principal)principals.getPrimaryPrincipal();
|
Principal principal = (Principal)principals.getPrimaryPrincipal();
|
||||||
User user = new User();
|
User user = new User();
|
||||||
@ -55,7 +53,7 @@ public class BaseShiroRealm extends AuthorizingRealm {
|
|||||||
authorizationInfo.addRole(role.getInputCode());
|
authorizationInfo.addRole(role.getInputCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Permission> permissions = permissionService.selectMenuByUser(user);
|
List<Permission> permissions = permissionService.selectPermissionByUser(user);
|
||||||
for (Permission perm : permissions) {
|
for (Permission perm : permissions) {
|
||||||
if (perm.getPermissionCategory() != null) {
|
if (perm.getPermissionCategory() != null) {
|
||||||
authorizationInfo.addStringPermission(perm.getPermissionCategory());
|
authorizationInfo.addStringPermission(perm.getPermissionCategory());
|
||||||
|
@ -14,5 +14,10 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface PermissionService extends Service<Permission> {
|
public interface PermissionService extends Service<Permission> {
|
||||||
|
|
||||||
List<Permission> selectMenuByUser(User sysUser);
|
/**
|
||||||
|
* 获取用户权限
|
||||||
|
* @param sysUser
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Permission> selectPermissionByUser(User sysUser);
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,11 @@ import java.util.List;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by CodeGenerator on 2018/05/29.
|
*
|
||||||
|
* @author CodeGenerator
|
||||||
|
* @date 2018/05/29
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Transactional
|
|
||||||
public class PermissionServiceImpl extends AbstractService<Permission> implements PermissionService {
|
public class PermissionServiceImpl extends AbstractService<Permission> implements PermissionService {
|
||||||
@Resource
|
@Resource
|
||||||
private PermissionMapper permissionMapper;
|
private PermissionMapper permissionMapper;
|
||||||
@ -29,7 +30,7 @@ public class PermissionServiceImpl extends AbstractService<Permission> implement
|
|||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Permission> selectMenuByUser(User sysUser) {
|
public List<Permission> selectPermissionByUser(User sysUser) {
|
||||||
List<Permission> list = new ArrayList<Permission>();
|
List<Permission> list = new ArrayList<Permission>();
|
||||||
List<Role> roles = roleService.selectRoleByUser(sysUser);
|
List<Role> roles = roleService.selectRoleByUser(sysUser);
|
||||||
roles.forEach(role -> list.addAll(permissionMapper.selectMenuByIdRole(role.getIdRole())));
|
roles.forEach(role -> list.addAll(permissionMapper.selectMenuByIdRole(role.getIdRole())));
|
||||||
|
Loading…
Reference in New Issue
Block a user