Skip to content

Remove Unused code path in SqlQueryStructure #487

Description

@seantleonard

Issue

Tests like those in ODataASTVisitorUnitTests fail because the integration test fixture does not take authorization into consideration. These tests need to be updated.

Background

SqlQueryStructure handling REST requests checks if Columns.Count == 0 here:
https://github.com/Azure/hawaii-gql/blob/38588fc1496f82299dfa067744db5fcc2c5d062e/DataGateway.Service/Resolvers/Sql%20Query%20Structures/SqlQueryStructure.cs#L134-L141
And proceeds to add all columns from the table definition as "FieldsToBeReturned" in the results. This code path will not be reached in production code with Authorization mechanics in place. The behavior with authorization is that, for Find Requests, the results will only contain fields that the request is allowed to access.

For example, consider the following permissions config:

{
"Book": {
      "source": "books",
      "permissions": [
        {
          "role": "Author",
          "actions": [
            {
              "action": "read",
              "fields": {
                "include": [ "*" ],
                "exclude": [ "publisher_id" ]
              }
            }
          ]
        }
      ],
      "relationships": {
      }
    }
}

and REST Request: http://localhost:5001/rest/book/id/8
the expected result does not include the publisher_id field:

{
    "value": [
        {
            "id": 8,
            "title": "Time to Eat"
        }
    ]
}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions