Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/user/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,31 @@ items is enabled or not.

Refer to :ref:`organization_owners` for more information.

``OPENWISP_USERS_SOCIALACCOUNT_ADMIN_NEEDED``
---------------------------------------------

============ =========================================
**type**: ``boolean``
**default**: auto-detected based on ``INSTALLED_APPS``
============ =========================================

Controls whether the social account admin (used to manage OAuth/SAML
application credentials such as client IDs and secrets) is shown in the
Django admin.

By default, this is set to ``True`` automatically when any app whose name
starts with ``allauth.socialaccount.providers.`` is found in
``INSTALLED_APPS``.

Set this to ``True`` explicitly when using custom or third-party allauth
provider apps that do not follow the ``allauth.socialaccount.providers.*``
namespace convention, so that their ``SocialApp`` credentials can be
managed in the Django admin.

.. code-block:: python

OPENWISP_USERS_SOCIALACCOUNT_ADMIN_NEEDED = True

.. _openwisp_users_auth_api:

``OPENWISP_USERS_AUTH_API``
Expand Down
17 changes: 9 additions & 8 deletions openwisp_users/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@
),
)

# if OAuth/SAML is enabled, allow manging keys/secrets
if any(
app.startswith("allauth.socialaccount.providers") for app in settings.INSTALLED_APPS
): # pragma: no cover
SOCIALACCOUNT_ADMIN_NEEDED = True
# otherwise hide the socialaccount admin (not needed)
else:
SOCIALACCOUNT_ADMIN_NEEDED = False
# if any OAuth/SAML provider is enabled, allow managing keys/secrets
SOCIALACCOUNT_ADMIN_NEEDED = getattr(
settings,
"OPENWISP_USERS_SOCIALACCOUNT_ADMIN_NEEDED",
any(
app.startswith("allauth.socialaccount.providers.")
for app in settings.INSTALLED_APPS
),
)
Loading