Beispiel #1
0
 /**
  * 修改权限
  *
  * @return 跳转成功
  */
 public String modify() {
   entityId = (String) session.get("rightId");
   // 修改基本信息
   Right mright = (Right) rolerightservice.query(Right.class, entityId);
   if (mright == null) {
     request.setAttribute("tip", "不存在的权限");
     return INPUT;
   }
   if (!mright.getName().equals(right.getName())) {
     // 检查权限名称是否存在
     if (rolerightservice.checkRightName(right.getName())) {
       request.setAttribute("tip", "该权限名已存在");
       return INPUT;
     }
   }
   if (!mright.getCode().equals(right.getCode())) {
     // 检查权限代码是否存在
     if (rolerightservice.checkRightCode(right.getCode())) {
       request.setAttribute("tip", "改权限代码已存在");
       return INPUT;
     }
   }
   mright.setName(right.getName());
   mright.setDescription(right.getDescription());
   rolerightservice.modifyRight(mright, actionUrlArray, actionDesArray);
   List<Object> rightUrl =
       baseService.query(
           "select right0.name, right_action.actionurl from Right right0, RightUrl right_action where right0.id = right_action.right.id order by right_action.actionurl asc");
   request.getSession().getServletContext().setAttribute("rightUrl", rightUrl);
   return SUCCESS;
 }
Beispiel #2
0
 /**
  * 进入修改权限
  *
  * @return 跳转成功
  */
 public String toModify() {
   session.put("rightId", entityId);
   // 获取权限基本信息
   right = (Right) rolerightservice.query(Right.class, entityId);
   if (right == null) {
     request.setAttribute("errorInfo", "不存在的权限");
     return INPUT;
   }
   // 获取权限action信息
   StringBuffer hql = new StringBuffer();
   Map map = new HashMap();
   hql.append(
       "from RightUrl right_action where right_action.right.id = :rightId order by right_action.actionurl");
   map.put("rightId", entityId);
   pageList = rolerightservice.query(hql.toString(), map);
   return SUCCESS;
 }
Beispiel #3
0
 /**
  * 查看权限
  *
  * @return 跳转成功
  */
 public String view() {
   // 获取角色基本信息
   right = (Right) rolerightservice.query(Right.class, entityId);
   if (right == null) {
     this.addFieldError(GlobalInfo.ERROR_INFO, "不存在的权限");
     jsonMap.put(GlobalInfo.ERROR_INFO, "不存在的权限");
     return INPUT;
   }
   // 获取角色的权限信息
   StringBuffer hql = new StringBuffer();
   Map map = new HashMap();
   hql.append(
       "from RightUrl right_action where right_action.right.id = :rightId order by right_action.actionurl asc");
   map.put("rightId", entityId);
   pageList = rolerightservice.query(hql.toString(), map);
   jsonMap.put("right", right);
   jsonMap.put("pageList", pageList);
   return SUCCESS;
 }