| | |
| | | import com.stylefeng.guns.core.util.Convert; |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | import com.stylefeng.guns.modular.system.dao.MenuMapper; |
| | | import com.stylefeng.guns.modular.system.dao.RoleMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.Role; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import org.apache.shiro.authc.CredentialsException; |
| | | import org.apache.shiro.authc.LockedAccountException; |
| | |
| | | |
| | | @Autowired |
| | | private MenuMapper menuMapper; |
| | | |
| | | @Autowired |
| | | private RoleMapper roleMapper; |
| | | |
| | | public static IShiro me() { |
| | | return SpringContextHolder.getBean(IShiro.class); |
| | |
| | | shiroUser.setDeptId(user.getDeptid()); |
| | | shiroUser.setDeptName(ConstantFactory.me().getDeptName(user.getDeptid())); |
| | | shiroUser.setName(user.getName()); |
| | | shiroUser.setObjectId(user.getObjectId()); |
| | | shiroUser.setRoleType(user.getRoleType()); |
| | | |
| | | Integer[] roleArray = Convert.toIntArray(user.getRoleid()); |
| | | List<Integer> roleList = new ArrayList<Integer>(); |
| | |
| | | } |
| | | shiroUser.setRoleList(roleList); |
| | | shiroUser.setRoleNames(roleNameList); |
| | | |
| | | List<Role> roles = roleMapper.selectBatchIds(roleList); |
| | | shiroUser.setAdmin(roles.stream().filter(s -> s.getTips().equals("administrator")).findAny().isPresent()); |
| | | return shiroUser; |
| | | } |
| | | |