Commit 437e5b7680cfe91b42b180fc33d0588018358587
1 parent
5e7266ed33
Exists in
master
修改
Showing 4 changed files with 56 additions and 44 deletions
center.manager/src/main/java/com/lyms/cm/controller/sys/SysRolesController.java
View file @
437e5b7
| 1 | 1 | package com.lyms.cm.controller.sys; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 4 | 5 | import org.springframework.stereotype.Controller; |
| 5 | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 6 | 8 | import org.springframework.web.bind.annotation.ResponseBody; |
| 7 | 9 | |
| 8 | 10 | import com.baomidou.mybatisplus.plugins.Page; |
| 9 | 11 | |
| 10 | 12 | |
| ... | ... | @@ -22,15 +24,16 @@ |
| 22 | 24 | @RequestMapping("/sysRoles") |
| 23 | 25 | public class SysRolesController extends BaseController { |
| 24 | 26 | |
| 27 | + @Autowired | |
| 25 | 28 | private SysRolesService sysRolesService; |
| 26 | 29 | |
| 27 | 30 | |
| 28 | - @RequestMapping("/list") | |
| 31 | + @RequestMapping("/toList") | |
| 29 | 32 | public String list() { |
| 30 | 33 | return "/role/role_list"; |
| 31 | 34 | } |
| 32 | 35 | |
| 33 | - @RequestMapping("/getRoleList") | |
| 36 | + @RequestMapping(value = "/getRoleList", method = { RequestMethod.POST }) | |
| 34 | 37 | @ResponseBody |
| 35 | 38 | public java.util.Map<String, Object> getRoleList(){ |
| 36 | 39 | Page<SysRoles> page = getPage(); |
center.manager/src/main/java/com/lyms/cm/shiro/ShiroRealm.java
View file @
437e5b7
| 1 | -//package com.lyms.cm.shiro; | |
| 2 | -// | |
| 3 | -//import java.util.Arrays; | |
| 4 | -//import java.util.HashSet; | |
| 5 | -// | |
| 6 | -//import org.apache.shiro.authc.AccountException; | |
| 7 | -//import org.apache.shiro.authc.AuthenticationException; | |
| 8 | -//import org.apache.shiro.authc.AuthenticationInfo; | |
| 9 | -//import org.apache.shiro.authc.AuthenticationToken; | |
| 10 | -//import org.apache.shiro.authc.SimpleAuthenticationInfo; | |
| 11 | -//import org.apache.shiro.authc.UnknownAccountException; | |
| 12 | -//import org.apache.shiro.authc.UsernamePasswordToken; | |
| 13 | -//import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher; | |
| 14 | -//import org.apache.shiro.authz.AuthorizationInfo; | |
| 15 | -//import org.apache.shiro.authz.SimpleAuthorizationInfo; | |
| 16 | -//import org.apache.shiro.realm.AuthorizingRealm; | |
| 17 | -//import org.apache.shiro.subject.PrincipalCollection; | |
| 18 | -//import org.slf4j.Logger; | |
| 19 | -//import org.slf4j.LoggerFactory; | |
| 20 | -//import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | -// | |
| 22 | -//import com.lyms.cm.entity.sys.User; | |
| 23 | -//import com.lyms.cm.service.sys.ResourceService; | |
| 24 | -//import com.lyms.cm.service.sys.UserService; | |
| 25 | -//import com.lyms.shiro.HashUtils; | |
| 26 | -//import com.lyms.shiro.ShiroWebUtils; | |
| 27 | -//import com.lyms.util.StrUtils; | |
| 28 | -// | |
| 29 | -///** | |
| 30 | -// * <li>@ClassName: ShiroRealm | |
| 31 | -// * <li>@Description: 自定义Realm授权与验证实现 | |
| 32 | -// * <li>@author 方承 | |
| 33 | -// * <li>@date 2015年12月29日 | |
| 34 | -// * <li> | |
| 35 | -// */ | |
| 36 | -//public class ShiroRealm extends AuthorizingRealm { | |
| 37 | -// | |
| 1 | +package com.lyms.cm.shiro; | |
| 2 | + | |
| 3 | +import java.util.Arrays; | |
| 4 | +import java.util.HashSet; | |
| 5 | + | |
| 6 | +import org.apache.shiro.authc.AccountException; | |
| 7 | +import org.apache.shiro.authc.AuthenticationException; | |
| 8 | +import org.apache.shiro.authc.AuthenticationInfo; | |
| 9 | +import org.apache.shiro.authc.AuthenticationToken; | |
| 10 | +import org.apache.shiro.authc.SimpleAuthenticationInfo; | |
| 11 | +import org.apache.shiro.authc.UnknownAccountException; | |
| 12 | +import org.apache.shiro.authc.UsernamePasswordToken; | |
| 13 | +import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher; | |
| 14 | +import org.apache.shiro.authz.AuthorizationInfo; | |
| 15 | +import org.apache.shiro.authz.SimpleAuthorizationInfo; | |
| 16 | +import org.apache.shiro.realm.AuthorizingRealm; | |
| 17 | +import org.apache.shiro.subject.PrincipalCollection; | |
| 18 | +import org.slf4j.Logger; | |
| 19 | +import org.slf4j.LoggerFactory; | |
| 20 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | +import com.lyms.shiro.HashUtils; | |
| 22 | +import com.lyms.shiro.ShiroWebUtils; | |
| 23 | +import com.lyms.util.StrUtils; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * <li>@ClassName: ShiroRealm | |
| 27 | + * <li>@Description: 自定义Realm授权与验证实现 | |
| 28 | + * <li>@author 方承 | |
| 29 | + * <li>@date 2015年12月29日 | |
| 30 | + * <li> | |
| 31 | + */ | |
| 32 | +public class ShiroRealm extends AuthorizingRealm { | |
| 33 | + | |
| 34 | + @Override | |
| 35 | + protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { | |
| 36 | + // TODO Auto-generated method stub | |
| 37 | + return null; | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { | |
| 42 | + // TODO Auto-generated method stub | |
| 43 | + return null; | |
| 44 | + } | |
| 45 | + | |
| 38 | 46 | // @SuppressWarnings("unused") |
| 39 | 47 | // private static Logger logger = LoggerFactory.getLogger(ShiroRealm.class); |
| 40 | 48 | // |
| ... | ... | @@ -84,6 +92,6 @@ |
| 84 | 92 | // AuthenticationInfo authcInfo = new SimpleAuthenticationInfo(username, pwd.toString(), username); |
| 85 | 93 | // return authcInfo; |
| 86 | 94 | // } |
| 87 | -// | |
| 88 | -//} | |
| 95 | + | |
| 96 | +} |
center.manager/src/main/webapp/WEB-INF/views/role/role_list.html
View file @
437e5b7
| ... | ... | @@ -35,7 +35,7 @@ |
| 35 | 35 | <script type="text/javascript"> |
| 36 | 36 | ## 参考 base_table_init.js 或者根据empty_bootstrap_table_init.js 来自己创建特殊的table |
| 37 | 37 | ## 注意:自己创建的特殊的table不能extends base_list.html |
| 38 | -var default_dataUrl = "${ctx}/role/getRoleList"; | |
| 38 | +var default_dataUrl = "${ctx}/sysRoles/getRoleList"; | |
| 39 | 39 | var default_dataColumns = [{ |
| 40 | 40 | field: 'check_state', |
| 41 | 41 | title: '', |
core.sdk/src/main/java/com/lyms/web/controller/BaseController.java
View file @
437e5b7
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | |
| 13 | 13 | import org.slf4j.Logger; |
| 14 | 14 | import org.slf4j.LoggerFactory; |
| 15 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 15 | 16 | import org.springframework.beans.propertyeditors.CustomDateEditor; |
| 16 | 17 | import org.springframework.util.StringUtils; |
| 17 | 18 | import org.springframework.web.bind.ServletRequestDataBinder; |
| 18 | 19 | |
| ... | ... | @@ -32,10 +33,10 @@ |
| 32 | 33 | |
| 33 | 34 | protected Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 34 | 35 | |
| 35 | - // @Autowired | |
| 36 | + @Autowired | |
| 36 | 37 | protected HttpServletRequest request; |
| 37 | 38 | |
| 38 | - // @Autowired | |
| 39 | + @Autowired | |
| 39 | 40 | protected HttpServletResponse response; |
| 40 | 41 | |
| 41 | 42 | @InitBinder |