You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2014/12/23 21:37:44 UTC

[11/14] incubator-nifi git commit: NIFI-65: - Code clean up. - Updating authorizeDownload(...) to accept the dnChain in the appropriate order.

NIFI-65:
- Code clean up.
- Updating authorizeDownload(...) to accept the dnChain in the appropriate order.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/469502f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/469502f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/469502f3

Branch: refs/heads/develop
Commit: 469502f30ca01953bceabca590bea8e183ed2c7d
Parents: 7a29166
Author: Matt Gilman <ma...@gmail.com>
Authored: Tue Dec 23 13:00:38 2014 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Dec 23 13:00:38 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/nifi/web/controller/ControllerFacade.java | 5 ++---
 .../java/org/apache/nifi/authorization/AuthorityProvider.java | 7 ++++---
 .../org/apache/nifi/authorization/DownloadAuthorization.java  | 5 +++--
 3 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/469502f3/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java
----------------------------------------------------------------------
diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java b/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java
index 99440bc..07e3150 100644
--- a/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java
+++ b/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java
@@ -26,7 +26,6 @@ import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -796,13 +795,13 @@ public class ControllerFacade implements ControllerServiceProvider {
             final Map<String, String> attributes = event.getAttributes();
 
             // calculate the dn chain
-            final LinkedList<String> dnChain = new LinkedList<>();
+            final List<String> dnChain = new ArrayList<>();
 
             // build the dn chain
             NiFiUser chainedUser = user;
             do {
                 // add the entry for this user
-                dnChain.push(chainedUser.getDn());
+                dnChain.add(chainedUser.getDn());
 
                 // go to the next user in the chain
                 chainedUser = chainedUser.getChain();

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/469502f3/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProvider.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProvider.java b/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProvider.java
index da536c2..7754c35 100644
--- a/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProvider.java
+++ b/nifi-api/src/main/java/org/apache/nifi/authorization/AuthorityProvider.java
@@ -142,9 +142,10 @@ public interface AuthorityProvider {
      * Determines whether the user in the specified dnChain should be able to 
      * download the content for the flowfile with the specified attributes.
      * 
-     * The last dn in the chain is the end user that the request was issued on 
-     * behalf of. The previous dn's in the chain represent entities proxying the 
-     * user's request.
+     * The first dn in the chain is the end user that the request was issued on 
+     * behalf of. The subsequent dn's in the chain represent entities proxying
+     * the user's request with the last being the proxy that sent the current
+     * request.
      * 
      * @param dnChain
      * @param attributes

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/469502f3/nifi-api/src/main/java/org/apache/nifi/authorization/DownloadAuthorization.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/authorization/DownloadAuthorization.java b/nifi-api/src/main/java/org/apache/nifi/authorization/DownloadAuthorization.java
index 3855817..08695fa 100644
--- a/nifi-api/src/main/java/org/apache/nifi/authorization/DownloadAuthorization.java
+++ b/nifi-api/src/main/java/org/apache/nifi/authorization/DownloadAuthorization.java
@@ -39,7 +39,7 @@ public class DownloadAuthorization {
      */
     private DownloadAuthorization(Result result, String explanation) {
         if (Result.Denied.equals(result) && explanation == null) {
-            throw new IllegalArgumentException("An explanation is request when the download request is denied.");
+            throw new IllegalArgumentException("An explanation is required when the download request is denied.");
         }
 
         this.result = result;
@@ -74,10 +74,11 @@ public class DownloadAuthorization {
     }
 
     /**
-     * Creates a new denied DownloadAuthorization with the specified exlanation.
+     * Creates a new denied DownloadAuthorization with the specified explanation.
      * 
      * @param explanation
      * @return 
+     * @throws IllegalArgumentException     if explanation is null
      */
     public static DownloadAuthorization denied(String explanation) {
         return new DownloadAuthorization(Result.Denied, explanation);