package edu.northwestern.bioinformatics.studycalendar.web;

import edu.northwestern.bioinformatics.studycalendar.service.PscUserService;
import edu.northwestern.bioinformatics.studycalendar.web.accesscontrol.PscAuthorizedHandler;
import edu.northwestern.bioinformatics.studycalendar.web.accesscontrol.ResourceAuthorization;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.Map;

import static edu.northwestern.bioinformatics.studycalendar.security.authorization.PscRole.*;

public class ListUsersController extends PscSimpleFormController implements PscAuthorizedHandler {
    private PscUserService pscUserService;

    @Override
    public Collection<ResourceAuthorization> authorizations(String httpMethod, Map<String, String[]> queryParameters) {
        return ResourceAuthorization.createCollection(SYSTEM_ADMINISTRATOR, USER_ADMINISTRATOR);
    }

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
        return new ModelAndView("admin/users", "users", pscUserService.getAllUsers());
    }

    ////// CONFIGURATION

    @Required
    public void setPscUserService(PscUserService pscUserService) {
        this.pscUserService = pscUserService;
    }
}

@@ -57,85 +57,8 @@
 b;%0A%0A
-import edu.northwestern.bioinformatics.studycalendar.service.PscUserService;%0A
 impo
@@ -146,16 +146,16 @@
 andler;%0A
+
 import e
@@ -244,70 +244,8 @@
 on;%0A
-import org.springframework.beans.factory.annotation.Required;%0A
 impo
@@ -582,18 +582,16 @@
  Psc
-SimpleForm
+Abstract
 Cont
@@ -635,66 +635,8 @@
 r %7B%0A
-    private PscUserService pscUserService;%0A%0A    @Override%0A
     
@@ -1044,208 +1044,9 @@
 ers%22
-, %22users%22, pscUserService.getAllUsers());%0A    %7D%0A%0A    ////// CONFIGURATION%0A%0A    @Required%0A    public void setPscUserService(PscUserService pscUserService) %7B%0A        this.pscUserService = pscUserService
+)
 ;%0A  

Simplify controller since the page is all dynamic now. #1129.