parent
c53abbe0ff
commit
6db7f9f74d
|
@ -4,6 +4,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.User;
|
||||
import org.bench4q.master.domain.service.UserService;
|
||||
import org.bench4q.master.domain.service.auth.AuthenticationManager;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
|
@ -68,4 +69,11 @@ public abstract class BaseController {
|
|||
scope);
|
||||
}
|
||||
|
||||
protected void guardHasAuthentication(String extraMessage, String apiUrl)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(HAVE_NO_POWER, extraMessage, apiUrl);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -292,13 +292,21 @@ public class TestPlanController extends BaseController {
|
|||
public ScriptBriefResultModel getLatestScriptResult(
|
||||
@PathVariable UUID testPlanId, @PathVariable int scriptId)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(HAVE_NO_POWER,
|
||||
guardHasAuthentication(
|
||||
"You have not power to get test plan script brief",
|
||||
"/getLatestScriptResult");
|
||||
}
|
||||
return this.getTestPlanScriptResultService()
|
||||
.getLatestScriptBriefResultModel(testPlanId, scriptId);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/stop/{testPlanId}")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@ResponseBody
|
||||
public TestPlanResponseModel stop(@PathVariable UUID testPlanId)
|
||||
throws Bench4QException {
|
||||
guardHasAuthentication("You have no power to stop test plan",
|
||||
"/stop/{testPlanId}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue