コード例 #1
0
  /**
   * 去除角色包含角色
   *
   * @throws Exception
   */
  public String removeHaveRole() throws Exception {
    String type = Struts2Utils.getParameter("type");
    long id = Struts2Utils.getLongParameter("id", 0);
    long haveId = Struts2Utils.getLongParameter("haveId", 0);

    String jsonStr;
    try {
      RightHold rightHold = rightHoldManager.getRightHold(type, id);
      Role haveRole = roleManager.getRole(haveId);

      rightHoldManager.removeHaveRole(rightHold, haveRole);

      jsonStr = JsonHelper.combinSuccessJsonString("data", haveId);
    } catch (Exception e) {
      jsonStr = JsonHelper.combinFailJsonString(e);
    }

    Struts2Utils.renderJson(jsonStr);
    return null;
  }
コード例 #2
0
  /**
   * 添加角色包含许可
   *
   * @throws Exception
   */
  public String addHavePermission() throws Exception {
    String type = Struts2Utils.getParameter("type");
    long id = Struts2Utils.getLongParameter("id", 0);
    String objectCode = Struts2Utils.getParameter("objectCode");
    String haveOperations = Struts2Utils.getParameter("haveOperations");

    String jsonStr;
    try {
      RightHold rightHold = rightHoldManager.getRightHold(type, id);
      Permission permission =
          rightHoldManager.addHavePermission(rightHold, objectCode, haveOperations, "");

      jsonStr = JsonHelper.combinSuccessJsonString("data", permission);
    } catch (Exception e) {
      jsonStr = JsonHelper.combinFailJsonString(e);
    }

    Struts2Utils.renderJson(jsonStr);
    return null;
  }