From 58a178f7d48815b1bf8bd70806115efde0002be2 Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Sun, 21 Apr 2013 16:39:24 -0700 Subject: [PATCH] Update JS library Signed-off-by: Andrew Kim --- .../controller/flows/web/Flows.java.rej | 85 ------------------- .../src/main/resources/WEB-INF/jsp/main.jsp | 6 +- .../web/root/src/main/resources/js/lib.js | 40 +++++---- 3 files changed, 25 insertions(+), 106 deletions(-) delete mode 100644 opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java.rej diff --git a/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java.rej b/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java.rej deleted file mode 100644 index 7b03d3434e..0000000000 --- a/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java.rej +++ /dev/null @@ -1,85 +0,0 @@ -*************** -*** 29,35 **** - import org.opendaylight.controller.switchmanager.SwitchConfig; - import org.opendaylight.controller.usermanager.IUserManager; - import org.opendaylight.controller.web.IOneWeb; -- import org.springframework.security.core.context.SecurityContextHolder; - import org.springframework.stereotype.Controller; - import org.springframework.web.bind.annotation.PathVariable; - import org.springframework.web.bind.annotation.RequestMapping; ---- 31,36 ---- - import org.opendaylight.controller.switchmanager.SwitchConfig; - import org.opendaylight.controller.usermanager.IUserManager; - import org.opendaylight.controller.web.IOneWeb; - import org.springframework.stereotype.Controller; - import org.springframework.web.bind.annotation.PathVariable; - import org.springframework.web.bind.annotation.RequestMapping; -*************** -*** 182,189 **** - @RequestMapping(value = "/flow", method = RequestMethod.POST) - @ResponseBody - public String actionFlow(@RequestParam(required = true) String action, -- @RequestParam(required = false) String body, @RequestParam(required = true) String nodeId) { -- if (!authorize(UserLevel.NETWORKADMIN)) { - return "Operation not authorized"; - } - ---- 183,190 ---- - @RequestMapping(value = "/flow", method = RequestMethod.POST) - @ResponseBody - public String actionFlow(@RequestParam(required = true) String action, -+ @RequestParam(required = false) String body, @RequestParam(required = true) String nodeId, HttpServletRequest request) { -+ if (!authorize(UserLevel.NETWORKADMIN, request)) { - return "Operation not authorized"; - } - -*************** -*** 206,213 **** - @RequestMapping(value = "/flow/{nodeId}/{name}", method = RequestMethod.POST) - @ResponseBody - public String removeFlow(@PathVariable("nodeId") String nodeId, @PathVariable("name") String name, -- @RequestParam(required = true) String action) { -- if (!authorize(UserLevel.NETWORKADMIN)) { return "Operation not authorized"; } - - IForwardingRulesManager frm = (IForwardingRulesManager) ServiceHelper - .getInstance(IForwardingRulesManager.class, "default", this); ---- 207,214 ---- - @RequestMapping(value = "/flow/{nodeId}/{name}", method = RequestMethod.POST) - @ResponseBody - public String removeFlow(@PathVariable("nodeId") String nodeId, @PathVariable("name") String name, -+ @RequestParam(required = true) String action, HttpServletRequest request) { -+ if (!authorize(UserLevel.NETWORKADMIN, request)) { return "Operation not authorized"; } - - IForwardingRulesManager frm = (IForwardingRulesManager) ServiceHelper - .getInstance(IForwardingRulesManager.class, "default", this); -*************** -*** 235,248 **** - * - * @param level - */ -- private boolean authorize(UserLevel level) { - IUserManager userManager = (IUserManager) ServiceHelper - .getGlobalInstance(IUserManager.class, this); - if (userManager == null) { - return false; - } - -- String username = SecurityContextHolder.getContext().getAuthentication().getName(); - UserLevel userLevel = userManager.getUserLevel(username); - if (userLevel.toNumber() <= level.toNumber()) { - return true; ---- 236,249 ---- - * - * @param level - */ -+ private boolean authorize(UserLevel level, HttpServletRequest request) { - IUserManager userManager = (IUserManager) ServiceHelper - .getGlobalInstance(IUserManager.class, this); - if (userManager == null) { - return false; - } - -+ String username = request.getUserPrincipal().getName(); - UserLevel userLevel = userManager.getUserLevel(username); - if (userLevel.toNumber() <= level.toNumber()) { - return true; diff --git a/opendaylight/web/root/src/main/resources/WEB-INF/jsp/main.jsp b/opendaylight/web/root/src/main/resources/WEB-INF/jsp/main.jsp index a3d9dcff63..863b0a64a0 100644 --- a/opendaylight/web/root/src/main/resources/WEB-INF/jsp/main.jsp +++ b/opendaylight/web/root/src/main/resources/WEB-INF/jsp/main.jsp @@ -56,12 +56,12 @@