oarepo-runtime 1.5.77__py3-none-any.whl → 1.5.78__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  from .link_conditions import (
2
2
  has_draft,
3
+ has_file_permission,
3
4
  has_permission,
4
5
  has_permission_file_service,
5
6
  has_published_record,
@@ -25,5 +26,6 @@ __all__ = (
25
26
  "has_draft",
26
27
  "has_permission",
27
28
  "has_permission_file_service",
29
+ "has_file_permission",
28
30
  "has_published_record",
29
31
  )
@@ -1,19 +1,21 @@
1
+ import warnings
1
2
  from abc import abstractmethod
3
+ from logging import getLogger
2
4
 
3
5
  from invenio_pidstore.errors import PIDDoesNotExistError, PIDUnregistered
4
- from invenio_records_resources.records.api import FileRecord
5
6
  from invenio_records.api import RecordBase
6
- from invenio_records_resources.records.api import Record
7
- from logging import getLogger
7
+ from invenio_records_resources.records.api import FileRecord, Record
8
+
8
9
  from ...datastreams.utils import (
9
10
  get_file_service_for_file_record_class,
10
11
  get_file_service_for_record_class,
11
12
  get_record_service_for_record,
12
13
  )
14
+
13
15
  log = getLogger(__name__)
14
16
 
15
- class Condition:
16
17
 
18
+ class Condition:
17
19
  @abstractmethod
18
20
  def __call__(self, obj, ctx: dict):
19
21
  raise NotImplementedError
@@ -74,9 +76,7 @@ class has_permission(Condition):
74
76
  log.exception(f"Unexpected exception {e}.")
75
77
 
76
78
 
77
-
78
- class has_permission_file_service(has_permission):
79
-
79
+ class has_file_permission(has_permission):
80
80
  def __call__(self, obj: RecordBase, ctx: dict):
81
81
  if isinstance(obj, FileRecord):
82
82
  service = get_file_service_for_file_record_class(type(obj))
@@ -90,8 +90,16 @@ class has_permission_file_service(has_permission):
90
90
  log.exception(f"Unexpected exception {e}.")
91
91
 
92
92
 
93
- class has_published_record(Condition):
93
+ class has_permission_file_service(has_file_permission):
94
+ def __init__(self, action_name):
95
+ warnings.warn(
96
+ "has_permission_file_service is deprecated, use has_file_permission instead",
97
+ DeprecationWarning,
98
+ )
99
+ super().__init__(action_name)
100
+
94
101
 
102
+ class has_published_record(Condition):
95
103
  def __call__(self, obj: Record, ctx: dict):
96
104
  service = get_record_service_for_record(obj)
97
105
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oarepo-runtime
3
- Version: 1.5.77
3
+ Version: 1.5.78
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -75,8 +75,8 @@ oarepo_runtime/services/components.py,sha256=k--zu1RinwoKzg5qHp4H-Ddp9AFyjMJ97fy
75
75
  oarepo_runtime/services/generators.py,sha256=j87HitHA_w2awsz0C5IAAJ0qjg9JMtvdO3dvh6FQyfg,250
76
76
  oarepo_runtime/services/results.py,sha256=Ap2mUJHl3V4BSduTrBWPuco0inQVq0QsuCbVhez48uY,5705
77
77
  oarepo_runtime/services/search.py,sha256=9xGTN5Yg6eTdptQ9qjO_umbacf9ooMuHYGXWYfla4-M,6227
78
- oarepo_runtime/services/config/__init__.py,sha256=EOpmlw0rjAUGmErTRcLOOBADeXKJKdsk62lAgFbRKQ8,731
79
- oarepo_runtime/services/config/link_conditions.py,sha256=xCusAqc7zqh0EGu2f6CF84ImyYHvzEKIOmLQYpyewzE,3113
78
+ oarepo_runtime/services/config/__init__.py,sha256=559w4vphVAipa420OwTsxGUP-b7idoqSIX13FSJyVz0,783
79
+ oarepo_runtime/services/config/link_conditions.py,sha256=V4GOC62HBt6ohUgIXRGm0kXAvCoxEXjhC5Ghy6i5qB4,3359
80
80
  oarepo_runtime/services/config/permissions_presets.py,sha256=V0dMrikzTzTiM2NRtdGgTML7AtXlrlYZ_vm3btzbJd4,6472
81
81
  oarepo_runtime/services/config/service.py,sha256=s-dVbGkLICpsce6jgu7b5kzYFz9opWjSQFDBgbIhKio,4002
82
82
  oarepo_runtime/services/custom_fields/__init__.py,sha256=_gqMcA_I3rdEZcBtCuDjO4wdVCqFML5NzaccuPx5a3o,2565
@@ -133,9 +133,9 @@ tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
133
133
  tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
134
134
  tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
135
135
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
- oarepo_runtime-1.5.77.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
137
- oarepo_runtime-1.5.77.dist-info/METADATA,sha256=zTSdUbRgidqR57Pu8hNATAZPLbTdJ4Qr0UABAVaAtZc,4720
138
- oarepo_runtime-1.5.77.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
139
- oarepo_runtime-1.5.77.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
140
- oarepo_runtime-1.5.77.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
141
- oarepo_runtime-1.5.77.dist-info/RECORD,,
136
+ oarepo_runtime-1.5.78.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
137
+ oarepo_runtime-1.5.78.dist-info/METADATA,sha256=JVOrQorK03feb6KdPinbMptMKZeMbGKlDXEzrz0yCQI,4720
138
+ oarepo_runtime-1.5.78.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
139
+ oarepo_runtime-1.5.78.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
140
+ oarepo_runtime-1.5.78.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
141
+ oarepo_runtime-1.5.78.dist-info/RECORD,,