current
This commit is contained in:
@@ -20,5 +20,7 @@ class AccessChecker {
|
||||
public:
|
||||
virtual bool IsUserAuthorizedEdgeTypes(const std::vector<memgraph::storage::EdgeTypeId> &edgeTypes,
|
||||
memgraph::query::DbAccessor *dba) const = 0;
|
||||
|
||||
virtual std::vector<memgraph::storage::EdgeTypeId> GetGrantedEdgeTypesId(memgraph::query::DbAccessor *dba) const = 0;
|
||||
};
|
||||
} // namespace memgraph::query
|
||||
|
||||
@@ -273,6 +273,14 @@ class AccessChecker final : public memgraph::query::AccessChecker {
|
||||
});
|
||||
}
|
||||
|
||||
std::vector<memgraph::storage::EdgeTypeId> GetGrantedEdgeTypesId(memgraph::query::DbAccessor *dba) const final {
|
||||
auto edgeTypePermissions = user_->GetEdgeTypePermissions().GetGrants();
|
||||
std::vector<memgraph::storage::EdgeTypeId> edgeTypeIds{};
|
||||
for (auto edgeTypePermission : edgeTypePermissions) edgeTypeIds.push_back(dba->NameToEdgeType(edgeTypePermission));
|
||||
|
||||
return edgeTypeIds;
|
||||
}
|
||||
|
||||
private:
|
||||
memgraph::auth::User *user_;
|
||||
};
|
||||
|
||||
@@ -732,6 +732,7 @@ bool Expand::ExpandCursor::InitEdges(Frame &frame, ExecutionContext &context) {
|
||||
auto &vertex = vertex_value.ValueVertex();
|
||||
|
||||
auto direction = self_.common_.direction;
|
||||
|
||||
if (direction == EdgeAtom::Direction::IN || direction == EdgeAtom::Direction::BOTH) {
|
||||
if (self_.common_.existing_node) {
|
||||
TypedValue &existing_node = frame[self_.common_.node_symbol];
|
||||
|
||||
@@ -339,7 +339,7 @@ Result<std::map<PropertyId, PropertyValue>> VertexAccessor::Properties(View view
|
||||
return std::move(properties);
|
||||
}
|
||||
|
||||
Result<std::vector<EdgeAccessor>> VertexAccessor::InEdges(View view, const std::vector<EdgeTypeId> &edge_types,
|
||||
Result<std::vector<EdgeAccessor>> VertexAccessor::InEdges(View view, AccessChecker *access_checker,
|
||||
const VertexAccessor *destination) const {
|
||||
MG_ASSERT(!destination || destination->transaction_ == transaction_, "Invalid accessor!");
|
||||
bool exists = true;
|
||||
|
||||
@@ -81,7 +81,7 @@ class VertexAccessor final {
|
||||
/// @throw std::bad_alloc
|
||||
/// @throw std::length_error if the resulting vector exceeds
|
||||
/// std::vector::max_size().
|
||||
Result<std::vector<EdgeAccessor>> InEdges(View view, const std::vector<EdgeTypeId> &edge_types = {},
|
||||
Result<std::vector<EdgeAccessor>> InEdges(View view, AccessChecker *access_checker = nullptr,
|
||||
const VertexAccessor *destination = nullptr) const;
|
||||
|
||||
/// @throw std::bad_alloc
|
||||
|
||||
Reference in New Issue
Block a user