in app/src/main/java/com/amazon/aws/partners/saasfactory/pgrls/controller/TenantController.java [120:136]
public String editUser(Authentication authentication, @RequestParam("id") String id, Model model) {
UUID userId = UUID.fromString(id);
User user = tenantService.getUser(userId);
if (user == null) {
// For this demo, just to show RLS in action, see if the user exists
if (adminService.userExists(userId)) {
Tenant authenticatedTenant = (Tenant) authentication.getPrincipal();
model.addAttribute("css", "danger");
model.addAttribute("msg", "Row Level Security policies prevented " + authenticatedTenant.getId().toString() + " from accessing user " + userId);
} else {
model.addAttribute("css", "danger");
model.addAttribute("msg", "No tenant for id " + id);
}
}
model.addAttribute("user", user);
return "editUser";
}