fix(Share Unit): Teacher owner loses authoring permission #212
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.
Changes
Added
@Transactional
in these locationsTest
We haven't found a reliable way to reproduce the problem so this is an attempt to fix the problem. Here is how to attempt to reproduce the problem.
Sign in as a teacher
Go to the Unit Library
Add and remove shared teachers
Add and remove shared teacher permissions
Go to the Class Schedule
Add and remove shared teachers
Add and remove shared teacher permissions
Make sure the teacher owner can still make changes to the unit
Here is how you can check the permissions in the database
Log in to the local Docker MySQL database
Run this query to look up permissions for a project (replace <project id> with your project id)
Remember the id from the result and then run this query (replace <id from previous query>)
Run this query to look up permissions for a run (replace <run id> with your run id)
Remember the id from the result and then run this query (replace <id from previous query>)
Here's an example of looking up the permissions for project id 25. Notice in the result of the first query, the id is 72 so we use 72 in the second query. The result of the second query shows that sid 1 has permission mask 16 (full access) and sid 22 has mask 1 (read) and 2 (write) permissions. Basically you want to make sure the teacher owner mask 16 row does not get deleted.
To look up who an sid refers to you can use this query (replace <sid>)
Here is an example where you can see the username in the sid column.
Closes #211