nucliadb 6.2.1.post3176__py3-none-any.whl → 6.2.1.post3195__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.
@@ -36,7 +36,8 @@ from nucliadb_models.search import (
36
36
  SyncAskResponse,
37
37
  parse_max_tokens,
38
38
  )
39
- from nucliadb_utils.authentication import requires
39
+ from nucliadb_models.security import RequestSecurity
40
+ from nucliadb_utils.authentication import NucliaUser, requires
40
41
 
41
42
 
42
43
  @api.post(
@@ -62,6 +63,15 @@ async def ask_knowledgebox_endpoint(
62
63
  "This is slower and requires waiting for entire answer to be ready.",
63
64
  ),
64
65
  ) -> Union[StreamingResponse, HTTPClientError, Response]:
66
+ current_user: NucliaUser = request.user
67
+ # If present, security groups from AuthorizationBackend overrides any
68
+ # security group of the payload
69
+ if current_user.security_groups:
70
+ if item.security is None:
71
+ item.security = RequestSecurity(groups=current_user.security_groups)
72
+ else:
73
+ item.security.groups = current_user.security_groups
74
+
65
75
  return await create_ask_response(
66
76
  kbid, item, x_nucliadb_user, x_ndb_client, x_forwarded_for, x_synchronous
67
77
  )
@@ -83,6 +83,10 @@ class Settings(DriverSettings, StorageSettings, ExtendedStorageSettings):
83
83
  default="X-NUCLIADB-ROLES",
84
84
  description="Only used for `upstream_naive` auth policy.",
85
85
  )
86
+ auth_policy_security_groups_header: str = pydantic.Field(
87
+ default="X-NUCLIADB-SECURITY_GROUPS",
88
+ description="Only used for `upstream_naive` auth policy.",
89
+ )
86
90
  auth_policy_user_default_roles: list[NucliaDBRoles] = pydantic.Field(
87
91
  default=[NucliaDBRoles.READER, NucliaDBRoles.WRITER, NucliaDBRoles.MANAGER],
88
92
  description="Default role to assign to user that is authenticated \
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb
3
- Version: 6.2.1.post3176
3
+ Version: 6.2.1.post3195
4
4
  Home-page: https://docs.nuclia.dev/docs/management/nucliadb/intro
5
5
  Author: NucliaDB Community
6
6
  Author-email: nucliadb@nuclia.com
@@ -22,10 +22,10 @@ Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Programming Language :: Python :: 3 :: Only
23
23
  Requires-Python: >=3.9, <4
24
24
  Description-Content-Type: text/markdown
25
- Requires-Dist: nucliadb-telemetry[all]>=6.2.1.post3176
26
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.post3176
27
- Requires-Dist: nucliadb-protos>=6.2.1.post3176
28
- Requires-Dist: nucliadb-models>=6.2.1.post3176
25
+ Requires-Dist: nucliadb-telemetry[all]>=6.2.1.post3195
26
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.post3195
27
+ Requires-Dist: nucliadb-protos>=6.2.1.post3195
28
+ Requires-Dist: nucliadb-models>=6.2.1.post3195
29
29
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
30
30
  Requires-Dist: nuclia-models>=0.24.2
31
31
  Requires-Dist: uvicorn
@@ -188,7 +188,7 @@ nucliadb/search/settings.py,sha256=vem3EcyYlTPSim0kEK-xe-erF4BZg0CT_LAb8ZRQAE8,1
188
188
  nucliadb/search/utilities.py,sha256=9SsRDw0rJVXVoLBfF7rBb6q080h-thZc7u8uRcTiBeY,1037
189
189
  nucliadb/search/api/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
190
190
  nucliadb/search/api/v1/__init__.py,sha256=NSbOVF6toiHX9WMpGgqpFrjJKT50EcHzOILp-2iHk5I,1249
191
- nucliadb/search/api/v1/ask.py,sha256=Od2U_gaOZK6dJZ1eDGQQJ3xUVnbBih58VPYVAsQErOw,3902
191
+ nucliadb/search/api/v1/ask.py,sha256=F2dR3-swb3Xz8MfZPYL3G65KY2R_mgef4YVBbu8kLi4,4352
192
192
  nucliadb/search/api/v1/catalog.py,sha256=ubYPS1wmPHzOgH9LR0qJmmV-9ELZPtHRSs5TYJ1pA9A,7117
193
193
  nucliadb/search/api/v1/feedback.py,sha256=kNLc4dHz2SXHzV0PwC1WiRAwY88fDptPcP-kO0q-FrQ,2620
194
194
  nucliadb/search/api/v1/find.py,sha256=DsnWkySu_cFajDWJIxN8DYvLL_Rm2yiCjHD8TsqPfRk,9304
@@ -247,7 +247,7 @@ nucliadb/standalone/migrations.py,sha256=s9-3RSZ-O3bjEw2TnBe_YWLUEKbub0bARUxi1gA
247
247
  nucliadb/standalone/purge.py,sha256=ZY-cebb214FFiPG7OFmXZGg0G3CK5Amw0FLLm9WJhKE,1343
248
248
  nucliadb/standalone/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
249
249
  nucliadb/standalone/run.py,sha256=d4lmi9ePObbHeDqwcoZnp5JIkBp9iIPSw9uOwxeQMOU,5623
250
- nucliadb/standalone/settings.py,sha256=nF0c4-QLBSDtw1r2CZKXe91jObLX7f2jVVdIXDF7SUs,5860
250
+ nucliadb/standalone/settings.py,sha256=nPJ8R8yNUQD4G92zXBi5KiD6QWhXZdtLoQQUTXfuaHE,6041
251
251
  nucliadb/standalone/versions.py,sha256=8CxNMNt2NgWM8ct50UsR4d44-ae7wtQI-sV-yGiFqyI,3508
252
252
  nucliadb/standalone/static/favicon.ico,sha256=96pKGp6Sx457JkTfjy1dtApMhkitixfU6invCUGAYOU,2285
253
253
  nucliadb/standalone/static/index.html,sha256=PEZfuEQFYnYACAL1ceN8xC0im8lBrUx838RkE8tbvgA,3833
@@ -332,9 +332,9 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
332
332
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
333
333
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
334
334
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
335
- nucliadb-6.2.1.post3176.dist-info/METADATA,sha256=XQOa1mhfC7OVx3mKUPGENRAT46HQDx5D2ND5TnE59vU,4603
336
- nucliadb-6.2.1.post3176.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
337
- nucliadb-6.2.1.post3176.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
338
- nucliadb-6.2.1.post3176.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
339
- nucliadb-6.2.1.post3176.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
340
- nucliadb-6.2.1.post3176.dist-info/RECORD,,
335
+ nucliadb-6.2.1.post3195.dist-info/METADATA,sha256=u16cJNcMWXsmH82kboXKVo3oDecmnKjtiTcW7G533eE,4603
336
+ nucliadb-6.2.1.post3195.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
337
+ nucliadb-6.2.1.post3195.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
338
+ nucliadb-6.2.1.post3195.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
339
+ nucliadb-6.2.1.post3195.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
340
+ nucliadb-6.2.1.post3195.dist-info/RECORD,,