openedx-learning 0.9.1__py2.py3-none-any.whl → 0.9.3__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openedx_learning/__init__.py +1 -1
- {openedx_learning-0.9.1.dist-info → openedx_learning-0.9.3.dist-info}/METADATA +3 -3
- {openedx_learning-0.9.1.dist-info → openedx_learning-0.9.3.dist-info}/RECORD +9 -9
- openedx_tagging/core/tagging/rest_api/v1/serializers.py +9 -2
- openedx_tagging/core/tagging/rest_api/v1/views.py +8 -2
- openedx_tagging/core/tagging/rules.py +11 -0
- {openedx_learning-0.9.1.dist-info → openedx_learning-0.9.3.dist-info}/LICENSE.txt +0 -0
- {openedx_learning-0.9.1.dist-info → openedx_learning-0.9.3.dist-info}/WHEEL +0 -0
- {openedx_learning-0.9.1.dist-info → openedx_learning-0.9.3.dist-info}/top_level.txt +0 -0
openedx_learning/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: openedx-learning
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.3
|
|
4
4
|
Summary: An experiment.
|
|
5
5
|
Home-page: https://github.com/openedx/openedx-learning
|
|
6
6
|
Author: David Ormsbee
|
|
@@ -20,9 +20,9 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
20
20
|
Requires-Python: >=3.8
|
|
21
21
|
License-File: LICENSE.txt
|
|
22
22
|
Requires-Dist: djangorestframework <4.0
|
|
23
|
-
Requires-Dist: attrs
|
|
24
|
-
Requires-Dist: edx-drf-extensions
|
|
25
23
|
Requires-Dist: Django <5.0
|
|
24
|
+
Requires-Dist: edx-drf-extensions
|
|
25
|
+
Requires-Dist: attrs
|
|
26
26
|
Requires-Dist: celery
|
|
27
27
|
Requires-Dist: rules <4.0
|
|
28
28
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
openedx_learning/__init__.py,sha256=
|
|
1
|
+
openedx_learning/__init__.py,sha256=EfjfyOQVIjOVYMNlUo9QxJoi0su5KwN9ncFBkCrXPAk,67
|
|
2
2
|
openedx_learning/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
openedx_learning/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
openedx_learning/contrib/media_server/__init__.py,sha256=iYijWFCl5RNR9omSu22kMl49EfponoqXBqXr0HMp4QI,56
|
|
@@ -52,7 +52,7 @@ openedx_tagging/core/tagging/admin.py,sha256=Ngc2l9Mf6gkzmqu7aOwq-d0mgV8szx0GzSe
|
|
|
52
52
|
openedx_tagging/core/tagging/api.py,sha256=JlS8KQiTBd0rEQqEqE5hf7QnCnR9KZRFw-ShcJPhJ4U,18749
|
|
53
53
|
openedx_tagging/core/tagging/apps.py,sha256=-gp0VYqX4XQzwjjd-G68Ev2Op0INLh9Byz5UOqF5_7k,345
|
|
54
54
|
openedx_tagging/core/tagging/data.py,sha256=421EvmDzdM7H523dBVQk4J0W_UwTT4U5syqPRXUYK4g,1353
|
|
55
|
-
openedx_tagging/core/tagging/rules.py,sha256=
|
|
55
|
+
openedx_tagging/core/tagging/rules.py,sha256=Gzw2RCQxoAv2PpOwOWgpD17XoZfowlFnNgQqYn59q_g,6715
|
|
56
56
|
openedx_tagging/core/tagging/urls.py,sha256=-0Nzmh0mlF9-GgEuocwBdSJn6n8EINnxR4m4pmPou44,159
|
|
57
57
|
openedx_tagging/core/tagging/import_export/__init__.py,sha256=q5K4JalFQlJxAFUFyqhLY5zQtAskDnRM1H_aVuP_E3Q,83
|
|
58
58
|
openedx_tagging/core/tagging/import_export/actions.py,sha256=1nsGoa7eSfMF4gB-GqNRlTkl22z3Lqo7y8ay1rnNy0E,13368
|
|
@@ -94,12 +94,12 @@ openedx_tagging/core/tagging/rest_api/urls.py,sha256=egXaRQv1EAgF04ThgVZBQuvLK1L
|
|
|
94
94
|
openedx_tagging/core/tagging/rest_api/utils.py,sha256=XZXixZ44vpNlxiyFplW8Lktyh_m1EfR3Y-tnyvA7acc,3620
|
|
95
95
|
openedx_tagging/core/tagging/rest_api/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
96
96
|
openedx_tagging/core/tagging/rest_api/v1/permissions.py,sha256=7HPE_NuKku_ISnkeE_HsFNXVYt0IbVkJN6M4wqwHGHU,2443
|
|
97
|
-
openedx_tagging/core/tagging/rest_api/v1/serializers.py,sha256=
|
|
97
|
+
openedx_tagging/core/tagging/rest_api/v1/serializers.py,sha256=gbvEBLvsmfPc3swWz-_TEK8YpXiOa4oBXsU89_5iXiE,13749
|
|
98
98
|
openedx_tagging/core/tagging/rest_api/v1/urls.py,sha256=dNUKCtUCx_YzrwlbEbpDfjGVQbb2QdJ1VuJCkladj6E,752
|
|
99
|
-
openedx_tagging/core/tagging/rest_api/v1/views.py,sha256=
|
|
99
|
+
openedx_tagging/core/tagging/rest_api/v1/views.py,sha256=ZRkSILdb8g5k_BcuuVVfdffEdY9vFQ_YtMa3JrN0Xz8,35581
|
|
100
100
|
openedx_tagging/core/tagging/rest_api/v1/views_import.py,sha256=kbHUPe5A6WaaJ3J1lFIcYCt876ecLNQfd19m7YYub6c,1470
|
|
101
|
-
openedx_learning-0.9.
|
|
102
|
-
openedx_learning-0.9.
|
|
103
|
-
openedx_learning-0.9.
|
|
104
|
-
openedx_learning-0.9.
|
|
105
|
-
openedx_learning-0.9.
|
|
101
|
+
openedx_learning-0.9.3.dist-info/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
|
|
102
|
+
openedx_learning-0.9.3.dist-info/METADATA,sha256=qCr7maCmqbhW_lwaYhJRsu6BdicczVsjiRlxdcgJk1g,8860
|
|
103
|
+
openedx_learning-0.9.3.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
|
104
|
+
openedx_learning-0.9.3.dist-info/top_level.txt,sha256=IYFbr5mgiEHd-LOtZmXj3q3a0bkGK1M9LY7GXgnfi4M,33
|
|
105
|
+
openedx_learning-0.9.3.dist-info/RECORD,,
|
|
@@ -140,7 +140,14 @@ class ObjectTagMinimalSerializer(UserPermissionsSerializerMixin, serializers.Mod
|
|
|
140
140
|
fields = ["value", "lineage", "can_delete_objecttag"]
|
|
141
141
|
|
|
142
142
|
lineage = serializers.ListField(child=serializers.CharField(), source="get_lineage", read_only=True)
|
|
143
|
-
can_delete_objecttag = serializers.SerializerMethodField(
|
|
143
|
+
can_delete_objecttag = serializers.SerializerMethodField()
|
|
144
|
+
|
|
145
|
+
def get_can_delete_objecttag(self, instance) -> bool | None:
|
|
146
|
+
"""
|
|
147
|
+
Returns True if the current request user may delete object tags on this taxonomy
|
|
148
|
+
"""
|
|
149
|
+
perm_name = f'{self.app_label}.remove_objecttag_objectid'
|
|
150
|
+
return self._can(perm_name, instance.object_id)
|
|
144
151
|
|
|
145
152
|
|
|
146
153
|
class ObjectTagSerializer(ObjectTagMinimalSerializer):
|
|
@@ -342,7 +349,7 @@ class TaxonomyImportNewBodySerializer(TaxonomyImportBodySerializer): # pylint:
|
|
|
342
349
|
"""
|
|
343
350
|
taxonomy_name = serializers.CharField(required=True)
|
|
344
351
|
taxonomy_description = serializers.CharField(default="")
|
|
345
|
-
taxonomy_export_id = serializers.CharField(required=
|
|
352
|
+
taxonomy_export_id = serializers.CharField(required=False)
|
|
346
353
|
|
|
347
354
|
|
|
348
355
|
class TagImportTaskSerializer(serializers.ModelSerializer):
|
|
@@ -304,12 +304,18 @@ class TaxonomyView(ModelViewSet):
|
|
|
304
304
|
body.is_valid(raise_exception=True)
|
|
305
305
|
|
|
306
306
|
taxonomy_name = body.validated_data["taxonomy_name"]
|
|
307
|
-
taxonomy_export_id = body.validated_data
|
|
307
|
+
taxonomy_export_id = body.validated_data.get("taxonomy_export_id")
|
|
308
308
|
taxonomy_description = body.validated_data["taxonomy_description"]
|
|
309
309
|
file = body.validated_data["file"].file
|
|
310
310
|
parser_format = body.validated_data["parser_format"]
|
|
311
311
|
|
|
312
|
-
|
|
312
|
+
# If no taxonomy_export_id provided, a unique export id will be generated
|
|
313
|
+
taxonomy = create_taxonomy(
|
|
314
|
+
taxonomy_name,
|
|
315
|
+
taxonomy_description,
|
|
316
|
+
export_id=taxonomy_export_id,
|
|
317
|
+
)
|
|
318
|
+
|
|
313
319
|
try:
|
|
314
320
|
import_success, task, _plan = import_tags(taxonomy, file, parser_format)
|
|
315
321
|
|
|
@@ -137,6 +137,16 @@ def can_change_object_tag_objectid(_user: UserType, _object_id: str) -> bool:
|
|
|
137
137
|
return False
|
|
138
138
|
|
|
139
139
|
|
|
140
|
+
@rules.predicate
|
|
141
|
+
def can_remove_object_tag_objectid(_user: UserType, _object_id: str) -> bool:
|
|
142
|
+
"""
|
|
143
|
+
Nobody can remove object tags without checking the permission for the tagged object.
|
|
144
|
+
|
|
145
|
+
This rule could be defined in other apps for proper permission checking.
|
|
146
|
+
"""
|
|
147
|
+
return can_change_object_tag_objectid(_user, _object_id)
|
|
148
|
+
|
|
149
|
+
|
|
140
150
|
@rules.predicate
|
|
141
151
|
def can_change_object_tag(
|
|
142
152
|
user: UserType, perm_obj: ObjectTagPermissionItem | None = None
|
|
@@ -194,3 +204,4 @@ rules.add_perm("oel_tagging.view_objecttag_objectid", can_view_object_tag_object
|
|
|
194
204
|
rules.add_perm("oel_tagging.view_objecttag_taxonomy", can_view_object_tag_taxonomy)
|
|
195
205
|
rules.add_perm("oel_tagging.change_objecttag_taxonomy", can_view_object_tag_taxonomy)
|
|
196
206
|
rules.add_perm("oel_tagging.change_objecttag_objectid", can_change_object_tag_objectid)
|
|
207
|
+
rules.add_perm("oel_tagging.remove_objecttag_objectid", can_remove_object_tag_objectid)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|