Add configurable support for admin profile.
This commit is contained in:
@@ -18,7 +18,7 @@ public class AdminController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "admin/users/{id}", produces = {"application/xml", "application/json"})
|
||||
@RequestMapping(method = RequestMethod.GET, value = "admin/users/{id}", produces = {"application/xml", "application/json","text/html"})
|
||||
@ResponseBody
|
||||
public ModelAndView getUserById(@PathVariable int id) throws IOException {
|
||||
final User userBy = userService.getUserBy(id);
|
||||
@@ -28,22 +28,24 @@ public class AdminController {
|
||||
return new ModelAndView("userView", "user", new RestUser(userBy));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "admin/users/email/{email}", produces = {"application/xml", "application/json"})
|
||||
@RequestMapping(method = RequestMethod.GET, value = "admin/users/email/{email}", produces = {"application/xml", "application/json","text/html"})
|
||||
@ResponseBody
|
||||
public ModelAndView getUserByEmail(@PathVariable String email) throws IOException {
|
||||
final User userBy = userService.getUserBy(email);
|
||||
if (userBy == null) {
|
||||
throw new IllegalArgumentException("User could not be found");
|
||||
throw new IllegalArgumentException("User '" + email + "' could not be found" );
|
||||
}
|
||||
return new ModelAndView("userView", "user", new RestUser(userBy));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = "admin/users", consumes = {"application/xml", "application/json"})
|
||||
public void getUserByEmail(@RequestBody RestUser user) throws IOException, WiseMappingException {
|
||||
public ModelAndView getUserByEmail(@RequestBody RestUser user) throws IOException, WiseMappingException {
|
||||
if (user == null) {
|
||||
throw new IllegalArgumentException("User could not be found");
|
||||
}
|
||||
userService.createUser(user.getDelegated(), false);
|
||||
return new ModelAndView("responseView", "message", "User created successfully");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user