1 26 package org.snipsnap.net.admin; 27 28 import org.snipsnap.config.Configuration; 29 30 import javax.servlet.http.HttpServletRequest ; 31 import javax.servlet.http.HttpServletResponse ; 32 import java.util.Map ; 33 34 public class SetupPermissions implements SetupHandler { 35 public String getName() { 36 return "permissions"; 37 } 38 39 public Map setup(HttpServletRequest request, HttpServletResponse response, Configuration config, Map errors) { 40 config.setPermRegister(allowDeny(request.getParameter(Configuration.APP_PERM_REGISTER))); 41 config.setPermWeblogsPing(allowDeny(request.getParameter(Configuration.APP_PERM_WEBLOGSPING))); 42 config.setPermNotification(allowDeny(request.getParameter(Configuration.APP_PERM_NOTIFICATION))); 43 config.setPermExternalImages(allowDeny(request.getParameter(Configuration.APP_PERM_EXTERNALIMAGES))); 44 config.setPermMultiplePosts(allowDeny(request.getParameter(Configuration.APP_PERM_MULTIPLEPOSTS))); 45 return errors; 46 } 47 48 private String allowDeny(String value) { 49 if ("allow".equals(value)) { 50 return value; 51 } else { 52 return "deny"; 53 } 54 } 55 } 56 | Popular Tags |