cornflow 1.2.3a2__tar.gz → 1.2.3a3__tar.gz

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 (183) hide show
  1. {cornflow-1.2.3a2/cornflow.egg-info → cornflow-1.2.3a3}/PKG-INFO +1 -1
  2. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/permissions.py +6 -4
  3. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/const.py +1 -1
  4. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_commands.py +79 -33
  5. {cornflow-1.2.3a2 → cornflow-1.2.3a3/cornflow.egg-info}/PKG-INFO +1 -1
  6. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/setup.py +1 -1
  7. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/MANIFEST.in +0 -0
  8. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/README.rst +0 -0
  9. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/airflow_config/__init__.py +0 -0
  10. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/airflow_config/airflow_local_settings.py +0 -0
  11. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/airflow_config/plugins/XCom/__init__.py +0 -0
  12. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/airflow_config/plugins/XCom/gce_xcom_backend.py +0 -0
  13. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/airflow_config/plugins/__init__.py +0 -0
  14. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/airflow_config/webserver_ldap.py +0 -0
  15. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/__init__.py +0 -0
  16. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/app.py +0 -0
  17. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/__init__.py +0 -0
  18. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/actions.py +0 -0
  19. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/arguments.py +0 -0
  20. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/config.py +0 -0
  21. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/migrations.py +0 -0
  22. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/permissions.py +0 -0
  23. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/roles.py +0 -0
  24. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/schemas.py +0 -0
  25. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/service.py +0 -0
  26. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/tools/__init__.py +0 -0
  27. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/tools/api_generator.py +0 -0
  28. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/tools/endpoint_tools.py +0 -0
  29. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/tools/models_tools.py +0 -0
  30. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/tools/schema_generator.py +0 -0
  31. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/tools/schemas_tools.py +0 -0
  32. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/tools/tools.py +0 -0
  33. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/users.py +0 -0
  34. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/utils.py +0 -0
  35. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/cli/views.py +0 -0
  36. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/__init__.py +0 -0
  37. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/access.py +0 -0
  38. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/actions.py +0 -0
  39. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/cleanup.py +0 -0
  40. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/dag.py +0 -0
  41. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/roles.py +0 -0
  42. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/schemas.py +0 -0
  43. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/users.py +0 -0
  44. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/commands/views.py +0 -0
  45. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/config.py +0 -0
  46. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/__init__.py +0 -0
  47. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/action.py +0 -0
  48. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/alarms.py +0 -0
  49. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/apiview.py +0 -0
  50. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/case.py +0 -0
  51. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/dag.py +0 -0
  52. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/data_check.py +0 -0
  53. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/example_data.py +0 -0
  54. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/execution.py +0 -0
  55. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/health.py +0 -0
  56. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/instance.py +0 -0
  57. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/licenses.py +0 -0
  58. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/login.py +0 -0
  59. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/main_alarms.py +0 -0
  60. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/meta_resource.py +0 -0
  61. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/permission.py +0 -0
  62. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/roles.py +0 -0
  63. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/schemas.py +0 -0
  64. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/signup.py +0 -0
  65. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/tables.py +0 -0
  66. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/token.py +0 -0
  67. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/user.py +0 -0
  68. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/endpoints/user_role.py +0 -0
  69. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/gunicorn.py +0 -0
  70. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/README +0 -0
  71. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/alembic.ini +0 -0
  72. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/env.py +0 -0
  73. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/script.py.mako +0 -0
  74. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/00757b557b02_.py +0 -0
  75. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/1af47a419bbd_.py +0 -0
  76. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/4aac5e0c6e66_.py +0 -0
  77. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/7c3ea5ab5501_.py +0 -0
  78. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/991b98e24225_.py +0 -0
  79. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/a472b5ad50b7_.py +0 -0
  80. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/c2db9409cb5f_.py +0 -0
  81. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/c8a6c762e818_.py +0 -0
  82. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/ca449af8034c_.py +0 -0
  83. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/d0e0700dcd8e_.py +0 -0
  84. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/d1b5be1f0549_.py +0 -0
  85. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/e1a50dae1ac9_.py +0 -0
  86. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/e937a5234ce4_.py +0 -0
  87. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/ebdd955fcc5e_.py +0 -0
  88. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/migrations/versions/f3bee20314a2_.py +0 -0
  89. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/__init__.py +0 -0
  90. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/action.py +0 -0
  91. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/alarms.py +0 -0
  92. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/base_data_model.py +0 -0
  93. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/case.py +0 -0
  94. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/dag.py +0 -0
  95. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/dag_permissions.py +0 -0
  96. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/execution.py +0 -0
  97. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/instance.py +0 -0
  98. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/main_alarms.py +0 -0
  99. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/meta_models.py +0 -0
  100. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/permissions.py +0 -0
  101. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/role.py +0 -0
  102. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/user.py +0 -0
  103. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/user_role.py +0 -0
  104. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/models/view.py +0 -0
  105. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/__init__.py +0 -0
  106. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/action.py +0 -0
  107. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/alarms.py +0 -0
  108. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/case.py +0 -0
  109. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/common.py +0 -0
  110. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/dag.py +0 -0
  111. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/example_data.py +0 -0
  112. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/execution.py +0 -0
  113. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/health.py +0 -0
  114. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/instance.py +0 -0
  115. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/main_alarms.py +0 -0
  116. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/model_json.py +0 -0
  117. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/patch.py +0 -0
  118. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/permissions.py +0 -0
  119. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/query.py +0 -0
  120. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/role.py +0 -0
  121. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/schemas.py +0 -0
  122. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/solution_log.py +0 -0
  123. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/tables.py +0 -0
  124. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/user.py +0 -0
  125. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/user_role.py +0 -0
  126. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/schemas/view.py +0 -0
  127. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/__init__.py +0 -0
  128. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/authentication/__init__.py +0 -0
  129. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/authentication/auth.py +0 -0
  130. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/authentication/decorators.py +0 -0
  131. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/authentication/ldap.py +0 -0
  132. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/compress.py +0 -0
  133. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/email.py +0 -0
  134. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/exceptions.py +0 -0
  135. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/licenses.py +0 -0
  136. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/log_config.py +0 -0
  137. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/query_tools.py +0 -0
  138. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/utils.py +0 -0
  139. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/utils_tables.py +0 -0
  140. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/shared/validators.py +0 -0
  141. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/__init__.py +0 -0
  142. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/const.py +0 -0
  143. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/custom_liveServer.py +0 -0
  144. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/custom_test_case.py +0 -0
  145. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/integration/__init__.py +0 -0
  146. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/integration/test_commands.py +0 -0
  147. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/integration/test_cornflowclient.py +0 -0
  148. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/ldap/__init__.py +0 -0
  149. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/ldap/test_ldap_authentication.py +0 -0
  150. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/__init__.py +0 -0
  151. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_actions.py +0 -0
  152. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_alarms.py +0 -0
  153. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_apiview.py +0 -0
  154. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_application.py +0 -0
  155. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_cases.py +0 -0
  156. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_cli.py +0 -0
  157. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_dags.py +0 -0
  158. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_data_checks.py +0 -0
  159. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_example_data.py +0 -0
  160. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_executions.py +0 -0
  161. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_generate_from_schema.py +0 -0
  162. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_health.py +0 -0
  163. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_instances.py +0 -0
  164. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_instances_file.py +0 -0
  165. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_licenses.py +0 -0
  166. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_log_in.py +0 -0
  167. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_main_alarms.py +0 -0
  168. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_permissions.py +0 -0
  169. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_roles.py +0 -0
  170. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_schema_from_models.py +0 -0
  171. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_schemas.py +0 -0
  172. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_sign_up.py +0 -0
  173. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_tables.py +0 -0
  174. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_token.py +0 -0
  175. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/test_users.py +0 -0
  176. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow/tests/unit/tools.py +0 -0
  177. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow.egg-info/SOURCES.txt +0 -0
  178. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow.egg-info/dependency_links.txt +0 -0
  179. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow.egg-info/entry_points.txt +0 -0
  180. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow.egg-info/requires.txt +0 -0
  181. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/cornflow.egg-info/top_level.txt +0 -0
  182. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/requirements.txt +0 -0
  183. {cornflow-1.2.3a2 → cornflow-1.2.3a3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cornflow
3
- Version: 1.2.3a2
3
+ Version: 1.2.3a3
4
4
  Summary: cornflow is an open source multi-solver optimization server with a REST API built using flask.
5
5
  Home-page: https://github.com/baobabsoluciones/cornflow
6
6
  Author: baobab soluciones
@@ -38,13 +38,15 @@ def register_base_permissions_command(external_app: str = None, verbose: bool =
38
38
  (perm.role_id, perm.action_id, perm.api_view_id) for perm in permissions_in_db
39
39
  ]
40
40
  resources_names = [resource["endpoint"] for resource in resources_to_register]
41
- roles_in_db = [role.name for role in RoleModel.get_all_objects()]
41
+ roles_in_db = [role.id for role in RoleModel.get_all_objects()]
42
42
  # Check which roles are not in ROLES_MAP
43
- roles_not_in_map = [role for role in roles_in_db if role not in ROLES_MAP.keys()]
43
+ roles_not_in_map = [
44
+ role_id for role_id in roles_in_db if role_id not in ROLES_MAP.keys()
45
+ ]
44
46
  complete_base_assignation = BASE_PERMISSION_ASSIGNATION.copy()
45
47
  if len(roles_not_in_map) > 0:
46
48
  # We add to the complete_base_assignation the roles that are not in ROLES_MAP
47
- for role in roles_not_in_map:
49
+ for role_id in roles_not_in_map:
48
50
  for action in [
49
51
  GET_ACTION,
50
52
  PATCH_ACTION,
@@ -52,7 +54,7 @@ def register_base_permissions_command(external_app: str = None, verbose: bool =
52
54
  PUT_ACTION,
53
55
  DELETE_ACTION,
54
56
  ]:
55
- complete_base_assignation.append((role, action))
57
+ complete_base_assignation.append((role_id, action))
56
58
 
57
59
  # Create base permissions
58
60
  permissions_in_app = [
@@ -1,7 +1,7 @@
1
1
  """
2
2
  In this file we import the values for different constants on cornflow server
3
3
  """
4
- CORNFLOW_VERSION = "1.2.3a2"
4
+ CORNFLOW_VERSION = "1.2.3a3"
5
5
  INTERNAL_TOKEN_ISSUER = "cornflow"
6
6
 
7
7
  # endpoints responses for health check
@@ -587,12 +587,13 @@ class TestCommands(TestCase):
587
587
 
588
588
  def test_custom_role_permissions_are_preserved(self):
589
589
  """
590
- Test that permissions for custom roles (not in ROLES_MAP) are preserved
591
- during permission synchronization.
590
+ Test that custom roles (not in ROLES_MAP) are automatically detected
591
+ and assigned complete permissions during synchronization.
592
592
 
593
- This test verifies that when permissions are synchronized, only permissions
594
- for roles defined in ROLES_MAP are subject to deletion, while custom roles
595
- added manually to the database are preserved.
593
+ This test verifies that when permissions are synchronized:
594
+ 1. Custom roles in the database are automatically detected
595
+ 2. They are assigned all actions (GET, PATCH, POST, PUT, DELETE)
596
+ 3. These permissions are created for all endpoints where the role has access
596
597
  """
597
598
  # First, initialize the access system normally
598
599
  self.runner.invoke(access_init)
@@ -608,36 +609,81 @@ class TestCommands(TestCase):
608
609
  custom_role = RoleModel({"id": custom_role_id, "name": "custom_role"})
609
610
  custom_role.save()
610
611
 
611
- # Create a permission for this custom role
612
- from cornflow.shared.const import GET_ACTION
612
+ # Temporarily add the custom role to ExampleDataListEndpoint ROLES_WITH_ACCESS
613
+ from cornflow.endpoints.example_data import ExampleDataListEndpoint
613
614
 
614
- custom_permission = PermissionViewRoleModel(
615
- {"role_id": custom_role_id, "action_id": GET_ACTION, "api_view_id": view.id}
616
- )
617
- custom_permission.save()
615
+ original_roles = ExampleDataListEndpoint.ROLES_WITH_ACCESS.copy()
616
+ ExampleDataListEndpoint.ROLES_WITH_ACCESS = original_roles + [custom_role_id]
618
617
 
619
- # Verify the custom permission exists
620
- custom_perms_before = PermissionViewRoleModel.query.filter_by(
621
- role_id=custom_role_id, action_id=GET_ACTION, api_view_id=view.id
622
- ).all()
623
- self.assertEqual(
624
- 1, len(custom_perms_before), "Custom permission should exist before sync"
625
- )
618
+ try:
619
+ # Count permissions before synchronization
620
+ perms_before = PermissionViewRoleModel.query.filter_by(
621
+ role_id=custom_role_id, api_view_id=view.id
622
+ ).count()
623
+ self.assertEqual(
624
+ 0, perms_before, "No custom permissions should exist initially"
625
+ )
626
626
 
627
- # Run permission synchronization (this would previously delete custom role permissions)
628
- self.runner.invoke(register_base_assignations, ["-v"])
627
+ # Run permission synchronization - this should auto-detect the custom role
628
+ self.runner.invoke(register_base_assignations, ["-v"])
629
629
 
630
- # Verify the custom permission still exists after synchronization
631
- custom_perms_after = PermissionViewRoleModel.query.filter_by(
632
- role_id=custom_role_id, action_id=GET_ACTION, api_view_id=view.id
633
- ).all()
634
- self.assertEqual(
635
- 1,
636
- len(custom_perms_after),
637
- "Custom role permission should be preserved after synchronization. "
638
- "Permissions should only be deleted for roles defined in ROLES_MAP.",
639
- )
630
+ # Verify that ALL actions have been assigned to the custom role
631
+ from cornflow.shared.const import (
632
+ GET_ACTION,
633
+ PATCH_ACTION,
634
+ POST_ACTION,
635
+ PUT_ACTION,
636
+ DELETE_ACTION,
637
+ )
640
638
 
641
- # Clean up
642
- custom_permission.delete()
643
- custom_role.delete()
639
+ expected_actions = [
640
+ GET_ACTION,
641
+ PATCH_ACTION,
642
+ POST_ACTION,
643
+ PUT_ACTION,
644
+ DELETE_ACTION,
645
+ ]
646
+
647
+ for action in expected_actions:
648
+ permission = PermissionViewRoleModel.query.filter_by(
649
+ role_id=custom_role_id, action_id=action, api_view_id=view.id
650
+ ).first()
651
+ self.assertIsNotNone(
652
+ permission,
653
+ f"Custom role should have permission for action {action}. "
654
+ f"The system should auto-detect custom roles and assign complete permissions.",
655
+ )
656
+
657
+ # Verify total count of permissions for custom role
658
+ total_perms = PermissionViewRoleModel.query.filter_by(
659
+ role_id=custom_role_id, api_view_id=view.id
660
+ ).count()
661
+ self.assertEqual(
662
+ len(expected_actions),
663
+ total_perms,
664
+ f"Custom role should have {len(expected_actions)} permissions (all actions)",
665
+ )
666
+
667
+ # Test that running sync again doesn't duplicate permissions
668
+ self.runner.invoke(register_base_assignations, ["-v"])
669
+
670
+ total_perms_after_second_sync = PermissionViewRoleModel.query.filter_by(
671
+ role_id=custom_role_id, api_view_id=view.id
672
+ ).count()
673
+ self.assertEqual(
674
+ len(expected_actions),
675
+ total_perms_after_second_sync,
676
+ "Permissions should not be duplicated on subsequent syncs",
677
+ )
678
+
679
+ finally:
680
+ # Clean up
681
+ # Delete permissions first (due to foreign key constraints)
682
+ permissions_to_delete = PermissionViewRoleModel.query.filter_by(
683
+ role_id=custom_role_id
684
+ ).all()
685
+ for perm in permissions_to_delete:
686
+ perm.delete()
687
+ custom_role.delete()
688
+ # Restore original ROLES_WITH_ACCESS
689
+ ExampleDataListEndpoint.ROLES_WITH_ACCESS = original_roles
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cornflow
3
- Version: 1.2.3a2
3
+ Version: 1.2.3a3
4
4
  Summary: cornflow is an open source multi-solver optimization server with a REST API built using flask.
5
5
  Home-page: https://github.com/baobabsoluciones/cornflow
6
6
  Author: baobab soluciones
@@ -9,7 +9,7 @@ with open("requirements.txt", "r") as fh:
9
9
 
10
10
  setuptools.setup(
11
11
  name="cornflow",
12
- version="1.2.3a2",
12
+ version="1.2.3a3",
13
13
  author="baobab soluciones",
14
14
  author_email="cornflow@baobabsoluciones.es",
15
15
  description="cornflow is an open source multi-solver optimization server with a REST API built using flask.",
File without changes
File without changes
File without changes
File without changes
File without changes