Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ODS-1462] Use semantic model to derive entity specifications #862

Merged
merged 8 commits into from
Nov 9, 2023

Conversation

simpat-jesus
Copy link
Contributor

No description provided.

@simpat-jesus simpat-jesus marked this pull request as draft October 28, 2023 00:32
@simpat-jesus simpat-jesus force-pushed the ODS-1462 branch 2 times, most recently from 94957f4 to 8a40919 Compare October 31, 2023 23:38
@simpat-jesus simpat-jesus marked this pull request as ready for review October 31, 2023 23:38
@simpat-jesus simpat-jesus force-pushed the ODS-1462 branch 4 times, most recently from 1df6f80 to 50bc831 Compare November 8, 2023 15:59
@@ -31,6 +31,12 @@ protected override void Load(ContainerBuilder builder)
builder.RegisterType<StudentAssessmentRelationshipsAuthorizationContextDataProvider<RelationshipsAuthorizationContextData>>()
.As<IRelationshipsAuthorizationContextDataProvider<IStudentAssessment, RelationshipsAuthorizationContextData>>()
.SingleInstance();

// Establish authorization context for EducationOrganizationNetworkAssociation using the MemberEducationOrganizationId rather than
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change supposed to be part of this ticket?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to revert this change to the authorization context -- but we'll need to figure out how to proceed with the issues it was introduced here to resolve. That's TBD.


var contextData = new TContextData();
// contextData.EducationOrganizationNetworkId = entity.EducationOrganizationNetworkId == default(long) ? null as long? : entity.EducationOrganizationNetworkId; // Primary key property, Only Education Organization Id present
contextData.EducationOrganizationId = entity.MemberEducationOrganizationId; // Primary key property, Role name applied
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the background context was for the decision to implement this, but the management of the associations of EdOrgs into a network should be managed by an API client associated with the EducationOrganizationNetwork. As implemented here, it's basically saying that any API client can change the network associations to "opt in" their associated EdOrg(s) into the network, and that doesn't seem right.

Can you provide the background context around this decision?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this override because smoke tests failed on the EducationOrganizationNetworkAssociation Post, with an Authorization Denied error indicating that the caller's EducationOrganization had no relationship to the EducationOrganizationNetworkId; so I looked at the database table for the Association and added this override based on the MemberEducationOrganization foreign key.

With this, I'm not sure if there is an error in the smoke test code and the EducationOrganizationNetworkAssociation was included as a valid EdOrg or if it still can be solved with an override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely need to revert this approach and find a different solution that doesn't involve changing the authorization context data used for authorizing the resource.

" pm.expect(responseItems.length).to.be.greaterThan(0);\r",
" pm.test(\"Should return some rows\", () => {\r",
" const responseItems = pm.response.json();\r",
" pm.expect(responseItems.length).to.be.gte(0);\r",
Copy link
Contributor

@gmcelhanon gmcelhanon Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing this test to pass with >=0 items instead of >0 items is suspicious. Also, in just looking further the tests in this particular folder as a whole, they actually don't test that authorization filtering is being done correctly by observing actual differences between where a record should be returned and where one should not, and particularly when there are no rows returned -- that is even more vague.

Notionally, these tests should set up some data that will be returned for one client (i.e. the LEA client), and not returned for another client without access to the LEA level data. That would provide the desired functional coverage.

But then again, I'm also back to wondering why these changes are included as part of ODS-1462.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I included this change because, after updating the database packages, the database used to test does not include any rows for the postman tests added in [ODS-6064] failed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change needs to be reverted because it effectively disables the verification but makes it look like coverage is provided. That said, I think more needs to be done in these tests to demonstrate proper coverage of the authorization behavior, but we may need to consider moving that to another ticket and perhaps explicitly disable these tests from execution temporarily (using something like if (false) { .. }).

@@ -867,7 +867,7 @@ BEGIN

INSERT [dbo].[ResourceClaims] ([ResourceName], [ClaimName], [ParentResourceClaimId])
VALUES (N'educationOrganizationNetworkAssociation', N'http://ed-fi.org/ods/identity/claims/educationOrganizationNetworkAssociation',
@educationOrganizationsResourceClaimId);
@relationshipBasedDataResourceClaimId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look correct because the EducationOrganizationNetworkAssociation entity is not an EdOrg (but EducationOrganizationNetwork is).

@gmcelhanon gmcelhanon merged commit 0953d71 into main Nov 9, 2023
15 checks passed
@gmcelhanon gmcelhanon deleted the ODS-1462 branch November 9, 2023 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants