nucliadb 6.9.1.post5167__py3-none-any.whl → 6.9.1.post5182__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.

Potentially problematic release.


This version of nucliadb might be problematic. Click here for more details.

@@ -28,7 +28,8 @@ from nucliadb.search.api.v1.resource.utils import get_resource_uuid_by_slug
28
28
  from nucliadb.search.api.v1.router import KB_PREFIX, RESOURCE_SLUG_PREFIX, api
29
29
  from nucliadb_models.resource import NucliaDBRoles
30
30
  from nucliadb_models.search import AskRequest, NucliaDBClientType, SyncAskResponse
31
- from nucliadb_utils.authentication import requires
31
+ from nucliadb_models.security import RequestSecurity
32
+ from nucliadb_utils.authentication import NucliaUser, requires
32
33
 
33
34
  from ..ask import create_ask_response
34
35
 
@@ -58,6 +59,15 @@ async def resource_ask_endpoint_by_uuid(
58
59
  "This is slower and requires waiting for entire answer to be ready.",
59
60
  ),
60
61
  ) -> Union[StreamingResponse, HTTPClientError, Response]:
62
+ current_user: NucliaUser = request.user
63
+ # If present, security groups from AuthorizationBackend overrides any
64
+ # security group of the payload
65
+ if current_user.security_groups:
66
+ if item.security is None:
67
+ item.security = RequestSecurity(groups=current_user.security_groups)
68
+ else:
69
+ item.security.groups = current_user.security_groups
70
+
61
71
  return await create_ask_response(
62
72
  kbid=kbid,
63
73
  ask_request=item,
@@ -98,6 +108,16 @@ async def resource_ask_endpoint_by_slug(
98
108
  resource_id = await get_resource_uuid_by_slug(kbid, slug)
99
109
  if resource_id is None:
100
110
  return HTTPClientError(status_code=404, detail="Resource not found")
111
+
112
+ current_user: NucliaUser = request.user
113
+ # If present, security groups from AuthorizationBackend overrides any
114
+ # security group of the payload
115
+ if current_user.security_groups:
116
+ if item.security is None:
117
+ item.security = RequestSecurity(groups=current_user.security_groups)
118
+ else:
119
+ item.security.groups = current_user.security_groups
120
+
101
121
  return await create_ask_response(
102
122
  kbid=kbid,
103
123
  ask_request=item,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb
3
- Version: 6.9.1.post5167
3
+ Version: 6.9.1.post5182
4
4
  Summary: NucliaDB
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -19,11 +19,11 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Requires-Python: <4,>=3.9
21
21
  Description-Content-Type: text/markdown
22
- Requires-Dist: nucliadb-telemetry[all]>=6.9.1.post5167
23
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.9.1.post5167
24
- Requires-Dist: nucliadb-protos>=6.9.1.post5167
25
- Requires-Dist: nucliadb-models>=6.9.1.post5167
26
- Requires-Dist: nidx-protos>=6.9.1.post5167
22
+ Requires-Dist: nucliadb-telemetry[all]>=6.9.1.post5182
23
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.9.1.post5182
24
+ Requires-Dist: nucliadb-protos>=6.9.1.post5182
25
+ Requires-Dist: nucliadb-models>=6.9.1.post5182
26
+ Requires-Dist: nidx-protos>=6.9.1.post5182
27
27
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
28
28
  Requires-Dist: nuclia-models>=0.50.0
29
29
  Requires-Dist: uvicorn[standard]
@@ -240,7 +240,7 @@ nucliadb/search/api/v1/suggest.py,sha256=gaJE60r8-z6TVO05mQRKBITwXn2_ofM3B4-OtpO
240
240
  nucliadb/search/api/v1/summarize.py,sha256=eJzgFJWUO80STx3lHc_0h9RZVaBCWF196nZUecfmqbE,2700
241
241
  nucliadb/search/api/v1/utils.py,sha256=5Ve-frn7LAE2jqAgB85F8RSeqxDlyA08--gS-AdOLS4,1434
242
242
  nucliadb/search/api/v1/resource/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
243
- nucliadb/search/api/v1/resource/ask.py,sha256=PlOXa17lnmj3KA9bARNfDqvnx7Pe9OTnwz-OwgGTUjU,4035
243
+ nucliadb/search/api/v1/resource/ask.py,sha256=Il9Y9lGtmlAXolnxAGGZsubRYSe5FjQCG3LWkmgDcsE,4871
244
244
  nucliadb/search/api/v1/resource/ingestion_agents.py,sha256=AZ5_cH1jbf7d5wh_gz6EHLEKAzEOMrQZwEZAu1Q_3FE,4846
245
245
  nucliadb/search/api/v1/resource/search.py,sha256=PZR7fs5oYD0RKqKoD38NZMAnOJzBv35NB2YOr2xy1ck,4923
246
246
  nucliadb/search/api/v1/resource/utils.py,sha256=-NjZqAQtFEXKpIh8ui5S26ItnJ5rzmmG0BHxGSS9QPw,1141
@@ -385,8 +385,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
385
385
  nucliadb/writer/tus/s3.py,sha256=vu1BGg4VqJ_x2P1u2BxqPKlSfw5orT_a3R-Ln5oPUpU,8483
386
386
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
387
387
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
388
- nucliadb-6.9.1.post5167.dist-info/METADATA,sha256=indP95ktNW4UCSZQa5RbOcD4tPy-Bb7N7zE1WH5WJbg,4158
389
- nucliadb-6.9.1.post5167.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
390
- nucliadb-6.9.1.post5167.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
391
- nucliadb-6.9.1.post5167.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
392
- nucliadb-6.9.1.post5167.dist-info/RECORD,,
388
+ nucliadb-6.9.1.post5182.dist-info/METADATA,sha256=HLcffZjg48-oCt4O-5trasvqvnt5OdglO-0dFwqNNks,4158
389
+ nucliadb-6.9.1.post5182.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
390
+ nucliadb-6.9.1.post5182.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
391
+ nucliadb-6.9.1.post5182.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
392
+ nucliadb-6.9.1.post5182.dist-info/RECORD,,