mirror of
https://github.com/apache/nifi.git
synced 2025-02-16 15:06:00 +00:00
NIFI-3247:
- Removing unnecessary authorization check during second phase of connection creation. - Ensuring that the remote group port returns the correct resource type though not super critical since it is not possible to create policies for remote ports. This closes #1353.
This commit is contained in:
parent
8acbe9aa3f
commit
0d14db72f5
@ -31,7 +31,10 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import org.apache.nifi.authorization.Resource;
|
||||
import org.apache.nifi.authorization.resource.Authorizable;
|
||||
import org.apache.nifi.authorization.resource.ResourceFactory;
|
||||
import org.apache.nifi.authorization.resource.ResourceType;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.connectable.ConnectableType;
|
||||
import org.apache.nifi.connectable.Connection;
|
||||
@ -122,6 +125,12 @@ public class StandardRemoteGroupPort extends RemoteGroupPort {
|
||||
return getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resource getResource() {
|
||||
final ResourceType resourceType = ConnectableType.REMOTE_INPUT_PORT.equals(getConnectableType()) ? ResourceType.InputPort : ResourceType.OutputPort;
|
||||
return ResourceFactory.getComponentResource(resourceType, getIdentifier(), getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authorizable getParentAuthorizable() {
|
||||
return getRemoteProcessGroup();
|
||||
|
@ -300,9 +300,6 @@ public class StandardConnectionDAO extends ComponentDAO implements ConnectionDAO
|
||||
source = sourceGroup.getConnectable(sourceConnectableDTO.getId());
|
||||
}
|
||||
|
||||
// ensure the user has write access to the source component
|
||||
source.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser());
|
||||
|
||||
// find the destination
|
||||
final Connectable destination;
|
||||
if (ConnectableType.REMOTE_INPUT_PORT.name().equals(destinationConnectableDTO.getType())) {
|
||||
@ -326,9 +323,6 @@ public class StandardConnectionDAO extends ComponentDAO implements ConnectionDAO
|
||||
destination = destinationGroup.getConnectable(destinationConnectableDTO.getId());
|
||||
}
|
||||
|
||||
// ensure the user has write access to the source component
|
||||
destination.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser());
|
||||
|
||||
// determine the relationships
|
||||
final Set<String> relationships = new HashSet<>();
|
||||
if (isNotNull(connectionDTO.getSelectedRelationships())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user