Commit 340f8637 by nixonrodrigues

ATLAS-2442:- Fix for read-only permission to allow read entity when http method is POST

parent 19d67a13
......@@ -40,7 +40,7 @@ public class AtlasAccessRequest {
public AtlasAccessRequest(HttpServletRequest request, String user, Set<String> userGroups) {
// Spring Security 4 Change => request.getServletPath() -> request.getPathInfo()
this(AtlasAuthorizationUtils.getAtlasResourceType(request.getPathInfo()), "*", AtlasAuthorizationUtils
.getAtlasAction(request.getMethod()), user, userGroups,AtlasAuthorizationUtils.getRequestIpAddress(request));
.getAtlasAction(request.getMethod(),request.getPathInfo()), user, userGroups,AtlasAuthorizationUtils.getRequestIpAddress(request));
}
public AtlasAccessRequest(Set<AtlasResourceTypes> resourceType, String resource, AtlasActionTypes action,
......
......@@ -71,12 +71,17 @@ public class AtlasAuthorizationUtils {
return api;
}
public static AtlasActionTypes getAtlasAction(String method) {
public static AtlasActionTypes getAtlasAction(String method, String contextPath) {
AtlasActionTypes action = null;
switch (method.toUpperCase()) {
case "POST":
action = AtlasActionTypes.CREATE;
String api = getApi(contextPath);
if (api != null && api.startsWith("search")) { // exceptional case for basic search api with POST method
action = AtlasActionTypes.READ;
} else {
action = AtlasActionTypes.CREATE;
}
break;
case "GET":
action = AtlasActionTypes.READ;
......
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