Ejemplo n.º 1
0
 @ResponseBody
 @RequestMapping(value = "/getgroups", method = RequestMethod.GET)
 public List<Group> getGroups(@AuthenticationPrincipal ElearningUserDetails principal) {
   if (AccountUtils.isStudent(principal)) {
     return groupService.getActiveGroups(Long.valueOf(principal.getAccountId()));
   } else {
     return groupService.getOwnedGroups(Long.valueOf(principal.getAccountId()));
   }
 }
Ejemplo n.º 2
0
 @ResponseBody
 @RequestMapping(value = "/create", method = RequestMethod.POST)
 public List<Group> create(
     @RequestParam("title") String title,
     @AuthenticationPrincipal ElearningUserDetails principal) {
   groupService.createGroup(principal.getUsername(), title);
   System.out.println("console=" + AccountUtils.isStudent(principal));
   if (AccountUtils.isStudent(principal)) {
     return groupService.getActiveGroups(Long.valueOf(principal.getAccountId()));
   } else {
     return groupService.getOwnedGroups(Long.valueOf(principal.getAccountId()));
   }
 }
Ejemplo n.º 3
0
 @ResponseBody
 @RequestMapping(value = "/sendmessage", method = RequestMethod.POST)
 public String sendMessage(
     @AuthenticationPrincipal ElearningUserDetails principal,
     @RequestParam("id") Long groupId,
     @RequestParam("content") String content) {
   groupService.createGroupMessage(principal.getUsername(), groupId, content);
   return OK;
 }