-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[FC-0049] Handle tags when importing/exporting courses #34356
Merged
bradenmacdonald
merged 26 commits into
openedx:master
from
open-craft:chris/FAL-3624-import-export-courses
Apr 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
de3decb
refactor: Extract generate tags on csv to a function api
ChrisChV 8056ea4
feat: Add tags.csv to export tarball
ChrisChV 0c74ae2
feat: Verify tag count to generate tags.csv
ChrisChV 82dab62
feat: Add new fields to csv exporter
ChrisChV 2f931b3
test: Fix tests and types on csv exporting
ChrisChV 07db758
feat: Import tags on course and blocks
ChrisChV 2ee29e5
Merge branch 'master' into chris/FAL-3624-import-export-courses
ChrisChV f7e3260
test: Fixing tests and adding test for import
ChrisChV abf7b06
fix: Tests and lint
ChrisChV 97571af
style: on comments
ChrisChV 9bba25c
style: Nit on comment
ChrisChV d143b4f
Merge branch 'master' into chris/FAL-3624-import-export-courses
ChrisChV 476cf95
refactor: Change export/import tags separator to ';'
ChrisChV 1a3fbb6
Merge branch 'master' into chris/FAL-3624-import-export-courses
ChrisChV 70d1d64
chore: bump version
ChrisChV 31eab30
fix: Bug in `get_all_object_tags`
ChrisChV 297e212
Merge branch 'master' into chris/FAL-3624-import-export-courses
ChrisChV 4534de0
style: Nits
ChrisChV 1a8b8b6
chore: Fix merge conflicts
ChrisChV 5435985
style: Fix types checks
ChrisChV fdf7bc7
Merge branch 'master' into chris/FAL-3624-import-export-courses
ChrisChV 8e8a595
refactor: Move test_objecttag_export_helpers.py to test directory
ChrisChV bda8da2
fix: Fix tests
ChrisChV a271fde
style: Nits on tests
ChrisChV 90d6572
Merge branch 'master' into chris/FAL-3624-import-export-courses
ChrisChV c80f6f7
style: Nit on pylint
ChrisChV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: Add tags.csv to export tarball
- Loading branch information
commit 8056ea4a820e5b9c6fd39986629afd5da0e94dfb
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" | ||
Functions to validate the access in content tagging actions | ||
""" | ||
|
||
|
||
from openedx_tagging.core.tagging import rules as oel_tagging_rules | ||
|
||
|
||
def has_view_object_tags_access(user, object_id): | ||
return user.has_perm( | ||
"oel_tagging.view_objecttag", | ||
# The obj arg expects a model, but we are passing an object | ||
oel_tagging_rules.ObjectTagPermissionItem(taxonomy=None, object_id=object_id), # type: ignore[arg-type] | ||
) |
176 changes: 175 additions & 1 deletion
176
openedx/core/djangoapps/content_tagging/helpers/test_objecttag_export_helpers.py
bradenmacdonald marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're already checking
if not has_course_author_access(request.user, course_key):
- isn't that enough?I'm just slightly worried that this will cause some issue where exports start to fail for people who aren't even using tags at all in their course, so I want to play it safe here.
If you want to keep it in, we should just disable the
tags.csv
file when the user doesn't have permission, rather than making the whole export fail.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right, I will follow this. 👍
I think do this will do the code more complex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, just take it out for now. The existing check for
has_course_author_access
is sufficient. If you're allowed to export the course, you're allowed to see all the tags.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here