use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.
the class ProjectRoleAction method list.
@AuthPassport(validate = true)
@RequestMapping(value = "list", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> list(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
Long orgId = userVo.getDefaultOrgId();
String keywords = json.getString("keywords");
String disabled = json.getString("disabled");
List<ProjectRoleVo> vos = projectRoleService.list(orgId, keywords, disabled);
ret.put("data", vos);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.
the class ProjectRoleAction method get.
@AuthPassport(validate = true)
@RequestMapping(value = "get", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> get(HttpServletRequest request, @RequestBody JSONObject req) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
Long orgId = userVo.getDefaultOrgId();
Long roleId = req.getLong("id");
Map<String, List<ProjectPrivilegeDefineVo>> orgPrivileges = projectPrivilegeService.listPrivilegesByOrgAndProjectRole(orgId, roleId);
if (roleId == null) {
ret.put("projectRole", new ProjectRoleVo());
ret.put("projectPrivileges", orgPrivileges);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
TestProjectRoleForOrg po = (TestProjectRoleForOrg) projectRoleService.get(TestProjectRoleForOrg.class, roleId);
ProjectRoleVo vo = projectRoleService.genVo(po);
ret.put("projectRole", vo);
ret.put("projectPrivileges", orgPrivileges);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.
the class ReportAction method plan.
@AuthPassport(validate = true)
@RequestMapping(value = "plan", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> plan(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
Map<String, Object> data = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
List<Map<Object, Object>> resultReport = reportService.chart_execution_result_by_plan(json.getLong("planId"), 14);
Map<String, List<Object>> processReport = reportService.chart_execution_process_by_plan(json.getLong("planId"), 14);
Map<String, List<Object>> progressReport = reportService.chart_execution_progress_by_plan(json.getLong("planId"), 14);
data.put("result", resultReport);
data.put("process", processReport);
data.put("progress", progressReport);
ret.put("data", data);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.
the class RunAction method saveCases.
@AuthPassport(validate = true)
@RequestMapping(value = "saveCases", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> saveCases(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
TestRun po = runService.saveCases(json, userVo);
TestRunVo caseVo = runService.genVo(po);
ret.put("data", caseVo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.
the class RunAction method get.
// @AuthPassport(validate = true)
// @RequestMapping(value = "loadCase", method = RequestMethod.POST)
// @ResponseBody
// public Map<String, Object> loadCase(HttpServletRequest request, @RequestBody JSONObject json) {
// Map<String, Object> ret = new HashMap<String, Object>();
//
// Long orgId = json.getLong("orgId");
// Long projectId = json.getLong("projectId");
// Long runId = json.getLong("runId");
//
// List<TestCaseInRun> ls = runService.lodaCase(runId);
// List<TestCaseInRunVo> vos = runService.genCaseVos(ls);
//
// List<CustomFieldVo> customFieldList = customFieldService.listForCaseByProject(orgId, projectId);
//
// ret.put("data", vos);
// ret.put("customFields", customFieldList);
// ret.put("code", Constant.RespCode.SUCCESS.getCode());
// return ret;
// }
@AuthPassport(validate = true)
@RequestMapping(value = "get", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> get(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
Long runId = json.getLong("id");
TestRunVo vo = runService.getById(runId);
ret.put("data", vo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
Aggregations