diff --git a/README.rst b/README.rst index d9ea804671678a035810823df6703aecd8d65013..bbe5f284a7cf1d6a9ce4e455b78cf1cf0f005c7e 100644 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ This repository carries the entire codebase for the `scipost.org <https://scipost.org>`_ scientific publication portal. This repo and other repositories relevant for the operation of SciPost, -are hosted at `code.scipost.org <https://code.scipost.org>`_. +are hosted at `scipost-codebases.org <https://scipost-codebases.org>`_. Relevant documentation about the intrastructure and its deployment can be found at `docs.scipost.org <https://docs.scipost.org>`_ diff --git a/SciPost_v1/settings/base.py b/SciPost_v1/settings/base.py index b889d8cd0608dbf25003d2ec0397122b86abcfe8..9c0d6f7b087fa982ce9cb92148465abc45d7c22f 100644 --- a/SciPost_v1/settings/base.py +++ b/SciPost_v1/settings/base.py @@ -229,7 +229,7 @@ CSP_SCRIPT_SRC = ("'self'", 'scipost.org', "'report-sample'", 'ajax.googleapis.com', 'cdn.mathjax.org', 'cdnjs.cloudflare.com', 'crossmark-cdn.crossref.org', - 'www.recaptcha.net', 'www.gstatic.com', + 'www.recaptcha.net', 'www.gstatic.com', 'www.gstatic.cn', 'code.jquery.com', 'static.mendeley.com', 'cdn.plot.ly') @@ -414,7 +414,7 @@ LOGGING = { 'disable_existing_loggers': False, 'formatters': { 'verbose': { - 'format': '[%(asctime)s] %(levelname)s | %(message)s' + 'format': '[%(asctime)s] %(levelname)s | %(module)s | %(funcName)s (%(lineno)d) | %(message)s' }, }, 'handlers': { @@ -430,6 +430,18 @@ LOGGING = { 'filename': '/path/to/logs/doi.log', 'formatter': 'verbose', }, + 'api_file': { + 'level': 'DEBUG', + 'class': 'logging.FileHandler', + 'filename': '/path/to/logs/api.log', + 'formatter': 'verbose', + }, + 'oauth_file': { + 'level': 'DEBUG', + 'class': 'logging.FileHandler', + 'filename': '/path/to/logs/oauth.log', + 'formatter': 'verbose', + }, }, 'loggers': { 'scipost.services.arxiv': { @@ -444,6 +456,24 @@ LOGGING = { 'propagate': True, 'formatter': 'simple', }, + 'oauthlib': { + 'handlers': ['oauth_file'], + 'level': 'DEBUG', + 'propagate': False, + 'formatter': 'verbose' + }, + 'api': { + 'handlers': ['api_file'], + 'level': 'DEBUG', + 'propagate': False, + 'formatter': 'verbose' + }, + 'oauth2_provider': { + 'handlers': ['oauth_file'], + 'level': 'DEBUG', + 'propagate': False, + 'formatter': 'verbose' + }, }, } diff --git a/SciPost_v1/settings/local_JSC.py b/SciPost_v1/settings/local_JSC.py index 121859052cfdb229ffc19f11964a46e396562798..03c966d65b8e5a36535260179180af6940ae08ba 100644 --- a/SciPost_v1/settings/local_JSC.py +++ b/SciPost_v1/settings/local_JSC.py @@ -20,6 +20,9 @@ MAILCHIMP_API_KEY = get_secret("MAILCHIMP_API_KEY") # Logging LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/arxiv.log' LOGGING['handlers']['scipost_file_doi']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/doi.log' +LOGGING['handlers']['api_file']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/api.log' +LOGGING['handlers']['oauth_file']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/oauth.log' + CROSSREF_DEPOSIT_EMAIL = 'jscaux@scipost.org' # Customized mailbackend diff --git a/SciPost_v1/settings/production.py b/SciPost_v1/settings/production.py index f8b9247febb76375efa867f83b35ebbc7a7c5d10..1709f736aa2404c42cee119d8024d997cec5907b 100644 --- a/SciPost_v1/settings/production.py +++ b/SciPost_v1/settings/production.py @@ -48,7 +48,7 @@ CROSSREF_DEBUG = False CROSSREF_DEPOSIT_EMAIL = 'edadmin@scipost.org' DOAJ_API_KEY = get_secret("DOAJ_API_KEY") -HAYSTACK_CONNECTIONS['default']['PATH'] = '/home/scipost/webapps/scipost/scipost_v1/whoosh_index' +HAYSTACK_CONNECTIONS['default']['PATH'] = '/home/scipost/webapps/scipost_py38/SciPost/whoosh_index' MAILCHIMP_API_USER = get_secret("MAILCHIMP_API_USER") MAILCHIMP_API_KEY = get_secret("MAILCHIMP_API_KEY") @@ -57,8 +57,10 @@ ITHENTICATE_USERNAME = get_secret('ITHENTICATE_USERNAME') ITHENTICATE_PASSWORD = get_secret('ITHENTICATE_PASSWORD') # Logging -LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/home/scipost/webapps/scipost/logs/arxiv.log' -LOGGING['handlers']['scipost_file_doi']['filename'] = '/home/scipost/webapps/scipost/logs/doi.log' +LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/home/scipost/webapps/scipost_py38/logs/arxiv.log' +LOGGING['handlers']['scipost_file_doi']['filename'] = '/home/scipost/webapps/scipost_py38/logs/doi.log' +LOGGING['handlers']['api_file']['filename'] = '/home/scipost/webapps/scipost_py38/logs/api.log' +LOGGING['handlers']['oauth_file']['filename'] = '/home/scipost/webapps/scipost_py38/logs/oauth.log' # API diff --git a/api/urls.py b/api/urls.py index e38e99e0be85e139e5abf88c2c8fa0a43276b575..9bf2d58c36ce92e4354742cae1ec09beb3e9e308 100644 --- a/api/urls.py +++ b/api/urls.py @@ -24,10 +24,10 @@ urlpatterns = router.urls urlpatterns += [ - path( # /api/userinfo/, for SciPost as OAuth2 authorization server - 'userinfo/', - views.userinfo, - name='userinfo' + path( # /api/omniauth/userinfo/, for SciPost as GitLab/OmniAuth authorization server + 'omniauth/userinfo/', + views.OmniAuthUserInfoView.as_view(), + name='omniauth_userinfo' ), path('journals/', include('journals.api.urls')), path('organizations/', include('organizations.api.urls')), diff --git a/api/views.py b/api/views.py index ef320b086335fe21cb3f51134b35ff4196e2200c..d26db604fd1d9ff783126f2510250e07b039025d 100644 --- a/api/views.py +++ b/api/views.py @@ -3,27 +3,83 @@ __license__ = "AGPL v3" import json +import logging +from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponse -from django.views.decorators.csrf import csrf_exempt -from oauth2_provider.decorators import protected_resource +from django.views.generic import View +from oauth2_provider.models import get_access_token_model -@csrf_exempt -@protected_resource() -def userinfo(request): + +log = logging.getLogger(__name__) + + +class OmniAuthUserInfoView(View): """ - Return basic user info, required for using SciPost as OAuth2 authorization server + Self-made userinfo endpoint to enable GitLab OmniAuth sign-in. + + Returns user data following`OmniAuth Schema 1 <https://github.com/omniauth/omniauth/wiki/auth-hash-schema#schema-10-and-later>`_ + + This view is inspired by `oauth2_provider.views.IntrospectTokenView`. """ - user = request.user - return HttpResponse( - json.dumps({ - 'provider': 'SciPost', - 'uid': user.id, - 'username': user.username, - 'name': ("%s %s" % (user.first_name, user.last_name)), - 'last_name': user.last_name, - 'first_name': user.first_name, - 'email': user.email - }), - content_type='application/json') + required_scopes = ['read'] + + @staticmethod + def get_userinfo_response(token_value=None): + try: + token = get_access_token_model().objects.get(token=token_value) + except ObjectDoesNotExist: + log.debug("Token not found for token_value %s" % token_value) + return HttpResponse( + content=json.dumps({"error": "invalid_token"}), + status=401, + content_type="application/json" + ) + else: + if token.is_valid(): + data = { + 'provider': 'SciPost', + 'uid': str(token.user.id), + 'info': { + 'name': token.user.get_full_name(), + 'email': token.user.email, + 'nickname': token.user.get_username(), + 'first_name': token.user.get_short_name(), + 'last_name': token.user.last_name, + } + } + log.debug("Response for token %s:\n\t%s" % (token_value, data)) + return HttpResponse( + content=json.dumps(data), + status=200, + content_type="application/json") + else: + log.debug("Token %s is invalid" % token_value) + return HttpResponse( + content=json.dumps({"error": "invalid_token"}), + status=200, + content_type="application/json" + ) + + def get(self, request, *args, **kwargs): + """ + Get the token from the `Authorization` request header. + + :param request: + :param args: + :param kwargs: + :return: + """ + log.debug(request.headers) + log.debug(request.body) + try: + if request.headers.get("Authorization").startswith("Bearer "): + token = request.headers.get("Authorization").partition(" ")[2] + log.debug("GET userinfo, token %s" % token) + else: + token = None + log.debug("GET userinfo, incorrect authorization") + except AttributeError: + token = None + return self.get_userinfo_response(token) diff --git a/cronjobs/cronjob_production_daily.sh b/cronjobs/cronjob_production_daily.sh index ff54e7abc8593473006f5e2fdb134600f11c0f63..5fbcf4d7b758c2e2107c1bcc23da3ae10a2c2291 100755 --- a/cronjobs/cronjob_production_daily.sh +++ b/cronjobs/cronjob_production_daily.sh @@ -2,7 +2,7 @@ # Daily cronjobs for production area -cd /home/scipost/webapps/scipost/scipost_v1 -source venv/bin/activate +cd /home/scipost/webapps/scipost_py38/SciPost +source ../venv3.8/bin/activate -python3 manage.py organization_update_cf_nr_associated_publications +python manage.py organization_update_cf_nr_associated_publications --settings=SciPost_v1.settings.production diff --git a/cronjobs/cronjob_production_eachhour.sh b/cronjobs/cronjob_production_eachhour.sh index 1cf3f279b71582701a23faba8b94c2d1694e502d..0a171f9c40e5481f0bb86c532ac986dffd0b0dcb 100755 --- a/cronjobs/cronjob_production_eachhour.sh +++ b/cronjobs/cronjob_production_eachhour.sh @@ -2,12 +2,12 @@ # Per minute cronjobs for production area -cd /home/scipost/webapps/scipost/scipost_v1 -source venv/bin/activate +cd /home/scipost/webapps/scipost_py38/SciPost +source ../venv3.8/bin/activate # Do tasks -python3 manage.py check_celery -python3 manage.py update_coi_via_arxiv +python manage.py check_celery --settings=SciPost_v1.settings.production +python manage.py update_coi_via_arxiv --settings=SciPost_v1.settings.production # Do a update_index of the last hour -python3 manage.py update_index -r -v 0 -a 1 +python manage.py update_index -r -v 0 -a 1 --settings=SciPost_v1.settings.production diff --git a/cronjobs/cronjob_production_eachminute.sh b/cronjobs/cronjob_production_eachminute.sh index a7db7bdec723b442396b161efe1fa25e40c4b06d..b8f459772d0a478778e1f8d6996289f38c7702b9 100755 --- a/cronjobs/cronjob_production_eachminute.sh +++ b/cronjobs/cronjob_production_eachminute.sh @@ -2,8 +2,8 @@ # Per minute cronjobs for production area -cd /home/scipost/webapps/scipost/scipost_v1 -source venv/bin/activate +cd /home/scipost/webapps/scipost_py38/SciPost +source ../venv3.8/bin/activate # Mails waiting in the database -python3 manage.py send_mails +python manage.py send_mails --settings=SciPost_v1.settings.production diff --git a/cronjobs/cronjob_production_sundays.sh b/cronjobs/cronjob_production_sundays.sh index 80d4b4e82848b5da03180b78172c3845cf8a2d50..897145350a71c2b83bcb66d0295e1c8cf0995175 100755 --- a/cronjobs/cronjob_production_sundays.sh +++ b/cronjobs/cronjob_production_sundays.sh @@ -3,10 +3,10 @@ # Weekly cronjobs for production area # Weekend jobs -cd /home/scipost/webapps/scipost/scipost_v1 -source venv/bin/activate +cd /home/scipost/webapps/scipost_py38/SciPost +source ../venv3.8/bin/activate -python3 manage.py update_citedby +python manage.py update_citedby --settings=SciPost_v1.settings.production -# Do a full update_index when maybe something has slipped through during the week somehow..? -python3 manage.py update_index -r -v 0 +# Do a full update_index when maybe something has slipped through during the week +python manage.py update_index -r -v 0 --settings=SciPost_v1.settings.production diff --git a/cronjobs/cronjob_production_weekdays.sh b/cronjobs/cronjob_production_weekdays.sh index 791e66344f5da1d95cfd14890d51657ff9bdc4ff..4d492c144e9729beb3a00b2ea67d1743128b6e21 100755 --- a/cronjobs/cronjob_production_weekdays.sh +++ b/cronjobs/cronjob_production_weekdays.sh @@ -2,7 +2,7 @@ # Daily cronjobs for production area -cd /home/scipost/webapps/scipost/scipost_v1 -source venv/bin/activate +cd /home/scipost/webapps/scipost_py38/SciPost +source ../venv3.8/bin/activate -python3 manage.py send_refereeing_reminders +python manage.py send_refereeing_reminders --settings=SciPost_v1.settings.production diff --git a/cronjobs/cronjob_production_weekly.sh b/cronjobs/cronjob_production_weekly.sh index 861ffa3c13bd51158ae0e873d90b16dd1ed565ee..9f2018d36360c53a3299c2df0d39315218e6381c 100755 --- a/cronjobs/cronjob_production_weekly.sh +++ b/cronjobs/cronjob_production_weekly.sh @@ -2,7 +2,7 @@ # Weekly cronjobs for production area -cd /home/scipost/webapps/scipost/scipost_v1 -source venv/bin/activate +cd /home/scipost/webapps/scipost_py38/SciPost +source ../venv3.8/bin/activate -python3 manage.py email_fellows_tasklist +python manage.py email_fellows_tasklist --settings=SciPost_v1.settings.production diff --git a/docs/codebase/apps/communications/notifications/modules.rst b/docs/codebase/apps/communications/notifications/modules.rst index 66d893f306a7de963b6a979edf474a49812a68f1..1f1d2bc305aac8d63540ecf3595d48fd5525741a 100644 --- a/docs/codebase/apps/communications/notifications/modules.rst +++ b/docs/codebase/apps/communications/notifications/modules.rst @@ -4,4 +4,3 @@ notifications .. toctree:: :maxdepth: 4 - notifications diff --git a/docs/codebase/apps/communications/notifications/notifications.constants.rst b/docs/codebase/apps/communications/notifications/notifications.constants.rst deleted file mode 100644 index c1f0b093408a72f2416409c2e2ef86d994f1ca76..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/communications/notifications/notifications.constants.rst +++ /dev/null @@ -1,7 +0,0 @@ -notifications.constants module -============================== - -.. automodule:: notifications.constants - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/communications/notifications/notifications.models.rst b/docs/codebase/apps/communications/notifications/notifications.models.rst deleted file mode 100644 index d02905e3347940f935728c1a0d4643f4cc51f8bc..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/communications/notifications/notifications.models.rst +++ /dev/null @@ -1,7 +0,0 @@ -notifications.models module -=========================== - -.. automodule:: notifications.models - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/communications/notifications/notifications.rst b/docs/codebase/apps/communications/notifications/notifications.rst deleted file mode 100644 index 01ed9a3d81293e3c8d15365ba35c8386122466eb..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/communications/notifications/notifications.rst +++ /dev/null @@ -1,26 +0,0 @@ -notifications package -===================== - -Submodules ----------- - -.. toctree:: - - notifications.admin - notifications.apps - notifications.constants - notifications.managers - notifications.models - notifications.signals - notifications.tests - notifications.urls - notifications.utils - notifications.views - -Module contents ---------------- - -.. automodule:: notifications - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/communications/notifications/notifications.signals.rst b/docs/codebase/apps/communications/notifications/notifications.signals.rst deleted file mode 100644 index 59ba3de58cd96f99045951350cf39e53c22ce3d3..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/communications/notifications/notifications.signals.rst +++ /dev/null @@ -1,7 +0,0 @@ -notifications.signals module -============================ - -.. automodule:: notifications.signals - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/communications/notifications/notifications.tests.rst b/docs/codebase/apps/communications/notifications/notifications.tests.rst deleted file mode 100644 index fdb4aa812b8fb6c58bb011b950de72d7e629c650..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/communications/notifications/notifications.tests.rst +++ /dev/null @@ -1,7 +0,0 @@ -notifications.tests module -========================== - -.. automodule:: notifications.tests - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/communications/notifications/notifications.urls.rst b/docs/codebase/apps/communications/notifications/notifications.urls.rst deleted file mode 100644 index ead2a65779313ac53187180df86c3cdf617c0ec2..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/communications/notifications/notifications.urls.rst +++ /dev/null @@ -1,7 +0,0 @@ -notifications.urls module -========================= - -.. automodule:: notifications.urls - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/communications/notifications/notifications.utils.rst b/docs/codebase/apps/communications/notifications/notifications.utils.rst deleted file mode 100644 index cbc050eae18020b14d27a7bdc7291ee69deecb95..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/communications/notifications/notifications.utils.rst +++ /dev/null @@ -1,7 +0,0 @@ -notifications.utils module -========================== - -.. automodule:: notifications.utils - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/communications/notifications/notifications.views.rst b/docs/codebase/apps/communications/notifications/notifications.views.rst deleted file mode 100644 index 6427d63e3d46a7c6feeda24b323c982403c12e16..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/communications/notifications/notifications.views.rst +++ /dev/null @@ -1,7 +0,0 @@ -notifications.views module -========================== - -.. automodule:: notifications.views - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/production/production/production.signals.rst b/docs/codebase/apps/core/scipost/scipost.converters.rst similarity index 57% rename from docs/codebase/apps/production/production/production.signals.rst rename to docs/codebase/apps/core/scipost/scipost.converters.rst index c691fbe5e5e40595a601fba9bafe984110fca2cc..a168198701a2418ddc8fd17e9cfe835cefbac398 100644 --- a/docs/codebase/apps/production/production/production.signals.rst +++ b/docs/codebase/apps/core/scipost/scipost.converters.rst @@ -1,7 +1,7 @@ -production.signals module +scipost.converters module ========================= -.. automodule:: production.signals +.. automodule:: scipost.converters :members: :undoc-members: :show-inheritance: diff --git a/docs/codebase/apps/core/scipost/scipost.rst b/docs/codebase/apps/core/scipost/scipost.rst index d7930ec308a0f2198daa489746c60367b8a0e0a6..6af8343398ae949ace95006234cc0b951edb9ed4 100644 --- a/docs/codebase/apps/core/scipost/scipost.rst +++ b/docs/codebase/apps/core/scipost/scipost.rst @@ -19,6 +19,7 @@ Submodules scipost.apps scipost.behaviors scipost.constants + scipost.converters scipost.decorators scipost.factories scipost.feeds diff --git a/docs/codebase/apps/editorial/submissions/submissions.management.commands.remind_fellows_to_submit_report.rst b/docs/codebase/apps/editorial/submissions/submissions.management.commands.remind_fellows_to_submit_report.rst deleted file mode 100644 index fc442877baddb74aace2aed041bcf9d85e791e2d..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/editorial/submissions/submissions.management.commands.remind_fellows_to_submit_report.rst +++ /dev/null @@ -1,7 +0,0 @@ -submissions.management.commands.remind\_fellows\_to\_submit\_report module -========================================================================== - -.. automodule:: submissions.management.commands.remind_fellows_to_submit_report - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/editorial/submissions/submissions.management.commands.rst b/docs/codebase/apps/editorial/submissions/submissions.management.commands.rst index 7fd2fa08295f75f2677bbbbc076aee9804c5fb2b..189e543cfe7ad2ca9dd479d3f867b97000a194ac 100644 --- a/docs/codebase/apps/editorial/submissions/submissions.management.commands.rst +++ b/docs/codebase/apps/editorial/submissions/submissions.management.commands.rst @@ -8,7 +8,6 @@ Submodules submissions.management.commands.create_submissions submissions.management.commands.email_fellows_tasklist - submissions.management.commands.remind_fellows_to_submit_report submissions.management.commands.send_refereeing_reminders Module contents diff --git a/docs/codebase/apps/editorial/submissions/submissions.managers.assignment.rst b/docs/codebase/apps/editorial/submissions/submissions.managers.assignment.rst new file mode 100644 index 0000000000000000000000000000000000000000..88632619927f34b780b219ca82f6975a2ea04169 --- /dev/null +++ b/docs/codebase/apps/editorial/submissions/submissions.managers.assignment.rst @@ -0,0 +1,7 @@ +submissions.managers.assignment module +====================================== + +.. automodule:: submissions.managers.assignment + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/editorial/submissions/submissions.managers.communication.rst b/docs/codebase/apps/editorial/submissions/submissions.managers.communication.rst new file mode 100644 index 0000000000000000000000000000000000000000..38dc4f41018232de7f300b57a9547cf449c7dfea --- /dev/null +++ b/docs/codebase/apps/editorial/submissions/submissions.managers.communication.rst @@ -0,0 +1,7 @@ +submissions.managers.communication module +========================================= + +.. automodule:: submissions.managers.communication + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/editorial/submissions/submissions.managers.decision.rst b/docs/codebase/apps/editorial/submissions/submissions.managers.decision.rst new file mode 100644 index 0000000000000000000000000000000000000000..cda56efb4c82ad48f8d6c7b3f5b6ef7febe7190e --- /dev/null +++ b/docs/codebase/apps/editorial/submissions/submissions.managers.decision.rst @@ -0,0 +1,7 @@ +submissions.managers.decision module +==================================== + +.. automodule:: submissions.managers.decision + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/editorial/submissions/submissions.managers.recommendation.rst b/docs/codebase/apps/editorial/submissions/submissions.managers.recommendation.rst new file mode 100644 index 0000000000000000000000000000000000000000..f0306c37255e0fb1ec1adbccfaefe6a5b136d3de --- /dev/null +++ b/docs/codebase/apps/editorial/submissions/submissions.managers.recommendation.rst @@ -0,0 +1,7 @@ +submissions.managers.recommendation module +========================================== + +.. automodule:: submissions.managers.recommendation + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/editorial/submissions/submissions.managers.referee_invitation.rst b/docs/codebase/apps/editorial/submissions/submissions.managers.referee_invitation.rst new file mode 100644 index 0000000000000000000000000000000000000000..862f7a1c44ebec3f99c2ff90b82a6d3cc5b4e40b --- /dev/null +++ b/docs/codebase/apps/editorial/submissions/submissions.managers.referee_invitation.rst @@ -0,0 +1,7 @@ +submissions.managers.referee\_invitation module +=============================================== + +.. automodule:: submissions.managers.referee_invitation + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/editorial/submissions/submissions.managers.report.rst b/docs/codebase/apps/editorial/submissions/submissions.managers.report.rst new file mode 100644 index 0000000000000000000000000000000000000000..596a3a4a3a0b4e9c109396520f1a4ce7a10eadb4 --- /dev/null +++ b/docs/codebase/apps/editorial/submissions/submissions.managers.report.rst @@ -0,0 +1,7 @@ +submissions.managers.report module +================================== + +.. automodule:: submissions.managers.report + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/editorial/submissions/submissions.managers.rst b/docs/codebase/apps/editorial/submissions/submissions.managers.rst index 9ca62f642457c67928a61b5292d0550674bf9268..2405b400bf55e43c3b5ba0c823047dcc82ed240a 100644 --- a/docs/codebase/apps/editorial/submissions/submissions.managers.rst +++ b/docs/codebase/apps/editorial/submissions/submissions.managers.rst @@ -1,5 +1,21 @@ -submissions.managers module -=========================== +submissions.managers package +============================ + +Submodules +---------- + +.. toctree:: + + submissions.managers.assignment + submissions.managers.communication + submissions.managers.decision + submissions.managers.recommendation + submissions.managers.referee_invitation + submissions.managers.report + submissions.managers.submission + +Module contents +--------------- .. automodule:: submissions.managers :members: diff --git a/docs/codebase/apps/editorial/submissions/submissions.managers.submission.rst b/docs/codebase/apps/editorial/submissions/submissions.managers.submission.rst new file mode 100644 index 0000000000000000000000000000000000000000..5b53de22766598a4e2ef4c4f9bc4c6daf59442e2 --- /dev/null +++ b/docs/codebase/apps/editorial/submissions/submissions.managers.submission.rst @@ -0,0 +1,7 @@ +submissions.managers.submission module +====================================== + +.. automodule:: submissions.managers.submission + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/editorial/submissions/submissions.models.preprint_server.rst b/docs/codebase/apps/editorial/submissions/submissions.models.preprint_server.rst new file mode 100644 index 0000000000000000000000000000000000000000..113dab7b3c92a0a035ab7efa23b9448edf778e6e --- /dev/null +++ b/docs/codebase/apps/editorial/submissions/submissions.models.preprint_server.rst @@ -0,0 +1,7 @@ +submissions.models.preprint\_server module +========================================== + +.. automodule:: submissions.models.preprint_server + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/editorial/submissions/submissions.models.rst b/docs/codebase/apps/editorial/submissions/submissions.models.rst index 6fde968e53ffb49602c423eddedf075bd22bbf7e..1f8b1f3f94a5a2dc718f9516f53e225c3affb563 100644 --- a/docs/codebase/apps/editorial/submissions/submissions.models.rst +++ b/docs/codebase/apps/editorial/submissions/submissions.models.rst @@ -10,6 +10,7 @@ Submodules submissions.models.communication submissions.models.decision submissions.models.plagiarism + submissions.models.preprint_server submissions.models.recommendation submissions.models.referee_invitation submissions.models.report diff --git a/docs/codebase/apps/editorial/submissions/submissions.rst b/docs/codebase/apps/editorial/submissions/submissions.rst index 1b3dbc491ef4b2cdfea74d0fabb5f763fb4709d7..84999f1c350ba4e5e7271ea1f4b5057882d9b607 100644 --- a/docs/codebase/apps/editorial/submissions/submissions.rst +++ b/docs/codebase/apps/editorial/submissions/submissions.rst @@ -7,6 +7,7 @@ Subpackages .. toctree:: submissions.management + submissions.managers submissions.models submissions.templatetags submissions.tests @@ -24,13 +25,11 @@ Submodules submissions.factories submissions.forms submissions.helpers - submissions.managers submissions.mixins submissions.plagiarism submissions.refereeing_cycles submissions.search_indexes submissions.services - submissions.signals submissions.tasks submissions.urls submissions.utils diff --git a/docs/codebase/apps/editorial/submissions/submissions.signals.rst b/docs/codebase/apps/editorial/submissions/submissions.signals.rst deleted file mode 100644 index 47bc748809db8bda1318e383e960de143f64a7ba..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/editorial/submissions/submissions.signals.rst +++ /dev/null @@ -1,7 +0,0 @@ -submissions.signals module -========================== - -.. automodule:: submissions.signals - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/production/production/production.rst b/docs/codebase/apps/production/production/production.rst index 267d973f59bfdd25da12a9d7c5e2811dcd31f8ef..5e68a712e0ff8a8d466229e3e286a4234fb4df02 100644 --- a/docs/codebase/apps/production/production/production.rst +++ b/docs/codebase/apps/production/production/production.rst @@ -20,7 +20,6 @@ Submodules production.managers production.models production.permissions - production.signals production.urls production.utils production.views diff --git a/docs/codebase/apps/publishing/journals/journals.api.rst b/docs/codebase/apps/publishing/journals/journals.api.rst new file mode 100644 index 0000000000000000000000000000000000000000..b45938bde6fa9f8d0f29153627cf7dd21c07a3e3 --- /dev/null +++ b/docs/codebase/apps/publishing/journals/journals.api.rst @@ -0,0 +1,19 @@ +journals.api package +==================== + +Submodules +---------- + +.. toctree:: + + journals.api.serializers + journals.api.urls + journals.api.views + +Module contents +--------------- + +.. automodule:: journals.api + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/publishing/journals/journals.api.serializers.rst b/docs/codebase/apps/publishing/journals/journals.api.serializers.rst new file mode 100644 index 0000000000000000000000000000000000000000..e3b0539411ebdf4cafaafc6ce82f404324aa0e41 --- /dev/null +++ b/docs/codebase/apps/publishing/journals/journals.api.serializers.rst @@ -0,0 +1,7 @@ +journals.api.serializers module +=============================== + +.. automodule:: journals.api.serializers + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/codebase/apps/publishing/journals/journals.viewsets.rst b/docs/codebase/apps/publishing/journals/journals.api.urls.rst similarity index 57% rename from docs/codebase/apps/publishing/journals/journals.viewsets.rst rename to docs/codebase/apps/publishing/journals/journals.api.urls.rst index 1c20cbf915d4b95bde4552d6de36c2bbac1aca93..d6474dd76e3f384706ab8e64e1ab1f1f9495d3fc 100644 --- a/docs/codebase/apps/publishing/journals/journals.viewsets.rst +++ b/docs/codebase/apps/publishing/journals/journals.api.urls.rst @@ -1,7 +1,7 @@ -journals.viewsets module +journals.api.urls module ======================== -.. automodule:: journals.viewsets +.. automodule:: journals.api.urls :members: :undoc-members: :show-inheritance: diff --git a/docs/codebase/apps/communications/notifications/notifications.apps.rst b/docs/codebase/apps/publishing/journals/journals.api.views.rst similarity index 57% rename from docs/codebase/apps/communications/notifications/notifications.apps.rst rename to docs/codebase/apps/publishing/journals/journals.api.views.rst index 2ac427f86a444f96f506ab60c9240299995baa34..ff31194df3872d7db6b0f3d00e4b72b2ac7fadd9 100644 --- a/docs/codebase/apps/communications/notifications/notifications.apps.rst +++ b/docs/codebase/apps/publishing/journals/journals.api.views.rst @@ -1,7 +1,7 @@ -notifications.apps module +journals.api.views module ========================= -.. automodule:: notifications.apps +.. automodule:: journals.api.views :members: :undoc-members: :show-inheritance: diff --git a/docs/codebase/apps/communications/notifications/notifications.admin.rst b/docs/codebase/apps/publishing/journals/journals.converters.rst similarity index 56% rename from docs/codebase/apps/communications/notifications/notifications.admin.rst rename to docs/codebase/apps/publishing/journals/journals.converters.rst index f941a752c1a9eacdf86522cdb4b5ee920c2f3ae0..64a570efb92182e0b2ef7515023cfb02579b426c 100644 --- a/docs/codebase/apps/communications/notifications/notifications.admin.rst +++ b/docs/codebase/apps/publishing/journals/journals.converters.rst @@ -1,7 +1,7 @@ -notifications.admin module +journals.converters module ========================== -.. automodule:: notifications.admin +.. automodule:: journals.converters :members: :undoc-members: :show-inheritance: diff --git a/docs/codebase/apps/publishing/journals/journals.models.rst b/docs/codebase/apps/publishing/journals/journals.models.rst index 6c7f4f4cc49fc16ef1ddbd8c7e35f0c4cff24c95..240eda34db251d5e3c4f32e05946a1dca82c7510 100644 --- a/docs/codebase/apps/publishing/journals/journals.models.rst +++ b/docs/codebase/apps/publishing/journals/journals.models.rst @@ -10,6 +10,7 @@ Submodules journals.models.issue journals.models.journal journals.models.publication + journals.models.update journals.models.volume Module contents diff --git a/docs/codebase/apps/communications/notifications/notifications.managers.rst b/docs/codebase/apps/publishing/journals/journals.models.update.rst similarity index 55% rename from docs/codebase/apps/communications/notifications/notifications.managers.rst rename to docs/codebase/apps/publishing/journals/journals.models.update.rst index ec63cb7cf877f750655d532e5937756de9620144..a1e2525aef2b0e15cf8e6620a241dcc4f68d70d1 100644 --- a/docs/codebase/apps/communications/notifications/notifications.managers.rst +++ b/docs/codebase/apps/publishing/journals/journals.models.update.rst @@ -1,7 +1,7 @@ -notifications.managers module +journals.models.update module ============================= -.. automodule:: notifications.managers +.. automodule:: journals.models.update :members: :undoc-members: :show-inheritance: diff --git a/docs/codebase/apps/publishing/journals/journals.rst b/docs/codebase/apps/publishing/journals/journals.rst index 7d59b081d869cefee28c28a7a13933b1e9f04105..4dd5e8d0b66049c1634c1921d037a19efd3ef577 100644 --- a/docs/codebase/apps/publishing/journals/journals.rst +++ b/docs/codebase/apps/publishing/journals/journals.rst @@ -6,6 +6,7 @@ Subpackages .. toctree:: + journals.api journals.management journals.models journals.templatetags @@ -19,6 +20,7 @@ Submodules journals.admin journals.constants journals.context_processors + journals.converters journals.exceptions journals.factories journals.forms @@ -27,13 +29,10 @@ Submodules journals.mixins journals.regexes journals.search_indexes - journals.serializers journals.services - journals.signals journals.utils journals.validators journals.views - journals.viewsets Module contents --------------- diff --git a/docs/codebase/apps/publishing/journals/journals.serializers.rst b/docs/codebase/apps/publishing/journals/journals.serializers.rst deleted file mode 100644 index 46754e1ff954a002a00e564c213ea07c7f2d78c8..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/publishing/journals/journals.serializers.rst +++ /dev/null @@ -1,7 +0,0 @@ -journals.serializers module -=========================== - -.. automodule:: journals.serializers - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/apps/publishing/journals/journals.signals.rst b/docs/codebase/apps/publishing/journals/journals.signals.rst deleted file mode 100644 index 8a3ffc66fdab2d4b636af97c6dda052d5e8f826c..0000000000000000000000000000000000000000 --- a/docs/codebase/apps/publishing/journals/journals.signals.rst +++ /dev/null @@ -1,7 +0,0 @@ -journals.signals module -======================= - -.. automodule:: journals.signals - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/codebase/contributing.rst b/docs/codebase/contributing.rst index b99bb0d140226293c7144226f3652fc11966a100..47bf7f66d093338be0418681b6bc7b6b0cc2714a 100644 --- a/docs/codebase/contributing.rst +++ b/docs/codebase/contributing.rst @@ -2,8 +2,8 @@ Contributing to the SciPost codebase ************************************ -Our self-served Git depot at `code.scipost.org <https://code.scipost.org>`_ -hosts the `main SciPost repository <https://code.scipost.org/scipost/SciPost>`_ +Our self-served Git depot at `scipost-codebases.org <https://scipost-codebases.org>`_ +hosts the `main SciPost repository <https://scipost-codebases.org/scipost/SciPost>`_ (access credentials required). Pull requests are admitted from members of our Development Team. diff --git a/docs/codebase/stack.rst b/docs/codebase/stack.rst index cfda4a04e03eb5daef5f4a33d729b885fb25091e..2c63d4e93a1c12b9333e1501191eea7b15319082 100644 --- a/docs/codebase/stack.rst +++ b/docs/codebase/stack.rst @@ -59,10 +59,8 @@ Besides this, we also use We self-host our code repositories by running -* a `Gitea <https://gitea.io>`_ instance - at `code.scipost.org <https://code.scipost.org>`_ - (based on `Go <https://golang.org/>`_ the language, - not `Go the game <https://en.wikipedia.org/wiki/Go_(game)>`_). +* a `GitLab <https://gitlab.com/gitlab-org/gitlab>`_ instance + at `scipost-codebases.org <https://scipost-codebases.org>`_. See our :doc:`deployment documentation <../deployment/index>` for the complete details of how our services are brought to life. diff --git a/docs/deployment/deployment.rst b/docs/deployment/deployment.rst index 559ba78191dfb44c4f1888939ff166f3dd5983db..7f4a407c5e6b1a60c4ff95469ad30b1948e66310 100644 --- a/docs/deployment/deployment.rst +++ b/docs/deployment/deployment.rst @@ -17,8 +17,8 @@ Production server Git server ========== -SciPost runs its own git repository server at `code.scipost.org <https://code.scipost.org>`_. -This is a `Gitea <https://gitea.io>`_ instance hosted on the same server as production. +SciPost runs its own git repository server at `scipost-codebases.org <https://scipost-codebases.org>`_. +This is a `GitLab <https://gitlab.com/gitlab-org/gitlab>`_ instance hosted on a selfstanding server. All codes needed to run SciPost are contained in various repositories on this server (you will need access credentials). diff --git a/finances/templates/finances/business_model.html b/finances/templates/finances/business_model.html index 551d759027f07f63336a2fc73d625fd7221add91..cd1893dbe0791ddf9e8357f5453ad19b52d2561d 100644 --- a/finances/templates/finances/business_model.html +++ b/finances/templates/finances/business_model.html @@ -297,7 +297,7 @@ web programmers? Is any one of them open to the idea of contributing to our project, even on an occasional basis? We can then give them access to our repository at - <a href="https://code.scipost.org/">code.scipost.org</a> where we keep + <a href="https://scipost-codebases.org/">scipost-codebases.org</a> where we keep all codebases for our online facilities. </li> <li><strong>editorial coordination</strong><br> diff --git a/package.json b/package.json index 0d2ca3c75ff4240c34b6b6f855610bd81f7e63af..81f7b7d10631ad1ae0958fcf204746e4dfd906b0 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "private": true, "repository": { "type": "git", - "url": "git+https://code.scipost.org/scipost/SciPost.git" + "url": "git+https://scipost-codebases.org/scipost/SciPost.git" }, "author": "SciPost", "homepage": "https://scipost.org", diff --git a/requirements.txt b/requirements.txt index d234799181e7f1faba414074a078dc1d1735a826..38b77e590a0b3487a0a1afc1e920c24a14773102 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ # Core argon2-cffi==16.3.0 # Password hashing algorithm Babel==2.4 -Django==2.2.11 # 2020-03-07 +Django==2.2.16 # 2020-09-19 feedparser==5.2.1 # Check: not updated since 2016 -psycopg2==2.7.3.2 # PostgreSQL engine +psycopg2==2.8.6 # 2020-09-19 PostgreSQL engine pytz==2017.2 # Timezone package djangorestframework==3.9.3 # 2019-12-05 IMPORTANT: update templates/rest_framework/base.html if corresponding file rest_framework/templates/rest_framework/base.html has changed requests==2.18.3 @@ -73,13 +73,13 @@ snowballstemmer==1.2.1 # Scheduled tasks -celery==4.3.0 # 2019-05-11, py3.4 to 3.7, req: amqp-2.4.2 billiard-3.6.0.0 kombu-4.5.0 vine-1.3.0 -django-celery-results==1.0.4 # 2019-05-11 -django-celery-beat==1.3.0 # 2019-05-11, req: celery, django-timezone-field-3.0 python-crontab-2.3.6 -flower==0.9.3 # 2019-05-11, req: pytz, tornado, babel, celery +celery==4.4.7 # 2020-09-19 +django-celery-results==1.2.1 # 2020-09-19 +django-celery-beat==2.0.0 # 2020-09-19 +flower==0.9.4 # 2020-09-19 Bug (404 error) in 0.9.5: see https://github.com/mher/flower/issues/1015 # Security-related packages -django-referrer-policy==1.0 # 2019-05-11, py<=3.6, Dj<=2.0, req: -django-csp==3.5 # 2019-05-11 -django-feature-policy==2.2.0 # 2019-05-18 +django-referrer-policy==1.0 # 2020-09-19 no new updates for 3 years +django-csp==3.7 # 2020-09-19 +django-feature-policy==3.4.0 # 2020-09-19 diff --git a/scipost/templates/scipost/footer.html b/scipost/templates/scipost/footer.html index 49bf8e8b54b4be713c139986994971ec4249e052..d4dd3b686a74b48de42c0f33cf817e13bc7d7bf2 100644 --- a/scipost/templates/scipost/footer.html +++ b/scipost/templates/scipost/footer.html @@ -21,7 +21,7 @@ <li><a href="{% url 'helpdesk:helpdesk' %}">Helpdesk</a></li> {% endif %} <li><a href="mailto:techsupport@scipost.org">Write to tech support</a></li> - <li><a href="https://code.scipost.org" target="_blank"><i class="fa fa-code-fork"></i> code.scipost.org</a></li> + <li><a href="https://scipost-codebases.org" target="_blank"><i class="fa fa-code-fork"></i> scipost-codebases.org</a></li> </ul> </div> diff --git a/start_celery.sh b/start_celery.sh index a8caa9ad926a8b12c7d6e7206261f380397b67de..380d2c072c279b7033b5272f0582a5e8b3f7c0b7 100755 --- a/start_celery.sh +++ b/start_celery.sh @@ -1,7 +1,7 @@ #!/bin/bash pkill -f bin/celery -cd /home/scipost/webapps/scipost/scipost_v1 && source venv/bin/activate +cd /home/scipost/webapps/scipost_py38/SciPost && source ../venv3.8/bin/activate mkdir -p ./local_files/logs touch ./local_files/logs/celery_worker.log diff --git a/submissions/tasks.py b/submissions/tasks.py index 9259daa2ce09bebebe211274c02f4e8b5ed099d6..3adaeef7c1acf1139edfffe537b0b55aa4613ad5 100644 --- a/submissions/tasks.py +++ b/submissions/tasks.py @@ -7,8 +7,6 @@ from django.utils import timezone from SciPost_v1.celery import app from .models import Submission, EditorialAssignment, RefereeInvitation, Report -from .signals import ( - notify_invitation_approaching_deadline, notify_invitation_overdue, notify_unfinished_report) @app.task(bind=True) @@ -34,24 +32,6 @@ def send_editorial_assignment_invitations(self): return {'new_invites': count} -@app.task(bind=True) -def remind_referees_to_fulfill_to_invitation(self): - """Remind Referees with unfilfilled RefereeInvitations to submit a Report.""" - for invitation in RefereeInvitation.objects.approaching_deadline(): - notify_invitation_approaching_deadline(RefereeInvitation, invitation, False) - for invitation in RefereeInvitation.objects.overdue(): - notify_invitation_overdue(RefereeInvitation, invitation, False) - - -@app.task(bind=True) -def remind_referees_to_submit_report(self): - """Remind Referees with unfinished Report finish their Report.""" - compare_dt = timezone.now() - timedelta(days=2) - - for report in Report.objects.in_draft().filter(modified__lt=compare_dt): - notify_unfinished_report(Report, report, False) - - @app.task(bind=True) def submit_submission_document_for_plagiarism(self): """Upload a new Submission document to iThenticate."""