jaaql-middleware-python 4.22.4__tar.gz → 4.22.5__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 (75) hide show
  1. {jaaql-middleware-python-4.22.4/jaaql_middleware_python.egg-info → jaaql-middleware-python-4.22.5}/PKG-INFO +1 -1
  2. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/constants.py +9 -1
  3. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/documentation/documentation_internal.py +58 -0
  4. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/exceptions/jaaql_interpretable_handled_errors.py +14 -0
  5. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/controller.py +7 -4
  6. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/exception_queries.py +1 -1
  7. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/generated_queries.py +1 -1
  8. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/model.py +38 -4
  9. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5/jaaql_middleware_python.egg-info}/PKG-INFO +1 -1
  10. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/LICENSE.txt +0 -0
  11. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/README.md +0 -0
  12. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/__init__.py +0 -0
  13. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/config/__init__.py +0 -0
  14. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/config/config-docker.ini +0 -0
  15. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/config/config-test.ini +0 -0
  16. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/config/config.ini +0 -0
  17. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/config_constants.py +0 -0
  18. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/db/__init__.py +0 -0
  19. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/db/db_interface.py +0 -0
  20. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/db/db_pg_interface.py +0 -0
  21. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/db/db_utils.py +0 -0
  22. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/db/db_utils_no_circ.py +0 -0
  23. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/documentation/__init__.py +0 -0
  24. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/documentation/documentation_public.py +0 -0
  25. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/documentation/documentation_shared.py +0 -0
  26. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/email/__init__.py +0 -0
  27. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/email/email_manager.py +0 -0
  28. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/email/email_manager_service.py +0 -0
  29. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/email/patch_ems.py +0 -0
  30. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/exceptions/__init__.py +0 -0
  31. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/exceptions/custom_http_status.py +0 -0
  32. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/exceptions/http_status_exception.py +0 -0
  33. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/exceptions/not_yet_implement_exception.py +0 -0
  34. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/generated_constants.py +0 -0
  35. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/interpreter/__init__.py +0 -0
  36. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/interpreter/interpret_jaaql.py +0 -0
  37. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/jaaql.py +0 -0
  38. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/migrations/__init__.py +0 -0
  39. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/migrations/migration_history.sql +0 -0
  40. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/migrations/migrations.py +0 -0
  41. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/__init__.py +0 -0
  42. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/base_controller.py +0 -0
  43. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/base_model.py +0 -0
  44. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/controller_interface.py +0 -0
  45. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/handmade_queries.py +0 -0
  46. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/model_interface.py +0 -0
  47. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/mvc/response.py +0 -0
  48. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/openapi/__init__.py +0 -0
  49. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/openapi/swagger_documentation.py +0 -0
  50. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/patch.py +0 -0
  51. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/scripts/01.install_domains.generated.sql +0 -0
  52. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/scripts/02.install_super_user.exceptions.sql +0 -0
  53. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/scripts/03.install_super_user.handwritten.sql +0 -0
  54. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/scripts/04.install_jaaql_data_structures.generated.sql +0 -0
  55. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/scripts/05.install_jaaql.exceptions.sql +0 -0
  56. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/scripts/06.install_jaaql.handwritten.sql +0 -0
  57. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/scripts/swagger_template.html +0 -0
  58. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/services/__init__.py +0 -0
  59. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/services/cached_canned_query_service.py +0 -0
  60. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/services/migrations_manager_service.py +0 -0
  61. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/services/patch_mms.py +0 -0
  62. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/services/patch_shared_var_service.py +0 -0
  63. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/services/shared_var_service.py +0 -0
  64. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/utilities/__init__.py +0 -0
  65. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/utilities/crypt_utils.py +0 -0
  66. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/utilities/options.py +0 -0
  67. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/utilities/utils.py +0 -0
  68. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/utilities/utils_no_project_imports.py +0 -0
  69. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql/utilities/vault.py +0 -0
  70. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql_middleware_python.egg-info/SOURCES.txt +0 -0
  71. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql_middleware_python.egg-info/dependency_links.txt +0 -0
  72. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql_middleware_python.egg-info/requires.txt +0 -0
  73. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/jaaql_middleware_python.egg-info/top_level.txt +0 -0
  74. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/setup.cfg +0 -0
  75. {jaaql-middleware-python-4.22.4 → jaaql-middleware-python-4.22.5}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaaql-middleware-python
3
- Version: 4.22.4
3
+ Version: 4.22.5
4
4
  Summary: The jaaql package, allowing for rapid development and deployment of RESTful HTTP applications
5
5
  Home-page: https://github.com/JAAQL/JAAQL-middleware-python
6
6
  Author: Software Quality Measurement and Improvement bv
@@ -43,6 +43,14 @@ KEY__oauth_token = "oauth_token"
43
43
  KEY__accounts = "accounts"
44
44
  KEY__registered = "registered"
45
45
  KEY__restrictions = "restrictions"
46
+ KEY__command = "command"
47
+
48
+ CRON_minute = "minute"
49
+ CRON_hour = "hour"
50
+ CRON_dayOfMonth = "dayOfMonth"
51
+ CRON_month = "month"
52
+ CRON_dayOfWeek = "dayOfWeek"
53
+ CRON_year = "year"
46
54
 
47
55
  REGEX__dmbs_object_name = r'^[0-9a-zA-Z_]{1,32}$'
48
56
 
@@ -170,5 +178,5 @@ ROLE__postgres = "postgres"
170
178
 
171
179
  PROTOCOL__postgres = "postgresql://"
172
180
 
173
- VERSION = "4.22.4"
181
+ VERSION = "4.22.5"
174
182
 
@@ -215,3 +215,61 @@ DOCUMENTATION__set_web_config = SwaggerDocumentation(
215
215
  method=REST__POST
216
216
  )
217
217
  )
218
+
219
+ DOCUMENTATION__cron = SwaggerDocumentation(
220
+ tags="Cron",
221
+ methods=SwaggerMethod(
222
+ name="Set cron jobs for application",
223
+ description="Will add a cron jobs pertaining to an application",
224
+ method=REST__POST,
225
+ body=[
226
+ SwaggerArgumentResponse(
227
+ name=KEY__application,
228
+ description="The application of the cron job",
229
+ arg_type=str,
230
+ example=["out-and-about"]
231
+ ),
232
+ SwaggerArgumentResponse(
233
+ name=KEY__command,
234
+ description="The command to execute as root",
235
+ arg_type=str,
236
+ example=["node /path/to/my/script.js"]
237
+ ),
238
+ SwaggerArgumentResponse(
239
+ name=CRON_minute,
240
+ description="The minute of cron expression",
241
+ arg_type=ARG_RESP__allow_all,
242
+ required=False,
243
+ condition="Is supplied"
244
+ ),
245
+ SwaggerArgumentResponse(
246
+ name=CRON_hour,
247
+ description="The hour of cron expression",
248
+ arg_type=ARG_RESP__allow_all,
249
+ required=False,
250
+ condition="Is supplied"
251
+ ),
252
+ SwaggerArgumentResponse(
253
+ name=CRON_dayOfMonth,
254
+ description="The day of month of cron expression",
255
+ arg_type=ARG_RESP__allow_all,
256
+ required=False,
257
+ condition="Is supplied"
258
+ ),
259
+ SwaggerArgumentResponse(
260
+ name=CRON_month,
261
+ description="The month of cron expression",
262
+ arg_type=ARG_RESP__allow_all,
263
+ required=False,
264
+ condition="Is supplied"
265
+ ),
266
+ SwaggerArgumentResponse(
267
+ name=CRON_dayOfWeek,
268
+ description="The day of week of cron expression",
269
+ arg_type=ARG_RESP__allow_all,
270
+ required=False,
271
+ condition="Is supplied"
272
+ )
273
+ ]
274
+ )
275
+ )
@@ -307,3 +307,17 @@ class IncorrectPasswordVerification(JaaqlInterpretableHandledError):
307
307
  index=None,
308
308
  descriptor=descriptor
309
309
  )
310
+
311
+
312
+ class UnhandledRemoteProcedureError(JaaqlInterpretableHandledError):
313
+ def __init__(self, message, descriptor=None):
314
+ super().__init__(
315
+ error_code=1023,
316
+ http_response_code=500,
317
+ table_name=None,
318
+ message=message,
319
+ column_name=None,
320
+ _set=None,
321
+ index=None,
322
+ descriptor=descriptor
323
+ )
@@ -65,10 +65,9 @@ class JAAQLController(BaseJAAQLController):
65
65
 
66
66
  @self.publish_route('/accounts', DOCUMENTATION__create_account)
67
67
  def accounts(connection: DBInterface, http_inputs: dict):
68
- registered = http_inputs[KEY__registered]
69
- if registered is None:
70
- registered = True
71
- http_inputs.pop(KEY__registered)
68
+ registered = http_inputs.get(KEY__registered, True)
69
+ if KEY__registered in http_inputs:
70
+ http_inputs.pop(KEY__registered)
72
71
  self.model.create_account_with_potential_password(connection, **http_inputs, registered=registered)
73
72
 
74
73
  @self.publish_route('/accounts/batch', DOCUMENTATION__create_account_batch)
@@ -122,6 +121,10 @@ class JAAQLController(BaseJAAQLController):
122
121
  else:
123
122
  return self.model.finish_security_event(http_inputs)
124
123
 
124
+ @self.publish_route('/cron', DOCUMENTATION__cron)
125
+ def cron(connection: DBInterface, http_inputs: dict):
126
+ self.model.add_cron_job_to_application(connection, http_inputs)
127
+
125
128
  @self.publish_route('/internal/set-web-config', DOCUMENTATION__set_web_config)
126
129
  def set_web_config(connection: DBInterface):
127
130
  self.model.set_web_config(connection)
@@ -1,5 +1,5 @@
1
1
  """
2
- This script was generated from jaaql.exceptions.fxli at 2024-03-22, 22:17:50
2
+ This script was generated from jaaql.exceptions.fxli at 2024-03-29, 04:52:17
3
3
  """
4
4
 
5
5
  from jaaql.utilities.crypt_utils import get_repeatable_salt
@@ -1,5 +1,5 @@
1
1
  """
2
- This script was generated from jaaql.fxli at 2024-03-22, 22:17:50
2
+ This script was generated from jaaql.fxli at 2024-03-29, 04:52:17
3
3
  """
4
4
 
5
5
  from jaaql.db.db_interface import DBInterface
@@ -1,3 +1,4 @@
1
+ import sys
1
2
  import uuid
2
3
 
3
4
  import re
@@ -127,12 +128,9 @@ class JAAQLModel(BaseJAAQLModel):
127
128
 
128
129
  def create_account_batch_with_potential_password(self, connection: DBInterface, accounts: list):
129
130
  for cur_input in accounts:
130
- registered = cur_input[KEY__registered]
131
- if registered is None:
132
- registered = True
133
131
  self.create_account_with_potential_password(
134
132
  connection, cur_input[KEY__username], cur_input[KEY__attach_as],
135
- cur_input[KEY__password], allow_already_exists=True, registered=registered
133
+ cur_input[KEY__password], allow_already_exists=True, registered=cur_input.get(KEY__registered, True)
136
134
  )
137
135
 
138
136
  def validate_query(self, queries: list, query, allow_list=True):
@@ -394,6 +392,7 @@ WHERE
394
392
  if not self.vault.get_obj(VAULT_KEY__allow_jaaql_uninstall):
395
393
  raise HttpStatusException("JAAQL not permitted to uninstall itself")
396
394
  DBPGInterface.close_all_pools()
395
+ subprocess.run("crontab -l | grep -v '# jaaql__' | crontab -", check=True, shell=True)
397
396
  subprocess.call("./pg_reboot.sh", cwd="/")
398
397
  else:
399
398
  subprocess.call("docker kill jaaql_pg")
@@ -1143,6 +1142,41 @@ WHERE
1143
1142
 
1144
1143
  raise err
1145
1144
 
1145
+ @staticmethod
1146
+ def cron_expression_to_string(cron: dict) -> str:
1147
+ """
1148
+ Converts a CronExpression object into a cron expression string.
1149
+ """
1150
+
1151
+ def format_field(field):
1152
+ if isinstance(field, list):
1153
+ return ','.join(map(str, field))
1154
+ elif field is None:
1155
+ return '*'
1156
+ return str(field)
1157
+
1158
+ parts = [
1159
+ format_field(cron.get(CRON_minute)),
1160
+ format_field(cron.get(CRON_hour)),
1161
+ format_field(cron.get(CRON_dayOfMonth)),
1162
+ format_field(cron.get(CRON_month)),
1163
+ format_field(cron.get(CRON_dayOfWeek)),
1164
+ format_field(cron.get(CRON_year))
1165
+ ]
1166
+ return ' '.join(parts)
1167
+
1168
+ def add_cron_job_to_application(self, connection: DBInterface, cron_input: dict):
1169
+ self.is_super_admin(connection)
1170
+ if self.is_container:
1171
+ application = cron_input.pop(KEY__application)
1172
+ application__select(connection, application)
1173
+ command = cron_input.pop(KEY__command)
1174
+ cron_string = self.cron_expression_to_string(cron_input)
1175
+ cron_command = '(crontab - l 2 > /dev/null; echo "' + cron_string + ' ' + command + ' # jaaql__' + application + '") | crontab -'
1176
+ subprocess.run(cron_command, check=True, shell=True)
1177
+ else:
1178
+ print("Cron not supported in debugging mode", file=sys.stderr)
1179
+
1146
1180
  def submit(self, inputs: dict, account_id: str, verification_hook: Queue = None, as_objects: bool = False, singleton: bool = False):
1147
1181
  return submit(self.vault, self.config, self.get_db_crypt_key(), self.jaaql_lookup_connection, inputs, account_id, verification_hook,
1148
1182
  self.cached_canned_query_service, as_objects=as_objects, singleton=singleton)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaaql-middleware-python
3
- Version: 4.22.4
3
+ Version: 4.22.5
4
4
  Summary: The jaaql package, allowing for rapid development and deployment of RESTful HTTP applications
5
5
  Home-page: https://github.com/JAAQL/JAAQL-middleware-python
6
6
  Author: Software Quality Measurement and Improvement bv