Skip to content

Commit

Permalink
merge v0.13.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie authored Feb 16, 2024
2 parents 30df804 + aca18fd commit be012e5
Show file tree
Hide file tree
Showing 23 changed files with 466 additions and 223 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Checkout repository
uses: actions/checkout@v3
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
- name: Install project Python dependencies
run: |
pip install "wheel>=0.38.4, <0.39"
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,49 @@ Changelog for the **SODAR Core** Django app package. Loosely follows the
`Keep a Changelog <http://keepachangelog.com/en/1.0.0/>`_ guidelines.


v0.13.4 (2024-02-16)
====================

Added
-----

- **Projectroles**
- ``LoggedInPermissionMixin`` login message customization (#1360)
- Base UI classses in Django API documentation (#1363)
- **Siteinfo**
- Missing LDAP Django settings (#1347)

Changed
-------

- **General**
- Upgrade minimum Django version to v3.2.24 (#1348)
- Upgrade LDAP dependencies (#1348)
- **Projectroles**
- Improve remote site deletion UI text labels (#1349)
- Store remote sync app setting foreign key UUIDs as strings (#1356)
- Do not create timeline event for re-accepting project invite (#1352)
- Improve user message for re-accepting project invite (#1354)
- Redirect to ``ProjectDetailView`` from re-accepting project invite (#1361)
- Do not display login error on invite accept (#1360)
- Clarify login error message for unauthenticated user (#1362)

Fixed
-----

- **General**
- Invalid env var retrieval for ``AUTH_LDAP*_START_TLS`` (#1351)
- Versioneer version not available in CI (#1357)
- **Projectroles**
- Remote sync ``user_name`` crash with <0.13.3 target sites (#1355)

Removed
-------

- **Timeline**
- Unused ``collect_extra_data()`` template tag (#1359)


v0.13.3 (2023-12-06)
====================

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ and breaking changes are possible.

.. code-block:: console
pip install django-sodar-core==0.13.3
pip install django-sodar-core==0.13.4
For installing a development version you can point your dependency to a specific
commit ID in GitHub. Note that these versions may not be stable.
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
"codeRepository": "https://github.com/bihealth/sodar-core",
"datePublished": "2023-12-06",
"dateModified": "2023-12-06",
"dateCreated": "2019-06-26",
"dateCreated": "2024-02-16",
"description": "SODAR Core: A Django-based framework for scientific data management and analysis web apps",
"keywords": "Python, Django, scientific data managmenent, software library",
"license": "MIT",
"title": "SODAR Core",
"version": "v0.13.3"
"version": "v0.13.4"
}
15 changes: 5 additions & 10 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,8 @@
ENABLE_LDAP = env.bool('ENABLE_LDAP', False)
ENABLE_LDAP_SECONDARY = env.bool('ENABLE_LDAP_SECONDARY', False)
LDAP_DEBUG = env.bool('LDAP_DEBUG', False)

# Alternative domains for detecting LDAP access by email address
LDAP_ALT_DOMAINS = env.list('LDAP_ALT_DOMAINS', None, [])
LDAP_ALT_DOMAINS = env.list('LDAP_ALT_DOMAINS', None, default=[])

if ENABLE_LDAP:
import itertools
Expand All @@ -363,18 +362,17 @@
AUTH_LDAP_SERVER_URI = env.str('AUTH_LDAP_SERVER_URI', None)
AUTH_LDAP_BIND_DN = env.str('AUTH_LDAP_BIND_DN', None)
AUTH_LDAP_BIND_PASSWORD = env.str('AUTH_LDAP_BIND_PASSWORD', None)
AUTH_LDAP_START_TLS = env.str('AUTH_LDAP_START_TLS', False)
AUTH_LDAP_START_TLS = env.bool('AUTH_LDAP_START_TLS', False)
AUTH_LDAP_CA_CERT_FILE = env.str('AUTH_LDAP_CA_CERT_FILE', None)
AUTH_LDAP_CONNECTION_OPTIONS = {**LDAP_DEFAULT_CONN_OPTIONS}
if AUTH_LDAP_CA_CERT_FILE is not None:
if AUTH_LDAP_CA_CERT_FILE:
AUTH_LDAP_CONNECTION_OPTIONS[
ldap.OPT_X_TLS_CACERTFILE
] = AUTH_LDAP_CA_CERT_FILE
AUTH_LDAP_CONNECTION_OPTIONS[ldap.OPT_X_TLS_NEWCTX] = 0
AUTH_LDAP_USER_FILTER = env.str(
'AUTH_LDAP_USER_FILTER', '(sAMAccountName=%(user)s)'
)

AUTH_LDAP_USER_SEARCH = LDAPSearch(
env.str('AUTH_LDAP_USER_SEARCH_BASE', None),
ldap.SCOPE_SUBTREE,
Expand All @@ -385,7 +383,6 @@
AUTH_LDAP_DOMAIN_PRINTABLE = env.str(
'AUTH_LDAP_DOMAIN_PRINTABLE', AUTH_LDAP_USERNAME_DOMAIN
)

AUTHENTICATION_BACKENDS = tuple(
itertools.chain(
('projectroles.auth_backends.PrimaryLDAPBackend',),
Expand All @@ -398,18 +395,17 @@
AUTH_LDAP2_SERVER_URI = env.str('AUTH_LDAP2_SERVER_URI', None)
AUTH_LDAP2_BIND_DN = env.str('AUTH_LDAP2_BIND_DN', None)
AUTH_LDAP2_BIND_PASSWORD = env.str('AUTH_LDAP2_BIND_PASSWORD', None)
AUTH_LDAP2_START_TLS = env.str('AUTH_LDAP2_START_TLS', False)
AUTH_LDAP2_START_TLS = env.bool('AUTH_LDAP2_START_TLS', False)
AUTH_LDAP2_CA_CERT_FILE = env.str('AUTH_LDAP2_CA_CERT_FILE', None)
AUTH_LDAP2_CONNECTION_OPTIONS = {**LDAP_DEFAULT_CONN_OPTIONS}
if AUTH_LDAP2_CA_CERT_FILE is not None:
if AUTH_LDAP2_CA_CERT_FILE:
AUTH_LDAP2_CONNECTION_OPTIONS[
ldap.OPT_X_TLS_CACERTFILE
] = AUTH_LDAP2_CA_CERT_FILE
AUTH_LDAP2_CONNECTION_OPTIONS[ldap.OPT_X_TLS_NEWCTX] = 0
AUTH_LDAP2_USER_FILTER = env.str(
'AUTH_LDAP2_USER_FILTER', '(sAMAccountName=%(user)s)'
)

AUTH_LDAP2_USER_SEARCH = LDAPSearch(
env.str('AUTH_LDAP2_USER_SEARCH_BASE', None),
ldap.SCOPE_SUBTREE,
Expand All @@ -420,7 +416,6 @@
AUTH_LDAP2_DOMAIN_PRINTABLE = env.str(
'AUTH_LDAP2_DOMAIN_PRINTABLE', AUTH_LDAP2_USERNAME_DOMAIN
)

AUTHENTICATION_BACKENDS = tuple(
itertools.chain(
('projectroles.auth_backends.SecondaryLDAPBackend',),
Expand Down
39 changes: 39 additions & 0 deletions docs/source/app_projectroles_api_django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,45 @@ app. Included are functionalities and classes intended to be used by other
applications when building a SODAR Core based Django site.


.. _app_projectroles_api_django_ui:

Base UI View Classes
====================

Base mixins and classes for building UI views can be found in
``projectroles.views``.

.. currentmodule:: projectroles.views

.. autoclass:: LoginRequiredMixin
:members:
:show-inheritance:

.. autoclass:: LoggedInPermissionMixin
:members:
:show-inheritance:

.. autoclass:: ProjectAccessMixin
:members:
:show-inheritance:

.. autoclass:: ProjectPermissionMixin
:members:
:show-inheritance:

.. autoclass:: ProjectContextMixin
:members:
:show-inheritance:

.. autoclass:: PluginContextMixin
:members:
:show-inheritance:

.. autoclass:: InvalidFormMixin
:members:
:show-inheritance:


Plugins
=======

Expand Down
2 changes: 1 addition & 1 deletion docs/source/app_projectroles_integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ release tag or commit ID.

.. code-block:: console
django-sodar-core==0.13.3
django-sodar-core==0.13.4
Install the requirements for development:

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
# -- Project information -----------------------------------------------------

project = 'SODAR Core'
copyright = '2018-2023, Berlin Institute of Health'
copyright = '2018-2024, Berlin Institute of Health'
author = 'BIH Core Unit Bioinformatics'

# The short X.Y version
version = '0.13'
# The full version, including alpha/beta/rc tags
release = '0.13.3'
release = '0.13.4'


# -- General configuration ---------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion docs/source/dev_project_app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ The most commonly used mixins:
your site, you **must** use this mixing instead of the original one in
Django.
``LoggedInPermissionMixin``
Ensure correct redirection of users on no permissions.
Ensure correct redirection of users on no permissions. Can also be used to
customize messages displayed to the user.
``ProjectPermissionMixin``
Provides a ``Project`` object for permission checking based on URL kwargs.
``ProjectContextMixin``
Expand Down
2 changes: 1 addition & 1 deletion docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ the package is under active development and breaking changes are expected.

.. code-block:: console
pip install django-sodar-core==0.13.3
pip install django-sodar-core==0.13.4
Please note that the django-sodar-core package only installs
:term:`Django apps<Django App>`, which you need to include in a
Expand Down
23 changes: 23 additions & 0 deletions docs/source/major_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,29 @@ older SODAR Core version. For a complete list of changes in current and previous
releases, see the :ref:`full changelog<changelog>`.


v0.13.4 (2024-02-16)
********************

Release Highlights
==================

- Add login message customization
- Add missing LDAP settings in siteinfo
- Improve project invite accept link reuse handling
- Fix remote sync crash with target sites using SODAR Core <0.13.3
- Fix LDAP settings on example site
- General bug fixes and minor updates

Breaking Changes
================

System Prerequisites
--------------------

The minimum Django version has been bumped to v3.2.24. Optional LDAP
requirements in ``requirements/ldap.txt`` have also been upgraded.


v0.13.3 (2023-12-06)
********************

Expand Down
29 changes: 21 additions & 8 deletions projectroles/remote_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import urllib

from copy import deepcopy
from packaging import version

from django.conf import settings
from django.contrib import auth
Expand Down Expand Up @@ -166,13 +167,14 @@ def _add_user(cls, sync_data, user):
return sync_data

@classmethod
def _add_app_setting(cls, sync_data, app_setting, all_defs):
def _add_app_setting(cls, sync_data, app_setting, all_defs, add_user_name):
"""
Add app setting to sync data on source site.
:param sync_data: Sync data to be updated (dict)
:param app_setting: AppSetting object
:param all_defs: All settings defs
:param add_user_name: Add user_name to sync data (boolean)
:return: Updated sync_data (dict)
"""
if app_setting.app_plugin:
Expand All @@ -193,29 +195,38 @@ def _add_app_setting(cls, sync_data, app_setting, all_defs):
'app_plugin': app_setting.app_plugin.name
if app_setting.app_plugin
else None,
'project_uuid': app_setting.project.sodar_uuid
'project_uuid': str(app_setting.project.sodar_uuid)
if app_setting.project
else None,
'user_uuid': app_setting.user.sodar_uuid
if app_setting.user
else None,
'user_name': app_setting.user.username
'user_uuid': str(app_setting.user.sodar_uuid)
if app_setting.user
else None,
'local': local,
}
if add_user_name:
sync_data['app_settings'][str(app_setting.sodar_uuid)][
'user_name'
] = (app_setting.user.username if app_setting.user else None)
return sync_data

# Source Site API functions ------------------------------------------------

def get_source_data(self, target_site):
def get_source_data(self, target_site, req_version=None):
"""
Get user and project data on a source site to be synchronized into a
target site.
:param target_site: RemoteSite object for target site
:param req_version: Request version (string)
:return: Dict
"""
# TODO: Remove user_name workaround when API backwards compatibility to
# <0.13.3 is removed
if not req_version:
from projectroles.views_api import CORE_API_DEFAULT_VERSION

req_version = CORE_API_DEFAULT_VERSION
add_user_name = version.parse(req_version) >= version.parse('0.13.3')
sync_data = {
'users': {},
'projects': {},
Expand All @@ -242,7 +253,9 @@ def get_source_data(self, target_site):
# NOTE: Also provide global settings in case they are not yet set
for a in AppSetting.objects.filter(project=project):
try:
sync_data = self._add_app_setting(sync_data, a, all_defs)
sync_data = self._add_app_setting(
sync_data, a, all_defs, add_user_name
)
except Exception as ex:
logger.error(
'Failed to add app setting "{}.settings.{}" '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
</a>
<a class="dropdown-item text-danger"
href="{% url 'projectroles:remote_site_delete' remotesite=site.sodar_uuid %}">
<i class="iconify" data-icon="mdi:close-thick"></i> Remove Site
<i class="iconify" data-icon="mdi:close-thick"></i> Delete Site
</a>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,27 @@
{% load crispy_forms_filters %}
{% load projectroles_common_tags %}

{% block title %}Confirm Removal of Remote Site{% endblock %}
{% block title %}Confirm Deletion of Remote Site{% endblock %}

{% block projectroles %}

{% get_django_setting 'PROJECTROLES_SITE_MODE' as site_mode %}

<div class="row sodar-subtitle-container">
<h2>Confirm Removal of Remote Site</h2>
<h2>Confirm Deletion of Remote Site</h2>
</div>

<div class="container-fluid sodar-page-container">
<div class="alert alert-warning" role="alert">
Do you really want to remove the remote {{ object.mode | lower }} site
Do you really want to remove the delete {{ object.mode | lower }} site
"<strong>{{ object.name }}</strong>"? Please note that this will also
remove all {% get_display_name 'PROJECT' %} access rules associated
delete all {% get_display_name 'PROJECT' %} access rules associated
with the site!
</div>
<div class="alert alert-warning" role="alert">
If the remote site is still in use, once its entry is deleted it will no
longer be able to sync projects to/from this site.
</div>

<form method="post">
{% csrf_token %}
Expand All @@ -30,7 +34,7 @@ <h2>Confirm Removal of Remote Site</h2>
<i class="iconify" data-icon="mdi:arrow-left-circle"></i> Cancel
</a>
<button type="submit" class="btn btn-danger">
<i class="iconify" data-icon="mdi:close-thick"></i> Remove
<i class="iconify" data-icon="mdi:close-thick"></i> Delete
</button>
</div>
</form>
Expand Down
Loading

0 comments on commit be012e5

Please sign in to comment.