Skip to content

Commit

Permalink
cleanup docs (#1389)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Jun 27, 2024
1 parent c2ca153 commit 99c905b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 20 deletions.
12 changes: 12 additions & 0 deletions docs/source/app_projectroles_api_django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 17 additions & 16 deletions docs/source/app_projectroles_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
)
Expand All @@ -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',),
Expand All @@ -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,
)
Expand All @@ -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',),
Expand Down
2 changes: 2 additions & 0 deletions docs/source/major_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/<uuid:project>``)
Add ``full_title`` field to return data. Also affects list view.
``ProjectSettingRetrieveAPIView`` (``project/api/settings/retrieve/<uuid:project>``)
Rename ``app_name`` parameter to ``plugin_name``.
``ProjectSettingSetAPIView`` (``project/api/settings/set/<uuid:project>``)
Expand Down
29 changes: 25 additions & 4 deletions projectroles/views_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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]
Expand Down

0 comments on commit 99c905b

Please sign in to comment.