dmart 0.1.10__py3-none-any.whl → 1.4.6__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.
Files changed (135) hide show
  1. alembic/versions/eb5f1ec65156_adding_user_locked_to_device.py +1 -1
  2. api/managed/utils.py +60 -31
  3. api/user/router.py +13 -1
  4. bundler.py +12 -4
  5. cxb/__init__.py +0 -0
  6. cxb/client/__init__.py +0 -0
  7. cxb/client/assets/@codemirror-Rn7_6DkE.js +10 -0
  8. cxb/client/assets/@edraj-CS4NwVbD.js +1 -0
  9. cxb/client/assets/@floating-ui-BwwcF-xh.js +1 -0
  10. cxb/client/assets/@formatjs-yKEsAtjs.js +1 -0
  11. cxb/client/assets/@fortawesome-DRW1UCdr.js +9 -0
  12. cxb/client/assets/@jsonquerylang-laKNoFFq.js +12 -0
  13. cxb/client/assets/@lezer-za4Q-8Ew.js +1 -0
  14. cxb/client/assets/@marijn-DXwl3gUT.js +1 -0
  15. cxb/client/assets/@popperjs-l0sNRNKZ.js +1 -0
  16. cxb/client/assets/@replit--ERk53eB.js +1 -0
  17. cxb/client/assets/@roxi-CGMFK4i8.js +6 -0
  18. cxb/client/assets/@typewriter-cCzskkIv.js +17 -0
  19. cxb/client/assets/@zerodevx-BlBZjKxu.js +1 -0
  20. cxb/client/assets/@zerodevx-CVEpe6WZ.css +1 -0
  21. cxb/client/assets/BreadCrumbLite-DAhOx38v.js +1 -0
  22. cxb/client/assets/EntryRenderer-25YDhRen.js +32 -0
  23. cxb/client/assets/EntryRenderer-DXytdFp9.css +1 -0
  24. cxb/client/assets/ListView-BpAycA2h.js +16 -0
  25. cxb/client/assets/ListView-U8of-_c-.css +1 -0
  26. cxb/client/assets/Prism--hMplq-p.js +3 -0
  27. cxb/client/assets/Prism-Uh6uStUw.css +1 -0
  28. cxb/client/assets/Table2Cols-BsbwicQm.js +1 -0
  29. cxb/client/assets/_..-BvT6vdHa.css +1 -0
  30. cxb/client/assets/_...404_-fuLH_rX9.js +2 -0
  31. cxb/client/assets/_...fallback_-Ba_NLmAE.js +1 -0
  32. cxb/client/assets/_module-Bfk8MiCs.js +3 -0
  33. cxb/client/assets/_module-CEW0D5oI.js +4 -0
  34. cxb/client/assets/_module-Dgq0ZVtz.js +1 -0
  35. cxb/client/assets/ajv-Cpj98o6Y.js +1 -0
  36. cxb/client/assets/axios-CG2WSiiR.js +6 -0
  37. cxb/client/assets/clsx-B-dksMZM.js +1 -0
  38. cxb/client/assets/codemirror-wrapped-line-indent-DPhKvljI.js +1 -0
  39. cxb/client/assets/compare-C3AjiGFR.js +1 -0
  40. cxb/client/assets/compute-scroll-into-view-Bl8rNFhg.js +1 -0
  41. cxb/client/assets/consolite-DlCuI0F9.js +1 -0
  42. cxb/client/assets/crelt-C8TCjufn.js +1 -0
  43. cxb/client/assets/date-fns-l0sNRNKZ.js +1 -0
  44. cxb/client/assets/deepmerge-rn4rBaHU.js +1 -0
  45. cxb/client/assets/dmart_services-AL6-IdDE.js +1 -0
  46. cxb/client/assets/downloadFile-D08i0YDh.js +1 -0
  47. cxb/client/assets/easy-signal-BiPFIK3O.js +1 -0
  48. cxb/client/assets/esm-env-rsSWfq8L.js +1 -0
  49. cxb/client/assets/export-OF_rTiXu.js +1 -0
  50. cxb/client/assets/fast-deep-equal-l0sNRNKZ.js +1 -0
  51. cxb/client/assets/fast-diff-C-IidNf4.js +1 -0
  52. cxb/client/assets/fast-uri-l0sNRNKZ.js +1 -0
  53. cxb/client/assets/flowbite-svelte-BLvjb-sa.js +1 -0
  54. cxb/client/assets/flowbite-svelte-CD54FDqW.css +1 -0
  55. cxb/client/assets/flowbite-svelte-icons-BI8GVhw_.js +1 -0
  56. cxb/client/assets/github-slugger-CQ4oX9Ud.js +1 -0
  57. cxb/client/assets/global-igKv-1g9.js +1 -0
  58. cxb/client/assets/hookar-BMRD9G9H.js +1 -0
  59. cxb/client/assets/immutable-json-patch-DtRO2E_S.js +1 -0
  60. cxb/client/assets/import-1vE3gBat.js +1 -0
  61. cxb/client/assets/index-B-eTh-ZX.js +1 -0
  62. cxb/client/assets/index-BVyxzKtH.js +1 -0
  63. cxb/client/assets/index-BdeNM69f.js +1 -0
  64. cxb/client/assets/index-C6cPO4op.js +1 -0
  65. cxb/client/assets/index-CC-A1ipE.js +1 -0
  66. cxb/client/assets/index-CTxJ-lDp.js +1 -0
  67. cxb/client/assets/index-Cd-F5j_k.js +1 -0
  68. cxb/client/assets/index-D742rwaM.js +1 -0
  69. cxb/client/assets/index-DTfhnhwd.js +1 -0
  70. cxb/client/assets/index-DdXRK7n9.js +2 -0
  71. cxb/client/assets/index-DtiCmB4o.js +1 -0
  72. cxb/client/assets/index-NBrXBlLA.css +2 -0
  73. cxb/client/assets/index-ac-Buu_H.js +4 -0
  74. cxb/client/assets/index-iYkH7C67.js +1 -0
  75. cxb/client/assets/info-B986lRiM.js +1 -0
  76. cxb/client/assets/intl-messageformat-Dc5UU-HB.js +3 -0
  77. cxb/client/assets/jmespath-l0sNRNKZ.js +1 -0
  78. cxb/client/assets/json-schema-traverse-l0sNRNKZ.js +1 -0
  79. cxb/client/assets/json-source-map-DRgZidqy.js +5 -0
  80. cxb/client/assets/jsonpath-plus-l0sNRNKZ.js +1 -0
  81. cxb/client/assets/jsonrepair-B30Dx381.js +8 -0
  82. cxb/client/assets/lodash-es-DZVAA2ox.js +1 -0
  83. cxb/client/assets/marked-DKjyhwJX.js +56 -0
  84. cxb/client/assets/marked-gfm-heading-id-U5zO829x.js +2 -0
  85. cxb/client/assets/marked-mangle-CDMeiHC6.js +1 -0
  86. cxb/client/assets/memoize-one-BdPwpGay.js +1 -0
  87. cxb/client/assets/natural-compare-lite-Bg2Xcf-o.js +7 -0
  88. cxb/client/assets/pagination-svelte-D5CyoiE_.js +13 -0
  89. cxb/client/assets/pagination-svelte-v10nAbbM.css +1 -0
  90. cxb/client/assets/plantuml-encoder-C47mzt9T.js +1 -0
  91. cxb/client/assets/prismjs-DTUiLGJu.js +9 -0
  92. cxb/client/assets/profile-BUf-tKMe.js +1 -0
  93. cxb/client/assets/query-CNmXTsgf.js +1 -0
  94. cxb/client/assets/queryHelpers-C9iBWwqe.js +1 -0
  95. cxb/client/assets/scroll-into-view-if-needed-KR58zyjF.js +1 -0
  96. cxb/client/assets/spaces-0oyGvpii.js +1 -0
  97. cxb/client/assets/style-mod-Bs6eFhZE.js +3 -0
  98. cxb/client/assets/svelte-B2XmcTi_.js +4 -0
  99. cxb/client/assets/svelte-awesome-COLlx0DN.css +1 -0
  100. cxb/client/assets/svelte-awesome-DhnMA6Q_.js +1 -0
  101. cxb/client/assets/svelte-datatables-net-CY7LBj6I.js +1 -0
  102. cxb/client/assets/svelte-floating-ui-BlS3sOAQ.js +1 -0
  103. cxb/client/assets/svelte-i18n-CT2KkQaN.js +3 -0
  104. cxb/client/assets/svelte-jsoneditor-BzfX6Usi.css +1 -0
  105. cxb/client/assets/svelte-jsoneditor-CUGSvWId.js +25 -0
  106. cxb/client/assets/svelte-select-CegQKzqH.css +1 -0
  107. cxb/client/assets/svelte-select-CjHAt_85.js +6 -0
  108. cxb/client/assets/tailwind-merge-CJvxXMcu.js +1 -0
  109. cxb/client/assets/tailwind-variants-Cj20BoQ3.js +1 -0
  110. cxb/client/assets/toast-B9WDyfyI.js +1 -0
  111. cxb/client/assets/tslib-pJfR_DrR.js +1 -0
  112. cxb/client/assets/typewriter-editor-DkTVIJdm.js +25 -0
  113. cxb/client/assets/user-DeK_NB5v.js +1 -0
  114. cxb/client/assets/vanilla-picker-l5rcX3cq.js +8 -0
  115. cxb/client/assets/w3c-keyname-Vcq4gwWv.js +1 -0
  116. cxb/client/config.json +11 -0
  117. cxb/client/config.sample.json +11 -0
  118. cxb/client/favicon.ico +0 -0
  119. cxb/client/favicon.png +0 -0
  120. cxb/client/index.html +28 -0
  121. data_adapters/sql/adapter.py +14 -6
  122. data_adapters/sql/db_to_json_migration.py +7 -4
  123. {dmart-0.1.10.dist-info → dmart-1.4.6.dist-info}/METADATA +2 -3
  124. dmart-1.4.6.dist-info/RECORD +265 -0
  125. {dmart-0.1.10.dist-info → dmart-1.4.6.dist-info}/top_level.txt +1 -0
  126. dmart.py +79 -9
  127. languages/loader.py +0 -1
  128. main.py +56 -2
  129. plugins/system_notification_sender/plugin.py +1 -1
  130. utils/generate_email.py +0 -1
  131. utils/query_policies_helper.py +24 -8
  132. utils/settings.py +5 -4
  133. dmart-0.1.10.dist-info/RECORD +0 -149
  134. {dmart-0.1.10.dist-info → dmart-1.4.6.dist-info}/WHEEL +0 -0
  135. {dmart-0.1.10.dist-info → dmart-1.4.6.dist-info}/entry_points.txt +0 -0
@@ -23,7 +23,7 @@ depends_on: Union[str, Sequence[str], None] = None
23
23
  def upgrade() -> None:
24
24
  # ### commands auto generated by Alembic - please adjust! ###
25
25
  with op.batch_alter_table('users', schema=None) as batch_op:
26
- batch_op.add_column(sa.Column('locked_to_device', sa.Boolean(), nullable=False))
26
+ batch_op.add_column(sa.Column('locked_to_device', sa.Boolean(), nullable=False, server_default='false'))
27
27
 
28
28
  # ### end Alembic commands ###
29
29
 
api/managed/utils.py CHANGED
@@ -3,6 +3,8 @@ from io import BytesIO
3
3
  from typing import Any
4
4
 
5
5
  from fastapi import status
6
+ from models.api import Exception as API_Exception, Error as API_Error
7
+ from utils import password_hashing
6
8
  from utils.generate_email import generate_email_from_template, generate_subject
7
9
  from data_adapters.file.custom_validations import validate_csv_with_schema, validate_jsonl_with_schema
8
10
  from utils.internal_error_code import InternalErrorCode
@@ -469,22 +471,23 @@ async def serve_request_update(request, owner_shortname: str):
469
471
  schema_shortname=record_schema_shortname,
470
472
  )
471
473
 
472
- requested_checksum = record.attributes.get("last_checksum_history")
473
- if requested_checksum:
474
- latest_history = await db.get_latest_history(
475
- space_name=request.space_name,
476
- subpath=record.subpath,
477
- shortname=record.shortname,
478
- )
479
- if latest_history and latest_history.last_checksum_history != requested_checksum:
480
- raise api.Exception(
481
- status.HTTP_409_CONFLICT,
482
- api.Error(
483
- type="request",
484
- code=InternalErrorCode.CONFLICT,
485
- message="Resource has been updated by another request!",
486
- ),
474
+ if settings.is_sha_required:
475
+ requested_checksum = record.attributes.get("last_checksum_history")
476
+ if requested_checksum:
477
+ latest_history = await db.get_latest_history(
478
+ space_name=request.space_name,
479
+ subpath=record.subpath,
480
+ shortname=record.shortname,
487
481
  )
482
+ if latest_history and latest_history.last_checksum_history != requested_checksum:
483
+ raise api.Exception(
484
+ status.HTTP_409_CONFLICT,
485
+ api.Error(
486
+ type="request",
487
+ code=InternalErrorCode.CONFLICT,
488
+ message="Resource has been updated by another request!",
489
+ ),
490
+ )
488
491
 
489
492
  # CHECK PERMISSION
490
493
  if not await access_control.check_access(
@@ -525,6 +528,26 @@ async def serve_request_update(request, owner_shortname: str):
525
528
  else:
526
529
  new_resource_payload_data = None
527
530
  else:
531
+ if 'password' in record.attributes:
532
+ if 'old_password' not in record.attributes:
533
+ raise API_Exception(
534
+ status.HTTP_403_FORBIDDEN,
535
+ API_Error(
536
+ type="auth",
537
+ code=InternalErrorCode.PASSWORD_RESET_ERROR,
538
+ message="missing old_password!",
539
+ ),
540
+ )
541
+ else:
542
+ if not password_hashing.verify_password(record.attributes.get('old_password'), old_resource_obj.password):
543
+ raise API_Exception(
544
+ status.HTTP_403_FORBIDDEN,
545
+ API_Error(
546
+ type="auth",
547
+ code=InternalErrorCode.PASSWORD_RESET_ERROR,
548
+ message="Wrong password have been provided!",
549
+ ),
550
+ )
528
551
  new_resource_payload_data = resource_obj.update_from_record(
529
552
  record=record,
530
553
  old_body=old_resource_payload_body,
@@ -599,7 +622,12 @@ async def serve_request_update(request, owner_shortname: str):
599
622
 
600
623
  if (
601
624
  isinstance(resource_obj, core.User) and
602
- record.attributes.get("is_active", None) is not None
625
+ (
626
+ record.attributes.get("is_active", None) is not None
627
+ or (
628
+ settings.logout_on_pwd_change and record.attributes.get("password", None) is not None
629
+ )
630
+ )
603
631
  ):
604
632
  if not record.attributes.get("is_active"):
605
633
  await db.remove_user_session(record.shortname)
@@ -1534,22 +1562,23 @@ async def serve_space_update(request, record, owner_shortname: str, is_replace:
1534
1562
  user_shortname=owner_shortname,
1535
1563
  )
1536
1564
 
1537
- requested_checksum = record.attributes.get("last_checksum_history")
1538
- if requested_checksum:
1539
- latest_history = await db.get_latest_history(
1540
- space_name=space.shortname,
1541
- subpath=record.subpath,
1542
- shortname=space.shortname,
1543
- )
1544
- if latest_history and latest_history.last_checksum_history != requested_checksum:
1545
- raise api.Exception(
1546
- status.HTTP_409_CONFLICT,
1547
- api.Error(
1548
- type="request",
1549
- code=InternalErrorCode.CONFLICT,
1550
- message="Resource has been updated by another request. Please refresh and try again.",
1551
- ),
1565
+ if settings.is_sha_required:
1566
+ requested_checksum = record.attributes.get("last_checksum_history")
1567
+ if requested_checksum:
1568
+ latest_history = await db.get_latest_history(
1569
+ space_name=space.shortname,
1570
+ subpath=record.subpath,
1571
+ shortname=space.shortname,
1552
1572
  )
1573
+ if latest_history and latest_history.last_checksum_history != requested_checksum:
1574
+ raise api.Exception(
1575
+ status.HTTP_409_CONFLICT,
1576
+ api.Error(
1577
+ type="request",
1578
+ code=InternalErrorCode.CONFLICT,
1579
+ message="Resource has been updated by another request. Please refresh and try again.",
1580
+ ),
1581
+ )
1553
1582
 
1554
1583
  old_flat = flatten_dict(old_space.model_dump())
1555
1584
  new_flat = flatten_dict(space.model_dump())
api/user/router.py CHANGED
@@ -673,7 +673,16 @@ async def update_profile(
673
673
 
674
674
  old_version_flattened = flatten_dict(user.model_dump())
675
675
 
676
- if profile_user.password and "old_password" in profile.attributes:
676
+ if profile_user.password:
677
+ if "old_password" not in profile.attributes:
678
+ raise Exception(
679
+ status.HTTP_403_FORBIDDEN,
680
+ Error(
681
+ type="auth",
682
+ code=InternalErrorCode.PASSWORD_RESET_ERROR,
683
+ message="Wrong password have been provided!",
684
+ ),
685
+ )
677
686
  if not password_hashing.verify_password(
678
687
  profile.attributes["old_password"], user.password or ""
679
688
  ):
@@ -766,6 +775,9 @@ async def update_profile(
766
775
  retrieve_lock_status=profile.retrieve_lock_status,
767
776
  )
768
777
 
778
+ if settings.logout_on_pwd_change and profile_user.password:
779
+ await db.remove_user_session(shortname)
780
+
769
781
  await plugin_manager.after_action(
770
782
  core.Event(
771
783
  space_name=MANAGEMENT_SPACE,
bundler.py CHANGED
@@ -2,7 +2,7 @@
2
2
  import json
3
3
  import subprocess
4
4
  import PyInstaller.__main__
5
-
5
+ import os
6
6
 
7
7
  branch_cmd = "git rev-parse --abbrev-ref HEAD"
8
8
  result, _ = subprocess.Popen(branch_cmd.split(" "), stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
@@ -29,8 +29,7 @@ info = {
29
29
 
30
30
  json.dump(info, open('info.json', 'w'))
31
31
 
32
-
33
- PyInstaller.__main__.run([
32
+ args = [
34
33
  'dmart.py',
35
34
  '--name=dmart',
36
35
  '--onefile',
@@ -41,4 +40,13 @@ PyInstaller.__main__.run([
41
40
  '--collect-submodules=concurrent_log_handler',
42
41
  '--collect-submodules=pythonjsonlogger',
43
42
  '--clean',
44
- ])
43
+ ]
44
+
45
+ cxb_path = 'cxb'
46
+ if not os.path.isdir(cxb_path):
47
+ cxb_path = '../cxb/dist/client'
48
+
49
+ if os.path.isdir(cxb_path):
50
+ args.append(f'--add-data={cxb_path}:cxb')
51
+
52
+ PyInstaller.__main__.run(args)
cxb/__init__.py ADDED
File without changes
cxb/client/__init__.py ADDED
File without changes