Commit 25445085 authored by michael.simon's avatar michael.simon
Browse files

expose user ids from normal or admin user via servlet attribute

parent a83ac076
......@@ -29,7 +29,6 @@ import edu.kit.scc.webreg.sec.SecurityFilter;
import edu.kit.scc.webreg.service.RegistryService;
import edu.kit.scc.webreg.service.ServiceService;
import edu.kit.scc.webreg.service.UserService;
import edu.kit.scc.webreg.util.SessionManager;
@Path("/service-admin")
public class ServiceAdminController {
......@@ -46,9 +45,6 @@ public class ServiceAdminController {
@Inject
private ServiceService serviceService;
@Inject
private SessionManager sessionManager;
@Path(value = "/depro/list/{ssn}")
@Produces({"application/json"})
@GET
......@@ -56,8 +52,8 @@ public class ServiceAdminController {
throws IOException, NoItemFoundException {
ServiceEntity serviceEntity = serviceService.findByShortName(ssn);
System.out.println("" + sessionManager.getUserId());
System.out.println("" + request.getAttribute(SecurityFilter.ADMIN_USER));
System.out.println("" + request.getAttribute(SecurityFilter.ADMIN_USER_ID));
System.out.println("" + request.getAttribute(SecurityFilter.USER_ID));
List<RegistryEntityDto> deproList = registryDtoService.findRegistriesForDepro(serviceEntity.getShortName());
return deproList;
......
......@@ -41,7 +41,8 @@ import edu.kit.scc.webreg.util.SessionManager;
@WebFilter(urlPatterns = {"/*"})
public class SecurityFilter implements Filter {
public static final String ADMIN_USER = "_admin_user";
public static final String ADMIN_USER_ID = "_admin_user_id";
public static final String USER_ID = "_user_id";
@Inject
private Logger logger;
......@@ -147,7 +148,8 @@ public class SecurityFilter implements Filter {
session.setRoles(roles);
if (accessChecker.check(path, roles)) {
request.setAttribute(ADMIN_USER, adminUser.getId());
request.setAttribute(ADMIN_USER_ID, adminUser.getId());
request.setAttribute(USER_ID, session.getUserId());
chain.doFilter(request, response);
}
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment