diff --git a/docs/source/app_projectroles_api_django.rst b/docs/source/app_projectroles_api_django.rst index 73e94702..9385c1e5 100644 --- a/docs/source/app_projectroles_api_django.rst +++ b/docs/source/app_projectroles_api_django.rst @@ -106,6 +106,18 @@ General utility functions are stored in ``utils.py``. :members: +Common Use Ajax Views +===================== + +Ajax views intended to be used in a SODAR Core based site are described here. + +.. currentmodule:: projectroles.views_ajax + +.. autoclass:: SidebarContentAjaxView + +.. autoclass:: UserDropdownContentAjaxView + + .. _app_projectroles_api_django_rest: Base REST API View Classes diff --git a/docs/source/app_projectroles_settings.rst b/docs/source/app_projectroles_settings.rst index 27c42d1e..d6329d87 100644 --- a/docs/source/app_projectroles_settings.rst +++ b/docs/source/app_projectroles_settings.rst @@ -386,6 +386,7 @@ This part of the setup is **optional**. ENABLE_LDAP = env.bool('ENABLE_LDAP', False) ENABLE_LDAP_SECONDARY = env.bool('ENABLE_LDAP_SECONDARY', False) LDAP_DEBUG = env.bool('LDAP_DEBUG', False) + LDAP_ALT_DOMAINS = env.list('LDAP_ALT_DOMAINS', None, default=[]) if ENABLE_LDAP: import itertools @@ -406,20 +407,20 @@ This part of the setup is **optional**. 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: - AUTH_LDAP_CONNECTION_OPTIONS[ - ldap.OPT_X_TLS_CACERTFILE - ] = AUTH_LDAP_CA_CERT_FILE + 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_BASE = env.str('AUTH_LDAP_USER_SEARCH_BASE', None) AUTH_LDAP_USER_SEARCH = LDAPSearch( - env.str('AUTH_LDAP_USER_SEARCH_BASE', None), + AUTH_LDAP_USER_SEARCH_BASE, ldap.SCOPE_SUBTREE, AUTH_LDAP_USER_FILTER, ) @@ -428,7 +429,6 @@ This part of the setup is **optional**. AUTH_LDAP_DOMAIN_PRINTABLE = env.str( 'AUTH_LDAP_DOMAIN_PRINTABLE', AUTH_LDAP_USERNAME_DOMAIN ) - AUTHENTICATION_BACKENDS = tuple( itertools.chain( ('projectroles.auth_backends.PrimaryLDAPBackend',), @@ -441,20 +441,22 @@ This part of the setup is **optional**. 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: - AUTH_LDAP2_CONNECTION_OPTIONS[ - ldap.OPT_X_TLS_CACERTFILE - ] = AUTH_LDAP2_CA_CERT_FILE + 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_BASE = env.str( + 'AUTH_LDAP2_USER_SEARCH_BASE', None + ) AUTH_LDAP2_USER_SEARCH = LDAPSearch( - env.str('AUTH_LDAP2_USER_SEARCH_BASE', None), + AUTH_LDAP2_USER_SEARCH_BASE, ldap.SCOPE_SUBTREE, AUTH_LDAP2_USER_FILTER, ) @@ -463,7 +465,6 @@ This part of the setup is **optional**. AUTH_LDAP2_DOMAIN_PRINTABLE = env.str( 'AUTH_LDAP2_DOMAIN_PRINTABLE', AUTH_LDAP2_USERNAME_DOMAIN ) - AUTHENTICATION_BACKENDS = tuple( itertools.chain( ('projectroles.auth_backends.SecondaryLDAPBackend',), diff --git a/docs/source/major_changes.rst b/docs/source/major_changes.rst index d6a10bb6..7df74b7c 100644 --- a/docs/source/major_changes.rst +++ b/docs/source/major_changes.rst @@ -176,6 +176,8 @@ REST API View Changes The following breaking changes have been made into specific REST API endpoints in this release: +``ProjectRetrieveAPIView`` (``project/api/retrieve/``) + Add ``full_title`` field to return data. Also affects list view. ``ProjectSettingRetrieveAPIView`` (``project/api/settings/retrieve/``) Rename ``app_name`` parameter to ``plugin_name``. ``ProjectSettingSetAPIView`` (``project/api/settings/set/``) diff --git a/projectroles/views_ajax.py b/projectroles/views_ajax.py index 4a6adfa9..adbe6c57 100644 --- a/projectroles/views_ajax.py +++ b/projectroles/views_ajax.py @@ -460,11 +460,22 @@ def get(self, request, *args, **kwargs): class SidebarContentAjaxView(SODARBaseProjectAjaxView): """ - Ajax view for delivering sidebar content for specific projects. - All returned links are nor active by default. To get correct "active" + Return sidebar and project dropdown links to be displayed in a client-side + application. This can be used as an alternative to rendering server-side + sidebar and project dropdonwn elements. + + All returned links are inactive by default. To get correct "active" attribute for each of the links, you must provide the app_name as GET parameter. The app_name refers to the current app name (request.resolver_match.app_name). + + Return data (for each link): + + - ``name``: Internal ID (string) + - ``url``: View URL (string) + - ``label``: Text label to be displayed for link (string) + - ``icon``: Icon namespace and ID (string, example: "mdi:cube") + - ``active``: Whether link is currently active (boolean) """ permission_required = 'projectroles.view_project' @@ -482,11 +493,21 @@ def get(self, request, *args, **kwargs): class UserDropdownContentAjaxView(SODARBaseAjaxView): """ - Ajax view for delivering user dropdown content for the navbar. - All returned links are nor active by default. To get correct "active" + Return user dropdown links to be displayed in a client-side application. + This can be used as an alternative to rendering the server-side dropdown. + + All returned links are inactive by default. To get correct "active" attribute for each of the links, you must provide the app_name as GET parameter. The app_name refers to the current app name (request.resolver_match.app_name). + + Return data (for each link): + + - ``name``: Internal ID (string) + - ``url``: View URL (string) + - ``label``: Text label to be displayed for link (string) + - ``icon``: Icon namespace and ID (string, example: "mdi:cube") + - ``active``: Whether link is currently active (boolean) """ permission_classes = [IsAuthenticated]