openedx-learning 0.9.2__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.
@@ -1,4 +1,4 @@
1
1
  """
2
2
  Open edX Learning ("Learning Core").
3
3
  """
4
- __version__ = "0.9.2"
4
+ __version__ = "0.9.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openedx-learning
3
- Version: 0.9.2
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
@@ -19,12 +19,12 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Requires-Python: >=3.8
21
21
  License-File: LICENSE.txt
22
- Requires-Dist: celery
23
- Requires-Dist: rules <4.0
24
- Requires-Dist: attrs
25
22
  Requires-Dist: djangorestframework <4.0
26
- Requires-Dist: edx-drf-extensions
27
23
  Requires-Dist: Django <5.0
24
+ Requires-Dist: edx-drf-extensions
25
+ Requires-Dist: attrs
26
+ Requires-Dist: celery
27
+ Requires-Dist: rules <4.0
28
28
 
29
29
  openedx-learning
30
30
  =============================
@@ -1,4 +1,4 @@
1
- openedx_learning/__init__.py,sha256=ECb2Sd2veOeayJ4HWLO6if-nV7ep1cVnYlQmVRaKWY0,67
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=UqIPPbOVA6FFF6uqLk0s5ORUczSYQt-a-S6Q_dB-RiE,6286
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=zPErzfAYqroS5hg7gYiR0L7lPsDcbhstpviqLjmIbhA,13476
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
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.2.dist-info/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
102
- openedx_learning-0.9.2.dist-info/METADATA,sha256=wfb2Rb0W1l2BZvNDAq1-XJE7Up39WhSFcgjQMAKWj4w,8860
103
- openedx_learning-0.9.2.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
104
- openedx_learning-0.9.2.dist-info/top_level.txt,sha256=IYFbr5mgiEHd-LOtZmXj3q3a0bkGK1M9LY7GXgnfi4M,33
105
- openedx_learning-0.9.2.dist-info/RECORD,,
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(method_name='get_can_delete')
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):
@@ -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)