sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject sqoop git commit: SQOOP-2019: Sqoop2: Handle post-function for updating/deleting resource
Date Thu, 19 Feb 2015 19:58:47 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 263e36204 -> 4d539410d


SQOOP-2019: Sqoop2: Handle post-function for updating/deleting resource

(Richard Zhou via Abraham Elmahrek)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/4d539410
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/4d539410
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/4d539410

Branch: refs/heads/sqoop2
Commit: 4d539410d2336e2a164b4141f46114a8f7ea1176
Parents: 263e362
Author: Abraham Elmahrek <abe@apache.org>
Authored: Thu Feb 19 11:51:31 2015 -0800
Committer: Abraham Elmahrek <abe@apache.org>
Committed: Thu Feb 19 11:51:31 2015 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/sqoop/handler/JobRequestHandler.java    | 4 ++++
 .../main/java/org/apache/sqoop/handler/LinkRequestHandler.java   | 4 ++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/4d539410/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java b/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
index f3f8c53..6dae043 100644
--- a/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
@@ -42,12 +42,14 @@ import org.apache.sqoop.model.MDriverConfig;
 import org.apache.sqoop.model.MFromConfig;
 import org.apache.sqoop.model.MJob;
 import org.apache.sqoop.model.MPersistableEntity;
+import org.apache.sqoop.model.MResource;
 import org.apache.sqoop.model.MSubmission;
 import org.apache.sqoop.model.MToConfig;
 import org.apache.sqoop.repository.Repository;
 import org.apache.sqoop.repository.RepositoryManager;
 import org.apache.sqoop.request.HttpEventContext;
 import org.apache.sqoop.security.Authorization.AuthorizationEngine;
+import org.apache.sqoop.security.AuthorizationManager;
 import org.apache.sqoop.server.RequestContext;
 import org.apache.sqoop.server.RequestHandler;
 import org.apache.sqoop.error.code.ServerError;
@@ -145,6 +147,8 @@ public class JobRequestHandler implements RequestHandler {
     AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
         ctx.getRequest().getRemoteAddr(), "delete", "job", jobIdentifier);
     repository.deleteJob(jobId);
+    MResource resource = new MResource(String.valueOf(jobId), AuthorizationEngine.ResourceType.JOB.name());
+    AuthorizationManager.getAuthorizationHandler().removeResource(resource);
     return JsonBean.EMPTY_BEAN;
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/4d539410/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java b/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
index 7041c2d..0bffc63 100644
--- a/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
@@ -36,9 +36,11 @@ import org.apache.sqoop.model.ConfigUtils;
 import org.apache.sqoop.model.MLink;
 import org.apache.sqoop.model.MLinkConfig;
 import org.apache.sqoop.model.MPersistableEntity;
+import org.apache.sqoop.model.MResource;
 import org.apache.sqoop.repository.Repository;
 import org.apache.sqoop.repository.RepositoryManager;
 import org.apache.sqoop.security.Authorization.AuthorizationEngine;
+import org.apache.sqoop.security.AuthorizationManager;
 import org.apache.sqoop.server.RequestContext;
 import org.apache.sqoop.server.RequestHandler;
 import org.apache.sqoop.error.code.ServerError;
@@ -99,6 +101,8 @@ public class LinkRequestHandler implements RequestHandler {
         ctx.getRequest().getRemoteAddr(), "delete", "link", linkIdentifier);
 
     repository.deleteLink(linkId);
+    MResource resource = new MResource(String.valueOf(linkId), AuthorizationEngine.ResourceType.LINK.name());
+    AuthorizationManager.getAuthorizationHandler().removeResource(resource);
     return JsonBean.EMPTY_BEAN;
   }
 


Mime
View raw message