You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2016/07/12 21:00:12 UTC
[9/9] nifi git commit: NIFI-2095: - Adding a page for managing users
and groups. - Adding a page for managing access policies. - Renaming
accessPolicy in entity to permissions to avoid confusion with the
accessPolicy model. - Adding an Authorizable for a
NIFI-2095:
- Adding a page for managing users and groups.
- Adding a page for managing access policies.
- Renaming accessPolicy in entity to permissions to avoid confusion with the accessPolicy model.
- Adding an Authorizable for access policies.
- Refactoring access policies endpoints.
NIFI-2022:
- Implementing site to site authorizations.
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/e0c96794
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/e0c96794
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/e0c96794
Branch: refs/heads/master
Commit: e0c96794fae85776b8b0fbb3cb236217eb591960
Parents: ba763b9
Author: Matt Gilman <ma...@gmail.com>
Authored: Tue Jul 12 15:45:13 2016 -0400
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 12 15:45:13 2016 -0400
----------------------------------------------------------------------
.../nifi/authorization/RequestAction.java | 25 +-
.../remote/util/SiteToSiteRestApiClient.java | 2 +-
.../nifi/remote/client/http/TestHttpClient.java | 36 +-
.../http/TestHttpClientTransaction.java | 18 +-
.../nifi/web/api/dto/AccessPolicyDTO.java | 47 +-
.../web/api/dto/AccessPolicySummaryDTO.java | 59 +
.../apache/nifi/web/api/dto/PermissionsDTO.java | 61 ++
.../org/apache/nifi/web/api/dto/UserDTO.java | 22 +-
.../apache/nifi/web/api/dto/UserGroupDTO.java | 17 +
.../nifi/web/api/entity/AccessPolicyEntity.java | 15 +
.../api/entity/AccessPolicySummaryEntity.java | 45 +
.../nifi/web/api/entity/ComponentEntity.java | 18 +-
.../entity/ControllerConfigurationEntity.java | 18 +-
.../nifi/web/api/entity/CurrentUserEntity.java | 46 +-
.../web/api/entity/FlowBreadcrumbEntity.java | 18 +-
.../nifi/web/api/entity/ProcessGroupEntity.java | 6 +-
.../web/api/entity/ProcessGroupFlowEntity.java | 16 +-
.../web/api/entity/TenantCollectionEntity.java | 43 +
.../nifi/web/api/entity/TenantsEntity.java | 57 +
.../apache/nifi/web/api/entity/UsersEntity.java | 17 +
.../resource/AccessPoliciesAuthorizable.java | 32 -
.../resource/AccessPolicyAuthorizable.java | 43 +-
.../resource/DataTransferAuthorizable.java | 40 +
.../authorization/resource/ResourceFactory.java | 74 +-
.../authorization/resource/ResourceType.java | 21 +-
.../nifi/remote/StandardRootGroupPort.java | 18 +-
.../org/apache/nifi/web/AuthorizableLookup.java | 31 +-
.../org/apache/nifi/web/NiFiServiceFacade.java | 25 +-
.../nifi/web/StandardAuthorizableLookup.java | 253 ++++-
.../nifi/web/StandardNiFiServiceFacade.java | 372 ++++---
.../nifi/web/api/AccessPolicyResource.java | 144 ++-
.../nifi/web/api/ApplicationResource.java | 218 +++-
.../nifi/web/api/DataTransferResource.java | 837 ++++++++++++++
.../org/apache/nifi/web/api/FlowResource.java | 130 ++-
.../apache/nifi/web/api/SiteToSiteResource.java | 948 +---------------
.../apache/nifi/web/api/TenantsResource.java | 144 ++-
.../org/apache/nifi/web/api/dto/DtoFactory.java | 83 +-
.../apache/nifi/web/api/dto/EntityFactory.java | 124 ++-
.../nifi/web/controller/ControllerFacade.java | 10 +
.../apache/nifi/web/dao/AccessPolicyDAO.java | 13 +-
.../org/apache/nifi/web/dao/UserGroupDAO.java | 9 +
.../impl/StandardPolicyBasedAuthorizerDAO.java | 61 +-
.../src/main/resources/nifi-web-api-context.xml | 6 +
.../web/StandardNiFiServiceFacadeSpec.groovy | 24 +-
.../StandardPolicyBasedAuthorizerDAOSpec.groovy | 13 +-
.../ITConnectionAccessControl.java | 32 +-
.../accesscontrol/ITFunnelAccessControl.java | 32 +-
.../accesscontrol/ITInputPortAccessControl.java | 32 +-
.../accesscontrol/ITLabelAccessControl.java | 32 +-
.../ITOutputPortAccessControl.java | 32 +-
.../ITProcessGroupAccessControl.java | 32 +-
.../accesscontrol/ITProcessorAccessControl.java | 48 +-
.../nifi/web/api/TestDataTransferResource.java | 355 ++++++
.../nifi/web/api/TestSiteToSiteResource.java | 389 +------
.../nifi-framework/nifi-web/nifi-web-ui/pom.xml | 45 +-
.../resources/filters/bulletin-board.properties | 3 +-
.../main/resources/filters/canvas.properties | 5 +-
.../main/resources/filters/cluster.properties | 3 +-
.../main/resources/filters/counters.properties | 3 +-
.../main/resources/filters/history.properties | 3 +-
.../resources/filters/provenance.properties | 3 +-
.../main/resources/filters/summary.properties | 3 +-
.../main/resources/filters/templates.properties | 3 +-
.../main/resources/filters/users-min.properties | 18 +
.../src/main/resources/filters/users.properties | 29 +
.../src/main/webapp/WEB-INF/pages/canvas.jsp | 2 +
.../src/main/webapp/WEB-INF/pages/users.jsp | 70 ++
.../WEB-INF/partials/canvas/canvas-header.jsp | 11 +-
.../WEB-INF/partials/canvas/navigation.jsp | 6 +
.../partials/canvas/policy-management.jsp | 92 ++
.../partials/canvas/search-users-dialog.jsp | 23 +
.../partials/users/user-delete-dialog.jsp | 21 +
.../WEB-INF/partials/users/user-dialog.jsp | 48 +
.../WEB-INF/partials/users/users-content.jsp | 41 +
.../nifi-web-ui/src/main/webapp/css/canvas.css | 2 +-
.../nifi-web-ui/src/main/webapp/css/header.css | 9 -
.../nifi-web-ui/src/main/webapp/css/main.css | 3 +-
.../src/main/webapp/css/policy-management.css | 205 ++++
.../main/webapp/css/process-group-details.css | 22 -
.../nifi-web-ui/src/main/webapp/css/users.css | 128 +++
.../main/webapp/js/jquery/combo/jquery.combo.js | 59 +-
.../controllers/nf-ng-breadcrumbs-controller.js | 2 +-
.../nf-ng-canvas-flow-status-controller.js | 7 -
.../nf-ng-canvas-global-menu-controller.js | 23 +-
.../nf-ng-canvas-graph-controls-controller.js | 2 +-
.../nf-ng-canvas-operate-controller.js | 2 +-
.../components/nf-ng-template-component.js | 2 +-
.../src/main/webapp/js/nf/canvas/nf-actions.js | 17 +-
.../src/main/webapp/js/nf/canvas/nf-birdseye.js | 4 +-
.../main/webapp/js/nf/canvas/nf-canvas-utils.js | 12 +-
.../src/main/webapp/js/nf/canvas/nf-canvas.js | 18 +-
.../js/nf/canvas/nf-connection-configuration.js | 4 +-
.../main/webapp/js/nf/canvas/nf-connection.js | 22 +-
.../js/nf/canvas/nf-controller-service.js | 8 +-
.../js/nf/canvas/nf-controller-services.js | 37 +-
.../src/main/webapp/js/nf/canvas/nf-funnel.js | 4 +-
.../src/main/webapp/js/nf/canvas/nf-label.js | 10 +-
.../webapp/js/nf/canvas/nf-policy-management.js | 1027 ++++++++++++++++++
.../src/main/webapp/js/nf/canvas/nf-port.js | 12 +-
.../nf/canvas/nf-process-group-configuration.js | 6 +-
.../js/nf/canvas/nf-process-group-details.js | 68 --
.../webapp/js/nf/canvas/nf-process-group.js | 12 +-
.../js/nf/canvas/nf-processor-configuration.js | 2 +-
.../main/webapp/js/nf/canvas/nf-processor.js | 12 +-
.../js/nf/canvas/nf-remote-process-group.js | 18 +-
.../src/main/webapp/js/nf/canvas/nf-settings.js | 33 +-
.../src/main/webapp/js/nf/nf-common.js | 28 +-
.../main/webapp/js/nf/nf-processor-details.js | 2 +-
.../js/nf/templates/nf-templates-table.js | 41 +-
.../main/webapp/js/nf/users/nf-users-table.js | 907 ++++++++++++++++
.../src/main/webapp/js/nf/users/nf-users.js | 147 +++
111 files changed, 6222 insertions(+), 2370 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-api/src/main/java/org/apache/nifi/authorization/RequestAction.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/authorization/RequestAction.java b/nifi-api/src/main/java/org/apache/nifi/authorization/RequestAction.java
index 182988f..3e28a67 100644
--- a/nifi-api/src/main/java/org/apache/nifi/authorization/RequestAction.java
+++ b/nifi-api/src/main/java/org/apache/nifi/authorization/RequestAction.java
@@ -20,6 +20,27 @@ package org.apache.nifi.authorization;
* Actions a user/entity can take on a resource.
*/
public enum RequestAction {
- READ,
- WRITE;
+ READ("read"),
+ WRITE("write");
+
+ private String value;
+
+ RequestAction(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return value.toLowerCase();
+ }
+
+ public static RequestAction valueOfValue(final String action) {
+ if (RequestAction.READ.toString().equals(action)) {
+ return RequestAction.READ;
+ } else if (RequestAction.WRITE.toString().equals(action)) {
+ return RequestAction.WRITE;
+ } else {
+ throw new IllegalArgumentException("Action must be one of [" + READ.toString() + ", " + WRITE.toString() + "]");
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java
index 4195ae9..8910598 100644
--- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java
+++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java
@@ -326,7 +326,7 @@ public class SiteToSiteRestApiClient implements Closeable {
private String initiateTransaction(String portType, String portId) throws IOException {
logger.debug("initiateTransaction handshaking portType={}, portId={}", portType, portId);
- HttpPost post = createPost("/site-to-site/" + portType + "/" + portId + "/transactions");
+ HttpPost post = createPost("/data-transfer/" + portType + "/" + portId + "/transactions");
post.setHeader("Accept", "application/json");
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/http/TestHttpClient.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/http/TestHttpClient.java b/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/http/TestHttpClient.java
index 7240c7a..3f6dd89 100644
--- a/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/http/TestHttpClient.java
+++ b/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/http/TestHttpClient.java
@@ -386,29 +386,29 @@ public class TestHttpClient {
servletHandler.addServletWithMapping(SiteInfoServlet.class, "/site-to-site");
servletHandler.addServletWithMapping(PeersServlet.class, "/site-to-site/peers");
- servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/site-to-site/input-ports/input-running-id/transactions");
- servletHandler.addServletWithMapping(InputPortTransactionServlet.class, "/site-to-site/input-ports/input-running-id/transactions/transaction-id");
- servletHandler.addServletWithMapping(FlowFilesServlet.class, "/site-to-site/input-ports/input-running-id/transactions/transaction-id/flow-files");
+ servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/data-transfer/input-ports/input-running-id/transactions");
+ servletHandler.addServletWithMapping(InputPortTransactionServlet.class, "/data-transfer/input-ports/input-running-id/transactions/transaction-id");
+ servletHandler.addServletWithMapping(FlowFilesServlet.class, "/data-transfer/input-ports/input-running-id/transactions/transaction-id/flow-files");
- servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/site-to-site/input-ports/input-timeout-id/transactions");
- servletHandler.addServletWithMapping(InputPortTransactionServlet.class, "/site-to-site/input-ports/input-timeout-id/transactions/transaction-id");
- servletHandler.addServletWithMapping(FlowFilesTimeoutServlet.class, "/site-to-site/input-ports/input-timeout-id/transactions/transaction-id/flow-files");
+ servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/data-transfer/input-ports/input-timeout-id/transactions");
+ servletHandler.addServletWithMapping(InputPortTransactionServlet.class, "/data-transfer/input-ports/input-timeout-id/transactions/transaction-id");
+ servletHandler.addServletWithMapping(FlowFilesTimeoutServlet.class, "/data-transfer/input-ports/input-timeout-id/transactions/transaction-id/flow-files");
- servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/site-to-site/input-ports/input-timeout-data-ex-id/transactions");
- servletHandler.addServletWithMapping(InputPortTransactionServlet.class, "/site-to-site/input-ports/input-timeout-data-ex-id/transactions/transaction-id");
- servletHandler.addServletWithMapping(FlowFilesTimeoutAfterDataExchangeServlet.class, "/site-to-site/input-ports/input-timeout-data-ex-id/transactions/transaction-id/flow-files");
+ servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/data-transfer/input-ports/input-timeout-data-ex-id/transactions");
+ servletHandler.addServletWithMapping(InputPortTransactionServlet.class, "/data-transfer/input-ports/input-timeout-data-ex-id/transactions/transaction-id");
+ servletHandler.addServletWithMapping(FlowFilesTimeoutAfterDataExchangeServlet.class, "/data-transfer/input-ports/input-timeout-data-ex-id/transactions/transaction-id/flow-files");
- servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/site-to-site/output-ports/output-running-id/transactions");
- servletHandler.addServletWithMapping(OutputPortTransactionServlet.class, "/site-to-site/output-ports/output-running-id/transactions/transaction-id");
- servletHandler.addServletWithMapping(FlowFilesServlet.class, "/site-to-site/output-ports/output-running-id/transactions/transaction-id/flow-files");
+ servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/data-transfer/output-ports/output-running-id/transactions");
+ servletHandler.addServletWithMapping(OutputPortTransactionServlet.class, "/data-transfer/output-ports/output-running-id/transactions/transaction-id");
+ servletHandler.addServletWithMapping(FlowFilesServlet.class, "/data-transfer/output-ports/output-running-id/transactions/transaction-id/flow-files");
- servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/site-to-site/output-ports/output-timeout-id/transactions");
- servletHandler.addServletWithMapping(OutputPortTransactionServlet.class, "/site-to-site/output-ports/output-timeout-id/transactions/transaction-id");
- servletHandler.addServletWithMapping(FlowFilesTimeoutServlet.class, "/site-to-site/output-ports/output-timeout-id/transactions/transaction-id/flow-files");
+ servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/data-transfer/output-ports/output-timeout-id/transactions");
+ servletHandler.addServletWithMapping(OutputPortTransactionServlet.class, "/data-transfer/output-ports/output-timeout-id/transactions/transaction-id");
+ servletHandler.addServletWithMapping(FlowFilesTimeoutServlet.class, "/data-transfer/output-ports/output-timeout-id/transactions/transaction-id/flow-files");
- servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/site-to-site/output-ports/output-timeout-data-ex-id/transactions");
- servletHandler.addServletWithMapping(OutputPortTransactionServlet.class, "/site-to-site/output-ports/output-timeout-data-ex-id/transactions/transaction-id");
- servletHandler.addServletWithMapping(FlowFilesTimeoutAfterDataExchangeServlet.class, "/site-to-site/output-ports/output-timeout-data-ex-id/transactions/transaction-id/flow-files");
+ servletHandler.addServletWithMapping(PortTransactionsServlet.class, "/data-transfer/output-ports/output-timeout-data-ex-id/transactions");
+ servletHandler.addServletWithMapping(OutputPortTransactionServlet.class, "/data-transfer/output-ports/output-timeout-data-ex-id/transactions/transaction-id");
+ servletHandler.addServletWithMapping(FlowFilesTimeoutAfterDataExchangeServlet.class, "/data-transfer/output-ports/output-timeout-data-ex-id/transactions/transaction-id/flow-files");
server.start();
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/protocol/http/TestHttpClientTransaction.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/protocol/http/TestHttpClientTransaction.java b/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/protocol/http/TestHttpClientTransaction.java
index bed5a46..7f3ee5c 100644
--- a/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/protocol/http/TestHttpClientTransaction.java
+++ b/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/protocol/http/TestHttpClientTransaction.java
@@ -100,7 +100,7 @@ public class TestHttpClientTransaction {
public void testReceiveZeroFlowFile() throws IOException {
SiteToSiteRestApiClient apiClient = mock(SiteToSiteRestApiClient.class);
- final String transactionUrl = "http://www.example.com/site-to-site/input-ports/portId/transactions/transactionId";
+ final String transactionUrl = "http://www.example.com/data-transfer/input-ports/portId/transactions/transactionId";
doReturn(false).when(apiClient).openConnectionForReceive(eq(transactionUrl), any(CommunicationsSession.class));
ByteArrayInputStream serverResponse = new ByteArrayInputStream(new byte[0]);
@@ -116,7 +116,7 @@ public class TestHttpClientTransaction {
public void testReceiveOneFlowFile() throws IOException {
SiteToSiteRestApiClient apiClient = mock(SiteToSiteRestApiClient.class);
- final String transactionUrl = "http://www.example.com/site-to-site/input-ports/portId/transactions/transactionId";
+ final String transactionUrl = "http://www.example.com/data-transfer/input-ports/portId/transactions/transactionId";
doReturn(true).when(apiClient).openConnectionForReceive(eq(transactionUrl), any(CommunicationsSession.class));
TransactionResultEntity resultEntity = new TransactionResultEntity();
resultEntity.setResponseCode(CONFIRM_TRANSACTION.getCode());
@@ -138,7 +138,7 @@ public class TestHttpClientTransaction {
public void testReceiveTwoFlowFiles() throws IOException {
SiteToSiteRestApiClient apiClient = mock(SiteToSiteRestApiClient.class);
- final String transactionUrl = "http://www.example.com/site-to-site/input-ports/portId/transactions/transactionId";
+ final String transactionUrl = "http://www.example.com/data-transfer/input-ports/portId/transactions/transactionId";
doReturn(true).when(apiClient).openConnectionForReceive(eq(transactionUrl), any(CommunicationsSession.class));
TransactionResultEntity resultEntity = new TransactionResultEntity();
resultEntity.setResponseCode(CONFIRM_TRANSACTION.getCode());
@@ -161,7 +161,7 @@ public class TestHttpClientTransaction {
public void testReceiveWithInvalidChecksum() throws IOException {
SiteToSiteRestApiClient apiClient = mock(SiteToSiteRestApiClient.class);
- final String transactionUrl = "http://www.example.com/site-to-site/input-ports/portId/transactions/transactionId";
+ final String transactionUrl = "http://www.example.com/data-transfer/input-ports/portId/transactions/transactionId";
doReturn(true).when(apiClient).openConnectionForReceive(eq(transactionUrl), any(CommunicationsSession.class));
// The checksum is correct, but here we simulate as if it's wrong, BAD_CHECKSUM.
TransactionResultEntity resultEntity = new TransactionResultEntity();
@@ -185,7 +185,7 @@ public class TestHttpClientTransaction {
public void testSendZeroFlowFile() throws IOException {
SiteToSiteRestApiClient apiClient = mock(SiteToSiteRestApiClient.class);
- final String transactionUrl = "http://www.example.com/site-to-site/input-ports/portId/transactions/transactionId";
+ final String transactionUrl = "http://www.example.com/data-transfer/input-ports/portId/transactions/transactionId";
doNothing().when(apiClient).openConnectionForSend(eq(transactionUrl), any(CommunicationsSession.class));
ByteArrayOutputStream serverResponseBos = new ByteArrayOutputStream();
@@ -202,7 +202,7 @@ public class TestHttpClientTransaction {
public void testSendOneFlowFile() throws IOException {
SiteToSiteRestApiClient apiClient = mock(SiteToSiteRestApiClient.class);
- final String transactionUrl = "http://www.example.com/site-to-site/input-ports/portId/transactions/transactionId";
+ final String transactionUrl = "http://www.example.com/data-transfer/input-ports/portId/transactions/transactionId";
doNothing().when(apiClient).openConnectionForSend(eq(transactionUrl), any(CommunicationsSession.class));
// Emulate that server returns correct checksum.
doAnswer(new Answer() {
@@ -236,7 +236,7 @@ public class TestHttpClientTransaction {
public void testSendTwoFlowFiles() throws IOException {
SiteToSiteRestApiClient apiClient = mock(SiteToSiteRestApiClient.class);
- final String transactionUrl = "http://www.example.com/site-to-site/input-ports/portId/transactions/transactionId";
+ final String transactionUrl = "http://www.example.com/data-transfer/input-ports/portId/transactions/transactionId";
doNothing().when(apiClient).openConnectionForSend(eq("portId"), any(CommunicationsSession.class));
// Emulate that server returns correct checksum.
doAnswer(new Answer() {
@@ -271,7 +271,7 @@ public class TestHttpClientTransaction {
@Test
public void testSendWithInvalidChecksum() throws IOException {
SiteToSiteRestApiClient apiClient = mock(SiteToSiteRestApiClient.class);
- final String transactionUrl = "http://www.example.com/site-to-site/input-ports/portId/transactions/transactionId";
+ final String transactionUrl = "http://www.example.com/data-transfer/input-ports/portId/transactions/transactionId";
doNothing().when(apiClient).openConnectionForSend(eq(transactionUrl), any(CommunicationsSession.class));
// Emulate that server returns incorrect checksum.
doAnswer(new Answer() {
@@ -312,7 +312,7 @@ public class TestHttpClientTransaction {
public void testSendButDestinationFull() throws IOException {
SiteToSiteRestApiClient apiClient = mock(SiteToSiteRestApiClient.class);
- final String transactionUrl = "http://www.example.com/site-to-site/input-ports/portId/transactions/transactionId";
+ final String transactionUrl = "http://www.example.com/data-transfer/input-ports/portId/transactions/transactionId";
doNothing().when(apiClient).openConnectionForSend(eq("portId"), any(CommunicationsSession.class));
// Emulate that server returns correct checksum.
doAnswer(new Answer() {
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java
index 3f99556..4f9653f 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java
@@ -26,55 +26,10 @@ import java.util.Set;
* Details for the access configuration.
*/
@XmlType(name = "accessPolicy")
-public class AccessPolicyDTO extends ComponentDTO {
+public class AccessPolicyDTO extends AccessPolicySummaryDTO {
- private String resource;
private Set<TenantEntity> users;
private Set<TenantEntity> userGroups;
- private Boolean canRead;
- private Boolean canWrite;
-
- /**
- * @return Indicates whether the user can read a given resource.
- */
- @ApiModelProperty(
- value = "Indicates whether the user can read a given resource.",
- readOnly = true
- )
- public Boolean getCanRead() {
- return canRead;
- }
-
- public void setCanRead(Boolean canRead) {
- this.canRead = canRead;
- }
-
- /**
- * @return Indicates whether the user can write a given resource.
- */
- @ApiModelProperty(
- value = "Indicates whether the user can write a given resource.",
- readOnly = true
- )
- public Boolean getCanWrite() {
- return canWrite;
- }
-
- public void setCanWrite(Boolean canWrite) {
- this.canWrite = canWrite;
- }
-
- /**
- * @return The resource ID for this access policy.
- */
- @ApiModelProperty(value="The resource ID for this access policy.")
- public String getResource() {
- return resource;
- }
-
- public void setResource(String resource) {
- this.resource = resource;
- }
/**
* @return The set of user IDs associated with this access policy.
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicySummaryDTO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicySummaryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicySummaryDTO.java
new file mode 100644
index 0000000..0fb97c1
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicySummaryDTO.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.web.api.dto;
+
+import com.wordnik.swagger.annotations.ApiModelProperty;
+
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * Details for the access configuration.
+ */
+@XmlType(name = "accessPolicy")
+public class AccessPolicySummaryDTO extends ComponentDTO {
+
+ private String resource;
+ private String action;
+
+ /**
+ * @return The action associated with this access policy.
+ */
+ @ApiModelProperty(
+ value = "The action associated with this access policy.",
+ allowableValues = "READ, WRITE"
+ )
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ /**
+ * @return The resource for this access policy.
+ */
+ @ApiModelProperty(value="The resource for this access policy.")
+ public String getResource() {
+ return resource;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PermissionsDTO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PermissionsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PermissionsDTO.java
new file mode 100644
index 0000000..dc5b7f9
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PermissionsDTO.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.web.api.dto;
+
+import com.wordnik.swagger.annotations.ApiModelProperty;
+
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * Details for the access configuration.
+ */
+@XmlType(name = "permission")
+public class PermissionsDTO {
+
+ private Boolean canRead;
+ private Boolean canWrite;
+
+ /**
+ * @return Indicates whether the user can read a given resource.
+ */
+ @ApiModelProperty(
+ value = "Indicates whether the user can read a given resource.",
+ readOnly = true
+ )
+ public Boolean getCanRead() {
+ return canRead;
+ }
+
+ public void setCanRead(Boolean canRead) {
+ this.canRead = canRead;
+ }
+
+ /**
+ * @return Indicates whether the user can write a given resource.
+ */
+ @ApiModelProperty(
+ value = "Indicates whether the user can write a given resource.",
+ readOnly = true
+ )
+ public Boolean getCanWrite() {
+ return canWrite;
+ }
+
+ public void setCanWrite(Boolean canWrite) {
+ this.canWrite = canWrite;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java
index 52da608..e86630c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java
@@ -17,6 +17,7 @@
package org.apache.nifi.web.api.dto;
import com.wordnik.swagger.annotations.ApiModelProperty;
+import org.apache.nifi.web.api.entity.AccessPolicySummaryEntity;
import org.apache.nifi.web.api.entity.TenantEntity;
import javax.xml.bind.annotation.XmlType;
@@ -29,11 +30,15 @@ import java.util.Set;
public class UserDTO extends TenantDTO {
private Set<TenantEntity> userGroups;
+ private Set<AccessPolicySummaryEntity> accessPolicies;
/**
* @return groups to which the user belongs
*/
- @ApiModelProperty(value = "The groups to which the user belongs.")
+ @ApiModelProperty(
+ value = "The groups to which the user belongs. This field is read only and it provided for convenience.",
+ readOnly = true
+ )
public Set<TenantEntity> getUserGroups() {
return userGroups;
}
@@ -41,4 +46,19 @@ public class UserDTO extends TenantDTO {
public void setUserGroups(Set<TenantEntity> userGroups) {
this.userGroups = userGroups;
}
+
+ /**
+ * @return policies this user is part of
+ */
+ @ApiModelProperty(
+ value = "The access policies this user belongs to.",
+ readOnly = true
+ )
+ public Set<AccessPolicySummaryEntity> getAccessPolicies() {
+ return accessPolicies;
+ }
+
+ public void setAccessPolicies(Set<AccessPolicySummaryEntity> accessPolicies) {
+ this.accessPolicies = accessPolicies;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java
index f167f91..af63a14 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java
@@ -17,6 +17,7 @@
package org.apache.nifi.web.api.dto;
import com.wordnik.swagger.annotations.ApiModelProperty;
+import org.apache.nifi.web.api.entity.AccessPolicyEntity;
import org.apache.nifi.web.api.entity.TenantEntity;
import javax.xml.bind.annotation.XmlType;
@@ -29,6 +30,7 @@ import java.util.Set;
public class UserGroupDTO extends TenantDTO {
private Set<TenantEntity> users;
+ private Set<AccessPolicyEntity> accessPolicies;
/**
* @return users in this group
@@ -41,4 +43,19 @@ public class UserGroupDTO extends TenantDTO {
public void setUsers(Set<TenantEntity> users) {
this.users = users;
}
+
+ /**
+ * @return policies this user group is part of
+ */
+ @ApiModelProperty(
+ value = "The access policies this user group belongs to.",
+ readOnly = true
+ )
+ public Set<AccessPolicyEntity> getAccessPolicies() {
+ return accessPolicies;
+ }
+
+ public void setAccessPolicies(Set<AccessPolicyEntity> accessPolicies) {
+ this.accessPolicies = accessPolicies;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicyEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicyEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicyEntity.java
index 82a977f..40b6512 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicyEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicyEntity.java
@@ -17,8 +17,11 @@
package org.apache.nifi.web.api.entity;
import org.apache.nifi.web.api.dto.AccessPolicyDTO;
+import org.apache.nifi.web.api.dto.util.TimeAdapter;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.Date;
/**
* A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to an {@link AccessPolicyDTO}.
@@ -26,6 +29,7 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "accessPolicyEntity")
public class AccessPolicyEntity extends ComponentEntity {
+ private Date generated;
private AccessPolicyDTO component;
/**
@@ -41,4 +45,15 @@ public class AccessPolicyEntity extends ComponentEntity {
this.component = component;
}
+ /**
+ * @return When this content was generated
+ */
+ @XmlJavaTypeAdapter(TimeAdapter.class)
+ public Date getGenerated() {
+ return generated;
+ }
+
+ public void setGenerated(Date generated) {
+ this.generated = generated;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicySummaryEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicySummaryEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicySummaryEntity.java
new file mode 100644
index 0000000..afae44d
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AccessPolicySummaryEntity.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.web.api.entity;
+
+import org.apache.nifi.web.api.dto.AccessPolicySummaryDTO;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * A serialized representation of this class can be placed in the entity body of a request or response to or from the API.
+ * This particular entity holds a reference to an {@link AccessPolicySummaryDTO}.
+ */
+@XmlRootElement(name = "accessPolicySummaryEntity")
+public class AccessPolicySummaryEntity extends ComponentEntity {
+
+ private AccessPolicySummaryDTO component;
+
+ /**
+ * The {@link AccessPolicySummaryDTO} that is being serialized.
+ *
+ * @return The {@link AccessPolicySummaryDTO} object
+ */
+ public AccessPolicySummaryDTO getComponent() {
+ return component;
+ }
+
+ public void setComponent(AccessPolicySummaryDTO component) {
+ this.component = component;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java
index 6d6b022..f09880b 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java
@@ -17,8 +17,8 @@
package org.apache.nifi.web.api.entity;
import com.wordnik.swagger.annotations.ApiModelProperty;
-import org.apache.nifi.web.api.dto.AccessPolicyDTO;
import org.apache.nifi.web.api.dto.BulletinDTO;
+import org.apache.nifi.web.api.dto.PermissionsDTO;
import org.apache.nifi.web.api.dto.PositionDTO;
import org.apache.nifi.web.api.dto.RevisionDTO;
@@ -35,7 +35,7 @@ public class ComponentEntity extends Entity {
private RevisionDTO revision;
private String id;
private PositionDTO position;
- private AccessPolicyDTO accessPolicy;
+ private PermissionsDTO permissions;
private List<BulletinDTO> bulletins;
/**
@@ -85,19 +85,19 @@ public class ComponentEntity extends Entity {
}
/**
- * The access policy for this component.
+ * The permissions for this component.
*
- * @return The access policy
+ * @return The permissions
*/
@ApiModelProperty(
- value = "The access policy for this component."
+ value = "The permissions for this component."
)
- public AccessPolicyDTO getAccessPolicy() {
- return accessPolicy;
+ public PermissionsDTO getPermissions() {
+ return permissions;
}
- public void setAccessPolicy(AccessPolicyDTO accessPolicy) {
- this.accessPolicy = accessPolicy;
+ public void setPermissions(PermissionsDTO permissions) {
+ this.permissions = permissions;
}
/**
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerConfigurationEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerConfigurationEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerConfigurationEntity.java
index 066950e..c7aa0cd 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerConfigurationEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerConfigurationEntity.java
@@ -17,8 +17,8 @@
package org.apache.nifi.web.api.entity;
import com.wordnik.swagger.annotations.ApiModelProperty;
-import org.apache.nifi.web.api.dto.AccessPolicyDTO;
import org.apache.nifi.web.api.dto.ControllerConfigurationDTO;
+import org.apache.nifi.web.api.dto.PermissionsDTO;
import org.apache.nifi.web.api.dto.RevisionDTO;
import org.apache.nifi.web.api.dto.util.TimeAdapter;
@@ -35,7 +35,7 @@ public class ControllerConfigurationEntity extends Entity {
private Date currentTime;
private ControllerConfigurationDTO controllerConfiguration;
private RevisionDTO revision;
- private AccessPolicyDTO accessPolicy;
+ private PermissionsDTO permissions;
/**
* @return revision for this request/response
@@ -72,19 +72,19 @@ public class ControllerConfigurationEntity extends Entity {
}
/**
- * The access policy for this component.
+ * The permissions for this component.
*
- * @return The access policy
+ * @return The permissions
*/
@ApiModelProperty(
- value = "The access policy for the controller."
+ value = "The permissions for this component."
)
- public AccessPolicyDTO getAccessPolicy() {
- return accessPolicy;
+ public PermissionsDTO getPermissions() {
+ return permissions;
}
- public void setAccessPolicy(AccessPolicyDTO accessPolicy) {
- this.accessPolicy = accessPolicy;
+ public void setPermissions(PermissionsDTO permissions) {
+ this.permissions = permissions;
}
/**
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CurrentUserEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CurrentUserEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CurrentUserEntity.java
index 1a7ff1c..7bb6270 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CurrentUserEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CurrentUserEntity.java
@@ -16,7 +16,8 @@
*/
package org.apache.nifi.web.api.entity;
-import org.apache.nifi.web.api.dto.AccessPolicyDTO;
+import com.wordnik.swagger.annotations.ApiModelProperty;
+import org.apache.nifi.web.api.dto.PermissionsDTO;
import javax.xml.bind.annotation.XmlRootElement;
@@ -29,14 +30,16 @@ public class CurrentUserEntity extends Entity {
private String identity;
private boolean anonymous;
- private AccessPolicyDTO provenancePermissions;
- private AccessPolicyDTO countersPermissions;
- private AccessPolicyDTO tenantsPermissions;
- private AccessPolicyDTO controllerPermissions;
+ private PermissionsDTO provenancePermissions;
+ private PermissionsDTO countersPermissions;
+ private PermissionsDTO tenantsPermissions;
+ private PermissionsDTO controllerPermissions;
+ private PermissionsDTO policiesPermissions;
/**
* @return the user identity being serialized
*/
+ @ApiModelProperty("The user identity being serialized.")
public String getIdentity() {
return identity;
}
@@ -48,6 +51,7 @@ public class CurrentUserEntity extends Entity {
/**
* @return if the user is anonymous
*/
+ @ApiModelProperty("Whether the current user is anonymous.")
public boolean isAnonymous() {
return anonymous;
}
@@ -59,44 +63,60 @@ public class CurrentUserEntity extends Entity {
/**
* @return if the use can query provenance
*/
- public AccessPolicyDTO getProvenancePermissions() {
+ @ApiModelProperty("Permissions for querying provenance.")
+ public PermissionsDTO getProvenancePermissions() {
return provenancePermissions;
}
- public void setProvenancePermissions(AccessPolicyDTO provenancePermissions) {
+ public void setProvenancePermissions(PermissionsDTO provenancePermissions) {
this.provenancePermissions = provenancePermissions;
}
/**
* @return permissions for accessing counters
*/
- public AccessPolicyDTO getCountersPermissions() {
+ @ApiModelProperty("Permissions for accessing counters.")
+ public PermissionsDTO getCountersPermissions() {
return countersPermissions;
}
- public void setCountersPermissions(AccessPolicyDTO countersPermissions) {
+ public void setCountersPermissions(PermissionsDTO countersPermissions) {
this.countersPermissions = countersPermissions;
}
/**
* @return permissions for accessing users
*/
- public AccessPolicyDTO getTenantsPermissions() {
+ @ApiModelProperty("Permissions for accessing tenants.")
+ public PermissionsDTO getTenantsPermissions() {
return tenantsPermissions;
}
- public void setTenantsPermissions(AccessPolicyDTO tenantsPermissions) {
+ public void setTenantsPermissions(PermissionsDTO tenantsPermissions) {
this.tenantsPermissions = tenantsPermissions;
}
/**
* @return permissions for accessing the controller
*/
- public AccessPolicyDTO getControllerPermissions() {
+ @ApiModelProperty("Permissions for accessing the controller.")
+ public PermissionsDTO getControllerPermissions() {
return controllerPermissions;
}
- public void setControllerPermissions(AccessPolicyDTO controllerPermissions) {
+ public void setControllerPermissions(PermissionsDTO controllerPermissions) {
this.controllerPermissions = controllerPermissions;
}
+
+ /**
+ * @return permissions for accessing the all policies
+ */
+ @ApiModelProperty("Permissions for accessing the policies.")
+ public PermissionsDTO getPoliciesPermissions() {
+ return policiesPermissions;
+ }
+
+ public void setPoliciesPermissions(PermissionsDTO policiesPermissions) {
+ this.policiesPermissions = policiesPermissions;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowBreadcrumbEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowBreadcrumbEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowBreadcrumbEntity.java
index ddd8407..4b042f7 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowBreadcrumbEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowBreadcrumbEntity.java
@@ -17,7 +17,7 @@
package org.apache.nifi.web.api.entity;
import com.wordnik.swagger.annotations.ApiModelProperty;
-import org.apache.nifi.web.api.dto.AccessPolicyDTO;
+import org.apache.nifi.web.api.dto.PermissionsDTO;
import org.apache.nifi.web.api.dto.flow.FlowBreadcrumbDTO;
import javax.xml.bind.annotation.XmlRootElement;
@@ -29,7 +29,7 @@ import javax.xml.bind.annotation.XmlRootElement;
public class FlowBreadcrumbEntity extends Entity {
private String id;
- private AccessPolicyDTO accessPolicy;
+ private PermissionsDTO permissions;
private FlowBreadcrumbDTO breadcrumb;
private FlowBreadcrumbEntity parentBreadcrumb;
@@ -50,19 +50,19 @@ public class FlowBreadcrumbEntity extends Entity {
}
/**
- * The access policy for this ancestor ProcessGroup.
+ * The permissions for this ancestor ProcessGroup.
*
- * @return The access policy
+ * @return The permissions
*/
@ApiModelProperty(
- value = "The access policy for this ancestor ProcessGroup."
+ value = "The permissions for this ancestor ProcessGroup."
)
- public AccessPolicyDTO getAccessPolicy() {
- return accessPolicy;
+ public PermissionsDTO getPermissions() {
+ return permissions;
}
- public void setAccessPolicy(AccessPolicyDTO accessPolicy) {
- this.accessPolicy = accessPolicy;
+ public void setPermissions(PermissionsDTO permissions) {
+ this.permissions = permissions;
}
/**
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java
index 6f649bf..4db154a 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java
@@ -16,12 +16,12 @@
*/
package org.apache.nifi.web.api.entity;
-import javax.xml.bind.annotation.XmlRootElement;
-
import com.wordnik.swagger.annotations.ApiModelProperty;
import org.apache.nifi.web.api.dto.ProcessGroupDTO;
import org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO;
+import javax.xml.bind.annotation.XmlRootElement;
+
/**
* A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a ProcessGroupDTO.
*/
@@ -44,7 +44,7 @@ public class ProcessGroupEntity extends ComponentEntity {
/**
* The ProcessGroupDTO that is being serialized.
*
- * @return The ControllerDTO object
+ * @return The ProcessGroupDTO object
*/
public ProcessGroupDTO getComponent() {
return component;
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupFlowEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupFlowEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupFlowEntity.java
index 8dd3b05..ebcb0f8 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupFlowEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupFlowEntity.java
@@ -17,7 +17,7 @@
package org.apache.nifi.web.api.entity;
import com.wordnik.swagger.annotations.ApiModelProperty;
-import org.apache.nifi.web.api.dto.AccessPolicyDTO;
+import org.apache.nifi.web.api.dto.PermissionsDTO;
import org.apache.nifi.web.api.dto.flow.ProcessGroupFlowDTO;
import javax.xml.bind.annotation.XmlRootElement;
@@ -28,23 +28,23 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "processGroupFlowEntity")
public class ProcessGroupFlowEntity extends Entity {
- private AccessPolicyDTO accessPolicy;
+ private PermissionsDTO permissions;
private ProcessGroupFlowDTO processGroupFlow;
/**
- * The access policy for this component.
+ * The permissions for this component.
*
- * @return The access policy
+ * @return The permissions
*/
@ApiModelProperty(
value = "The access policy for this process group."
)
- public AccessPolicyDTO getAccessPolicy() {
- return accessPolicy;
+ public PermissionsDTO getPermissions() {
+ return permissions;
}
- public void setAccessPolicy(AccessPolicyDTO accessPolicy) {
- this.accessPolicy = accessPolicy;
+ public void setPermissions(PermissionsDTO permissions) {
+ this.permissions = permissions;
}
/**
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TenantCollectionEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TenantCollectionEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TenantCollectionEntity.java
new file mode 100644
index 0000000..73c35bd
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TenantCollectionEntity.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.web.api.entity;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Set;
+
+/**
+ * A serialized representation of this class can be placed in the entity body of a request or response to or from the API.
+ */
+@XmlRootElement(name = "tenantCollectionEntity")
+public class TenantCollectionEntity extends ComponentEntity {
+
+ private Set<String> tenants;
+
+ /**
+ * The tenants being serialized.
+ *
+ * @return The tenants
+ */
+ public Set<String> getTenants() {
+ return tenants;
+ }
+
+ public void setTenants(Set<String> tenants) {
+ this.tenants = tenants;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TenantsEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TenantsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TenantsEntity.java
new file mode 100644
index 0000000..49c51c3
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TenantsEntity.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.web.api.entity;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Collection;
+
+/**
+ * A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a collection of
+ * TenantEntity objects.
+ */
+@XmlRootElement(name = "tenantsEntity")
+public class TenantsEntity {
+
+ private Collection<TenantEntity> users;
+ private Collection<TenantEntity> userGroups;
+
+ /**
+ * The collection of users that are being serialized.
+ *
+ * @return users
+ */
+ public Collection<TenantEntity> getUsers() {
+ return users;
+ }
+
+ public void setUsers(Collection<TenantEntity> users) {
+ this.users = users;
+ }
+
+ /**
+ * The collection of user groups that are being serialized.
+ *
+ * @return user groups
+ */
+ public Collection<TenantEntity> getUserGroups() {
+ return userGroups;
+ }
+
+ public void setUserGroups(Collection<TenantEntity> userGroups) {
+ this.userGroups = userGroups;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java
index 6624338..7969f6b 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java
@@ -16,8 +16,12 @@
*/
package org.apache.nifi.web.api.entity;
+import org.apache.nifi.web.api.dto.util.TimeAdapter;
+
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Collection;
+import java.util.Date;
/**
* A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a collection of UserEntity
@@ -26,6 +30,7 @@ import java.util.Collection;
@XmlRootElement(name = "usersEntity")
public class UsersEntity extends Entity {
+ private Date generated;
private Collection<UserEntity> users;
/**
@@ -40,4 +45,16 @@ public class UsersEntity extends Entity {
public void setUsers(Collection<UserEntity> users) {
this.users = users;
}
+
+ /**
+ * @return When this content was generated
+ */
+ @XmlJavaTypeAdapter(TimeAdapter.class)
+ public Date getGenerated() {
+ return generated;
+ }
+
+ public void setGenerated(Date generated) {
+ this.generated = generated;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/AccessPoliciesAuthorizable.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/AccessPoliciesAuthorizable.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/AccessPoliciesAuthorizable.java
deleted file mode 100644
index ad4ba29..0000000
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/AccessPoliciesAuthorizable.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.authorization.resource;
-
-import org.apache.nifi.authorization.Resource;
-
-public class AccessPoliciesAuthorizable implements Authorizable {
-
- @Override
- public Authorizable getParentAuthorizable() {
- return null;
- }
-
- @Override
- public Resource getResource() {
- return ResourceFactory.getPoliciesResource();
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/AccessPolicyAuthorizable.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/AccessPolicyAuthorizable.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/AccessPolicyAuthorizable.java
index 5d5eab7..08583e1 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/AccessPolicyAuthorizable.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/AccessPolicyAuthorizable.java
@@ -16,38 +16,39 @@
*/
package org.apache.nifi.authorization.resource;
-import org.apache.nifi.authorization.AccessPolicy;
import org.apache.nifi.authorization.Resource;
+/**
+ * Authorizable for policies of an Authorizable.
+ */
public class AccessPolicyAuthorizable implements Authorizable {
+ final Authorizable authorizable;
- private final AccessPolicy policy;
-
- public AccessPolicyAuthorizable(AccessPolicy policy) {
- this.policy = policy;
+ public AccessPolicyAuthorizable(Authorizable authorizable) {
+ this.authorizable = authorizable;
}
@Override
public Authorizable getParentAuthorizable() {
- return new Authorizable() {
- @Override
- public Authorizable getParentAuthorizable() {
- return null;
- }
-
- @Override
- public Resource getResource() {
- return ResourceFactory.getPoliciesResource();
- }
- };
+ if (authorizable.getParentAuthorizable() == null) {
+ return new Authorizable() {
+ @Override
+ public Authorizable getParentAuthorizable() {
+ return null;
+ }
+
+ @Override
+ public Resource getResource() {
+ return ResourceFactory.getPoliciesResource();
+ }
+ };
+ } else {
+ return new AccessPolicyAuthorizable(authorizable.getParentAuthorizable());
+ }
}
@Override
public Resource getResource() {
- return ResourceFactory.getPolicyResource(policy.getIdentifier());
- }
-
- public AccessPolicy getPolicy() {
- return policy;
+ return ResourceFactory.getPolicyResource(authorizable.getResource());
}
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/DataTransferAuthorizable.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/DataTransferAuthorizable.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/DataTransferAuthorizable.java
new file mode 100644
index 0000000..53aecbc
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/DataTransferAuthorizable.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authorization.resource;
+
+import org.apache.nifi.authorization.Resource;
+
+/**
+ * Authorizable for policies of an Authorizable.
+ */
+public class DataTransferAuthorizable implements Authorizable {
+ final Authorizable authorizable;
+
+ public DataTransferAuthorizable(Authorizable authorizable) {
+ this.authorizable = authorizable;
+ }
+
+ @Override
+ public Authorizable getParentAuthorizable() {
+ return null;
+ }
+
+ @Override
+ public Resource getResource() {
+ return ResourceFactory.getDataTransferResource(authorizable.getResource());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java
index 058a1c8..004429a 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java
@@ -16,7 +16,6 @@
*/
package org.apache.nifi.authorization.resource;
-import org.apache.nifi.authorization.AccessPolicy;
import org.apache.nifi.authorization.Resource;
import java.util.Objects;
@@ -287,18 +286,6 @@ public final class ResourceFactory {
}
};
- private final static Resource TOKEN_RESOURCE = new Resource() {
- @Override
- public String getIdentifier() {
- return ResourceType.Token.getValue();
- }
-
- @Override
- public String getName() {
- return "API access token";
- }
- };
-
private final static Resource POLICIES_RESOURCE = new Resource() {
@Override
@@ -385,15 +372,6 @@ public final class ResourceFactory {
}
/**
- * Gets the Resource for accessing Policies which allows management of Access Policies.
- *
- * @return The resource for accessing Policies
- */
- public static Resource getPolicyResource() {
- return POLICY_RESOURCE;
- }
-
- /**
* Gets the Resource for accessing Processors.
*
* @return The resource for accessing Processors
@@ -495,15 +473,6 @@ public final class ResourceFactory {
}
/**
- * Gets the Resource for creating API access tokens.
- *
- * @return The token request resource
- */
- public static Resource getTokenResource() {
- return TOKEN_RESOURCE;
- }
-
- /**
* Gets the Resource for accessing Tenants which includes creating, modifying, and deleting Users and UserGroups.
*
* @return The Resource for accessing Tenants
@@ -513,19 +482,20 @@ public final class ResourceFactory {
}
/**
- * Gets a Resource for performing site to site on a port.
+ * Gets a Resource for performing transferring data to a port.
*
+ * @param isInputPort Whether this port is an input port or an output port
* @param identifier The identifier of the component being accessed
* @param name The name of the component being accessed
* @return The resource
*/
- public static Resource getSiteToSiteResource(final String identifier, final String name) {
+ public static Resource getDataTransferResource(final boolean isInputPort, final String identifier, final String name) {
Objects.requireNonNull(identifier, "The component identifier must be specified.");
return new Resource() {
@Override
public String getIdentifier() {
- return String.format("%s/%s", ResourceType.SiteToSite.getValue(), identifier);
+ return String.format("%s/%s/%s", ResourceType.DataTransfer.getValue(), isInputPort ? "input-ports" : "output-ports", identifier);
}
@Override
@@ -536,7 +506,29 @@ public final class ResourceFactory {
}
/**
- * Gets the {@link Resource} for accessing {@link AccessPolicy}s.
+ * Gets a Resource for performing transferring data to a port.
+ *
+ * @param resource The resource to transfer data to
+ * @return The resource
+ */
+ public static Resource getDataTransferResource(final Resource resource) {
+ Objects.requireNonNull(resource, "The resource must be specified.");
+
+ return new Resource() {
+ @Override
+ public String getIdentifier() {
+ return String.format("%s%s", ResourceType.DataTransfer.getValue(), resource.getIdentifier());
+ }
+
+ @Override
+ public String getName() {
+ return "Transfer data to " + resource.getName();
+ }
+ };
+ }
+
+ /**
+ * Gets the {@link Resource} for accessing access policies.
* @return The policies resource
*/
public static Resource getPoliciesResource() {
@@ -544,23 +536,23 @@ public final class ResourceFactory {
}
/**
- * Gets a Resource for accessing an {@link AccessPolicy} configuration.
+ * Gets a Resource for accessing a resources's policies.
*
- * @param identifier The identifier of the component being accessed
+ * @param resource The resource being accessed
* @return The resource
*/
- public static Resource getPolicyResource(final String identifier) {
- Objects.requireNonNull(identifier, "The component identifier must be specified.");
+ public static Resource getPolicyResource(final Resource resource) {
+ Objects.requireNonNull(resource, "The resource type must be specified.");
return new Resource() {
@Override
public String getIdentifier() {
- return String.format("%s/%s", POLICIES_RESOURCE.getIdentifier(), identifier);
+ return String.format("%s%s", POLICY_RESOURCE.getIdentifier(), resource.getIdentifier());
}
@Override
public String getName() {
- return identifier;
+ return "Policies for " + resource.getName();
}
};
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java
index 1464cab..177b9a4 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java
@@ -36,10 +36,10 @@ public enum ResourceType {
ReportingTask("/reporting-tasks"),
Resource("/resources"),
SiteToSite("/site-to-site"),
+ DataTransfer("/data-transfer"),
System("/system"),
Template("/templates"),
- Tenant("/tenants"),
- Token("/token");
+ Tenant("/tenants");
final String value;
@@ -50,4 +50,21 @@ public enum ResourceType {
public String getValue() {
return value;
}
+
+ public static ResourceType valueOfValue(final String rawValue) {
+ ResourceType type = null;
+
+ for (final ResourceType rt : values()) {
+ if (rt.getValue().equals(rawValue)) {
+ type = rt;
+ break;
+ }
+ }
+
+ if (type == null) {
+ throw new IllegalArgumentException("Unknown resource type value " + rawValue);
+ }
+
+ return type;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRootGroupPort.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRootGroupPort.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRootGroupPort.java
index b94d86f..64c4b7f 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRootGroupPort.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRootGroupPort.java
@@ -16,12 +16,13 @@
*/
package org.apache.nifi.remote;
-import org.apache.nifi.authorization.AuthorizationRequest;
import org.apache.nifi.authorization.AuthorizationResult;
import org.apache.nifi.authorization.AuthorizationResult.Result;
import org.apache.nifi.authorization.Authorizer;
import org.apache.nifi.authorization.RequestAction;
-import org.apache.nifi.authorization.resource.ResourceFactory;
+import org.apache.nifi.authorization.resource.Authorizable;
+import org.apache.nifi.authorization.resource.DataTransferAuthorizable;
+import org.apache.nifi.authorization.user.StandardNiFiUser;
import org.apache.nifi.components.ValidationResult;
import org.apache.nifi.connectable.ConnectableType;
import org.apache.nifi.controller.AbstractPort;
@@ -355,17 +356,10 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort
return new StandardPortAuthorizationResult(false, "User DN is not known");
}
- // build the request
- final AuthorizationRequest request = new AuthorizationRequest.Builder()
- .identity(dn)
- .anonymous(false)
- .accessAttempt(true)
- .action(RequestAction.WRITE)
- .resource(ResourceFactory.getSiteToSiteResource(getIdentifier(), getName()))
- .build();
-
// perform the authorization
- final AuthorizationResult result = authorizer.authorize(request);
+ final Authorizable dataTransferAuthorizable = new DataTransferAuthorizable(this);
+ final AuthorizationResult result = dataTransferAuthorizable.checkAuthorization(authorizer, RequestAction.WRITE, new StandardNiFiUser(dn));
+
if (!Result.Approved.equals(result.getResult())) {
final String message = String.format("%s authorization failed for user %s because %s", this, dn, result.getExplanation());
logger.warn(message);
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/AuthorizableLookup.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/AuthorizableLookup.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/AuthorizableLookup.java
index 01f06c2..7408e30 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/AuthorizableLookup.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/AuthorizableLookup.java
@@ -16,7 +16,6 @@
*/
package org.apache.nifi.web;
-import org.apache.nifi.authorization.AccessPolicy;
import org.apache.nifi.authorization.resource.Authorizable;
import org.apache.nifi.controller.Snippet;
@@ -178,18 +177,36 @@ public interface AuthorizableLookup {
* Get the {@link Authorizable} that represents the resource of users and user groups.
* @return authorizable
*/
- Authorizable getTenantAuthorizable();
+ Authorizable getTenant();
/**
- * Get the {@link Authorizable} the represents the parent resource of {@link AccessPolicy} resources.
+ * Get the authorizable for access all policies.
+ *
+ * @return authorizable
+ */
+ Authorizable getPolicies();
+
+ /**
+ * Get the authorizable for the policy of the policy id.
+ *
+ * @param id id
* @return authorizable
*/
- Authorizable getAccessPoliciesAuthorizable();
+ Authorizable getAccessPolicyById(String id);
/**
- * Get the {@link Authorizable} the represents the {@link AccessPolicy} with the given ID.
- * @param id access policy ID
+ * Get the authorizable for the policy of the specified resource.
+ *
+ * @param resource resource
+ * @return authorizable
+ */
+ Authorizable getAccessPolicyByResource(String resource);
+
+ /**
+ * Get the authorizable of the specified resource.
+ *
+ * @param resource resource
* @return authorizable
*/
- Authorizable getAccessPolicyAuthorizable(String id);
+ Authorizable getAuthorizableFromResource(final String resource);
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/e0c96794/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java
index b8d9cfd..6fb3123 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java
@@ -16,13 +16,7 @@
*/
package org.apache.nifi.web;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-
+import org.apache.nifi.authorization.RequestAction;
import org.apache.nifi.authorization.user.NiFiUser;
import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.controller.repository.claim.ContentDirection;
@@ -98,6 +92,13 @@ import org.apache.nifi.web.api.entity.TemplateEntity;
import org.apache.nifi.web.api.entity.UserEntity;
import org.apache.nifi.web.api.entity.UserGroupEntity;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Function;
+
/**
* Defines the NiFiServiceFacade interface.
*/
@@ -152,7 +153,7 @@ public interface NiFiServiceFacade {
// ----------------------------------------
// Controller methods
// ----------------------------------------
- ControllerDTO getController();
+ ControllerDTO getSiteToSiteDetails();
/**
* Searches the controller for the specified query string.
@@ -1275,6 +1276,14 @@ public interface NiFiServiceFacade {
AccessPolicyEntity getAccessPolicy(String accessPolicyId);
/**
+ * Gets the access policy for the specified action, resource type, and component id.
+ *
+ * @param resource resource
+ * @return access policy
+ */
+ AccessPolicyEntity getAccessPolicy(RequestAction requestAction, String resource);
+
+ /**
* Updates the specified access policy.
* @param revision Revision to compare with current base revision
* @param accessPolicyDTO The access policy DTO