oarepo-runtime 1.5.82__py3-none-any.whl → 1.5.84__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,7 @@ class OaiHarvesterPermissionPolicy(RecordPermissionPolicy):
23
23
  can_read_files = [AnyUser(), SystemProcess()]
24
24
  can_update_files = [SystemProcess()]
25
25
  can_delete_files = [SystemProcess()]
26
+ can_manage_files = [SystemProcess()]
26
27
 
27
28
  can_edit = [SystemProcess()]
28
29
  can_new_version = [SystemProcess()]
@@ -59,6 +60,7 @@ class ReadOnlyPermissionPolicy(RecordPermissionPolicy):
59
60
  can_update_files = [SystemProcess()]
60
61
  can_delete_files = [SystemProcess()]
61
62
  can_list_files = [SystemProcess()]
63
+ can_manage_files = [SystemProcess()]
62
64
 
63
65
  can_edit = [SystemProcess()]
64
66
  can_new_version = [SystemProcess()]
@@ -97,6 +99,7 @@ class EveryonePermissionPolicy(RecordPermissionPolicy):
97
99
  can_update_files = [SystemProcess(), AnyUser()]
98
100
  can_delete_files = [SystemProcess(), AnyUser()]
99
101
  can_list_files = [SystemProcess(), AnyUser()]
102
+ can_manage_files = [SystemProcess(), AnyUser()]
100
103
 
101
104
  can_edit = [SystemProcess(), AnyUser()]
102
105
  can_new_version = [SystemProcess(), AnyUser()]
@@ -135,6 +138,7 @@ class AuthenticatedPermissionPolicy(RecordPermissionPolicy):
135
138
  can_update_files = [SystemProcess(), AuthenticatedUser()]
136
139
  can_delete_files = [SystemProcess(), AuthenticatedUser()]
137
140
  can_list_files = [SystemProcess(), AuthenticatedUser()]
141
+ can_manage_files = [SystemProcess(), AuthenticatedUser()]
138
142
 
139
143
  can_edit = [SystemProcess(), AuthenticatedUser()]
140
144
  can_new_version = [SystemProcess(), AuthenticatedUser()]
@@ -1,7 +1,7 @@
1
1
  from flask_principal import RoleNeed, UserNeed
2
2
  from invenio_records_permissions.generators import Generator
3
3
  from invenio_search.engine import dsl
4
-
4
+ from flask import current_app
5
5
 
6
6
  class RecordOwners(Generator):
7
7
  """Allows record owners."""
@@ -12,7 +12,10 @@ class RecordOwners(Generator):
12
12
  # 'record' is required, so if not passed we default to empty array,
13
13
  # i.e. superuser-access.
14
14
  return []
15
- owners = getattr(record.parent, "owners", None)
15
+ if current_app.config.get('INVENIO_RDM_ENABLED', False):
16
+ owners = getattr(record.parent.access, "owned_by", None)
17
+ else:
18
+ owners = getattr(record.parent, "owners", None)
16
19
  if owners is not None:
17
20
  return [UserNeed(owner.id) for owner in owners]
18
21
  return []
@@ -21,8 +24,10 @@ class RecordOwners(Generator):
21
24
  """Filters for current identity as owner."""
22
25
  users = [n.value for n in identity.provides if n.method == "id"]
23
26
  if users:
24
- return dsl.Q("terms", **{"parent.owners.user": users})
25
-
27
+ if current_app.config.get('INVENIO_RDM_ENABLED', False):
28
+ return dsl.Q("terms", **{"parent.access.owned_by.user": users})
29
+ else:
30
+ return dsl.Q("terms", **{"parent.owners.user": users})
26
31
 
27
32
  class UserWithRole(Generator):
28
33
  def __init__(self, *roles):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oarepo-runtime
3
- Version: 1.5.82
3
+ Version: 1.5.84
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -79,7 +79,7 @@ oarepo_runtime/services/results.py,sha256=Ap2mUJHl3V4BSduTrBWPuco0inQVq0QsuCbVhe
79
79
  oarepo_runtime/services/search.py,sha256=9xGTN5Yg6eTdptQ9qjO_umbacf9ooMuHYGXWYfla4-M,6227
80
80
  oarepo_runtime/services/config/__init__.py,sha256=559w4vphVAipa420OwTsxGUP-b7idoqSIX13FSJyVz0,783
81
81
  oarepo_runtime/services/config/link_conditions.py,sha256=evPRd5XU76Ok4J-08bBfplbHZ019rl74FpJmO8iM5yg,3298
82
- oarepo_runtime/services/config/permissions_presets.py,sha256=V0dMrikzTzTiM2NRtdGgTML7AtXlrlYZ_vm3btzbJd4,6472
82
+ oarepo_runtime/services/config/permissions_presets.py,sha256=YF99Vjh1fGqSEXNw7qIfcUQFvzpE54_BafqkO6wlYHk,6668
83
83
  oarepo_runtime/services/config/service.py,sha256=s-dVbGkLICpsce6jgu7b5kzYFz9opWjSQFDBgbIhKio,4002
84
84
  oarepo_runtime/services/custom_fields/__init__.py,sha256=_gqMcA_I3rdEZcBtCuDjO4wdVCqFML5NzaccuPx5a3o,2565
85
85
  oarepo_runtime/services/custom_fields/mappings.py,sha256=Y1d0s9lG_VThkzSNlxAS94_9eOFZe9N2C1hpYDZvnvI,7457
@@ -103,7 +103,7 @@ oarepo_runtime/services/files/__init__.py,sha256=K8MStrEQf_BUhvzhwPTF93Hkhwrd1dt
103
103
  oarepo_runtime/services/files/components.py,sha256=x6Wd-vvkqTqB1phj2a6h42DNQksN8PuR2XKaOGoNHfw,2400
104
104
  oarepo_runtime/services/files/service.py,sha256=8DH0Pefr9kilM2JnOb-UYsnqerE8Z1Mu4p6DOJ4j_ZU,608
105
105
  oarepo_runtime/services/permissions/__init__.py,sha256=Cgin2Zr1fpaYr-aZcUotdmv0hsrPTUJVQt8ouvU8tuU,95
106
- oarepo_runtime/services/permissions/generators.py,sha256=YEOBCCvU-RG0BSWMtg76sv8qLcMbXxNu3rRJPDLtvvQ,1371
106
+ oarepo_runtime/services/permissions/generators.py,sha256=OAJ_1W5eiLPkNvSXnWTDq0Z4-FU799qHa9tOufiOL3c,1722
107
107
  oarepo_runtime/services/records/__init__.py,sha256=hIoa2fx1AkDr6c-MgY561U2oN9LFeUCtfbVnetpBUOg,78
108
108
  oarepo_runtime/services/records/links.py,sha256=gVe-_hGkLtX7pd6sS6jTbRIhBby2FTn9PXyYPy3yxzs,737
109
109
  oarepo_runtime/services/relations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -135,9 +135,9 @@ tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
135
135
  tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
136
136
  tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
137
137
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
138
- oarepo_runtime-1.5.82.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
139
- oarepo_runtime-1.5.82.dist-info/METADATA,sha256=voTGOQaZq3xVELAst8XE670JICBfFvaE6WsM0UKyvcU,4720
140
- oarepo_runtime-1.5.82.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
141
- oarepo_runtime-1.5.82.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
142
- oarepo_runtime-1.5.82.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
143
- oarepo_runtime-1.5.82.dist-info/RECORD,,
138
+ oarepo_runtime-1.5.84.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
139
+ oarepo_runtime-1.5.84.dist-info/METADATA,sha256=vf27mv-YipJbe7gw3xWB9blq9p1Bszu5U4AEwT92ePg,4720
140
+ oarepo_runtime-1.5.84.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
141
+ oarepo_runtime-1.5.84.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
142
+ oarepo_runtime-1.5.84.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
143
+ oarepo_runtime-1.5.84.dist-info/RECORD,,