|
@@ -4,13 +4,21 @@ import java.util.HashMap;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
+import com.lemon.lifecenter.dto.RoleDTO;
|
|
|
+import com.lemon.lifecenter.service.RoleService;
|
|
|
+
|
|
|
public class LifeCenterController {
|
|
|
+ @Autowired
|
|
|
+ private RoleService roleService;
|
|
|
+
|
|
|
public ModelAndView setMV(String viewPath) {
|
|
|
HashMap<String, String> hashMap = new HashMap<String, String>();
|
|
|
+ HashMap<String, String> roleMap = new HashMap<String, String>();
|
|
|
HttpServletRequest request = getRequest();
|
|
|
ModelAndView mv = new ModelAndView();
|
|
|
|
|
@@ -25,7 +33,7 @@ public class LifeCenterController {
|
|
|
hashMap.put("_TITLE", "생활치료센터 의료진 시스템");
|
|
|
hashMap.put("_INCLUDE", "/WEB-INF/jsp/include");
|
|
|
hashMap.put("_MENUPATH", pathType);
|
|
|
-
|
|
|
+
|
|
|
try {
|
|
|
String sesId = LifeCenterSessionController.getSession( request, "sesId" );
|
|
|
String sesName = LifeCenterSessionController.getSession( request, "sesName" );
|
|
@@ -46,7 +54,27 @@ public class LifeCenterController {
|
|
|
e.printStackTrace();
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 현재 메뉴에대한 권한 (C, R, U, D) 리턴 -> View 페이지에서 CRUD 권한에 따른 각각의 버튼 show, hide 제어 하기 위함
|
|
|
+ */
|
|
|
+ RoleDTO roleDTO = new RoleDTO();
|
|
|
+ roleDTO.setMenuPath( url );
|
|
|
+ int roleCount = roleService.selectNowPathRoleCheckTotal( roleDTO );
|
|
|
+
|
|
|
+ // roleCount가 0인경우는 권한체크하지않음 권한체크가 필요한 경로는 sys_menu_list에 등록 필수
|
|
|
+ if( roleCount > 0 ) {
|
|
|
+ String sesGroupIdx = LifeCenterSessionController.getSession( request, "sesGroupIdx" );
|
|
|
+ roleDTO.setGroupIdx( Integer.valueOf( sesGroupIdx.toString() ) );
|
|
|
+ roleDTO = roleService.selectNowPathRoleCheckData( roleDTO );
|
|
|
+
|
|
|
+ roleMap.put( "_CREATE", roleDTO.getCreateYn() );
|
|
|
+ roleMap.put( "_READ", roleDTO.getReadYn() );
|
|
|
+ roleMap.put( "_UPDATE", roleDTO.getUpdateYn() );
|
|
|
+ roleMap.put( "_DELETE", roleDTO.getDeleteYn() );
|
|
|
+ }
|
|
|
+
|
|
|
+ mv.addObject( "role", roleMap );
|
|
|
mv.addObject( "data", hashMap );
|
|
|
mv.setViewName( viewPath );
|
|
|
|