Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
import com.facebook.presto.spi.connector.ConnectorTransactionHandle;
import com.facebook.presto.spi.security.ConnectorIdentity;
import com.facebook.presto.spi.security.Identity;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import java.util.Optional;

import static com.facebook.presto.metadata.SessionPropertyManager.createTestingSessionPropertyManager;

Expand All @@ -35,7 +39,7 @@ public static Session toSession(ConnectorTransactionHandle transactionHandle, Co
{
TransactionId transactionId = ((GlobalSystemTransactionHandle) transactionHandle).getTransactionId();
ConnectorIdentity connectorIdentity = session.getIdentity();
Identity identity = new Identity(connectorIdentity.getUser(), connectorIdentity.getPrincipal(), connectorIdentity.getExtraCredentials());
Identity identity = new Identity(connectorIdentity.getUser(), connectorIdentity.getPrincipal(), ImmutableMap.of(), connectorIdentity.getExtraCredentials(), ImmutableMap.of(), Optional.empty(), connectorIdentity.getReasonForSelect(), ImmutableList.of());
return Session.builder(createTestingSessionPropertyManager(SYSTEM_SESSION_PROPERTIES))
.setQueryId(new QueryId(session.getQueryId()))
.setTransactionId(transactionId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static Session buildOwnerSession(Session session, Optional<String> owner,
public static Identity getOwnerIdentity(Optional<String> owner, Session session)
{
if (owner.isPresent() && !owner.get().equals(session.getIdentity().getUser())) {
return new Identity(owner.get(), Optional.empty(), session.getIdentity().getExtraCredentials());
return new Identity(owner.get(), Optional.empty(), ImmutableMap.of(), session.getIdentity().getExtraCredentials(), ImmutableMap.of(), Optional.empty(), session.getIdentity().getReasonForSelect(), ImmutableList.of());
}
return session.getIdentity();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2474,7 +2474,7 @@ private Scope processMaterializedView(
if (!owner.isPresent()) {
throw new SemanticException(NOT_SUPPORTED, "Owner must be present for DEFINER security mode");
}
queryIdentity = new Identity(owner.get(), Optional.empty(), session.getIdentity().getExtraCredentials());
queryIdentity = new Identity(owner.get(), Optional.empty(), emptyMap(), session.getIdentity().getExtraCredentials(), emptyMap(), Optional.empty(), session.getIdentity().getReasonForSelect(), emptyList());
// For materialized views, use regular access control (not ViewAccessControl)
// to check SELECT permissions on base tables, not CREATE VIEW permissions
queryAccessControl = accessControl;
Expand Down Expand Up @@ -4258,7 +4258,7 @@ private RelationType analyzeView(Query query, QualifiedObjectName name, Optional
AccessControl viewAccessControl;
if (owner.isPresent() && !owner.get().equals(session.getIdentity().getUser())) {
// definer mode
identity = new Identity(owner.get(), Optional.empty(), session.getIdentity().getExtraCredentials());
identity = new Identity(owner.get(), Optional.empty(), emptyMap(), session.getIdentity().getExtraCredentials(), emptyMap(), Optional.empty(), session.getIdentity().getReasonForSelect(), emptyList());
viewAccessControl = new ViewAccessControl(accessControl);
}
else {
Expand Down
Loading