Lab2: remove script level ID from find project API #70179
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Minor cleanup to the get_or_create_for_level projects API that I noticed during HoAI work: previously we were passing in the
scriptLevelIdto this API because we used it in conjunction with a provided user ID to verify if the current user had permission to view the given user's project on this level. However, thecan?(:view_as_user)function that receives the script level ID only actually uses it for code review-specific scenarios, and otherwise just checks if the given user is a student of the current user. Since the latter conditions is all we care about, we can skip checking the script level ID which simplifies logic in this controller action and simplifies downstream API and function calls.Testing story
Tested locally that teacher view student work still works as expected, and otherwise users cannot access projects of other users that are not their students.