Skip to content

Commit

Permalink
add siteappsettings plugin and form (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Jan 16, 2025
1 parent 8b38fe9 commit 8282c17
Show file tree
Hide file tree
Showing 19 changed files with 449 additions and 29 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Added
- ``PermissionTestMixin.set_site_read_only()`` helper (#24)
- ``PROJECTROLES_READ_ONLY_MSG`` setting (#24)
- ``SiteReadOnlySettingAjaxView`` Ajax view (#24)
- ``siteappsettings`` site app plugin (#1304)
- ``SiteAppSettingsFormView`` view (#1304)

Changed
-------
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/source/app_projectroles_basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Other Features

Other features in the projectroles app:

- **App settings**: Setting values for project or user specific variables,
- **App settings**: Setting values for project, user or site specific variables,
which can be defined in project and site app plugins
- **Project starring**: Ability for users to star projects as their favourites
- **Project search**: Functionality for searching data within projects using
Expand All @@ -178,7 +178,7 @@ Other features in the projectroles app:
- **Custom user model**: Additions to the standard Django user model
- **Multi-domain LDAP/AD support**: Support for LDAP/AD users from multiple
domains
- **SODAR Timeline integration**: Included but disabled unless the backend app
- **Timeline integration**: Included but disabled unless the backend app
for Timeline is enabled in your Django site


Expand Down
9 changes: 6 additions & 3 deletions docs/source/app_projectroles_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ organizations, etc.
Projectroles Settings
=====================

**Mandatory** projectroles app settings are explained below:
**Mandatory** projectroles Django settings are explained below:

``PROJECTROLES_SITE_MODE``
Site mode for remote project metadata synchronization, either ``SOURCE``
Expand All @@ -204,19 +204,22 @@ Projectroles Settings
``PROJECTROLES_TEMPLATE_INCLUDE_PATH``
Full system path for custom template includes. The default path is
``{APPS_DIR}/templates/include`` (string)
``PROJECTROLES_READ_ONLY_MSG``
Custom message to be displayed if site read-only mode is enabled (string)

Example:

.. code-block:: python
# Projectroles app settings
# Projectroles Django settings
PROJECTROLES_SITE_MODE = env.str('PROJECTROLES_SITE_MODE', 'TARGET')
PROJECTROLES_TARGET_CREATE = env.bool('PROJECTROLES_TARGET_CREATE', True)
PROJECTROLES_INVITE_EXPIRY_DAYS = env.int('PROJECTROLES_INVITE_EXPIRY_DAYS', 14)
PROJECTROLES_SEND_EMAIL = env.bool('PROJECTROLES_SEND_EMAIL', False)
PROJECTROLES_EMAIL_SENDER_REPLY = env.bool('PROJECTROLES_EMAIL_SENDER_REPLY', False)
PROJECTROLES_ENABLE_SEARCH = True
PROJECTROLES_DEFAULT_ADMIN = env.str('PROJECTROLES_DEFAULT_ADMIN', 'admin')
PROJECTROLES_READ_ONLY_MSG = env.str('PROJECTROLES_READ_ONLY_MSG', None)
Optional Projectroles Settings
Expand Down Expand Up @@ -280,7 +283,7 @@ Example:

.. code-block:: python
# Projectroles app settings
# Projectroles Django settings
# ...
PROJECTROLES_EMAIL_HEADER = 'This email has been sent by X from Y'
PROJECTROLES_EMAIL_FOOTER = 'For assistance contact admin@example.com'
Expand Down
36 changes: 34 additions & 2 deletions docs/source/app_projectroles_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Upon logging into a SODAR Core based Django site using default templates and CSS
the general view of your site is split into the following elements:

- **Top navigation bar**: Contains the site logo and title, search element, link
to advanced search, help link and the user dropdown menu.
- **User dropdown menu**: Contains links to user management, admin site and
to advanced search, help link and the user dropdown.
- **User dropdown**: Contains links to user management, admin site and
site-wide apps the user has access to.
- **Project sidebar**: Shortcuts to project apps and project management pages
- **Project navigation**: Project structure breadcrumb (disabled for site apps)
Expand Down Expand Up @@ -364,6 +364,38 @@ out of the LDAP server. Use the ``-h`` flag to see additional options.
$ ./manage.py checkusers
Site App Settings
=================

Site-wide app settings, which are not tied to any project or user, can be
altered by administrators by opening the :guilabel:`Site App Settings` view from
their user dropdown. The form works similarly to the project app settings in the
project creation and updating view.

.. figure:: _static/app_projectroles/site_app_settings.png
:align: center
:scale: 60%

Site app settings view


Site Read-Only Mode
===================

In :guilabel:`Site App Settings`, an administrator can temporarily set the site
to read-only mode. When this mode is enabled, all data on the site is only
accessible for reading. No project or user data should be modifiable. Once
enabled, the mode must be explicitly disabled from the same form.

While the mode is active, an alert will be displayed to all users that site data
can currently not be modified.

Once the mode has been disabled, the alert on existing browser views will be
changed into one prompting the user to reload the current view. Reloading
ensures all the UI elements are active in case not everything is updated on the
client side.


.. _app_projectroles_usage_remote:

Remote Projects
Expand Down
6 changes: 4 additions & 2 deletions docs/source/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ Glossary
including content and functionality from apps in SODAR Core views.

App Settings
Project or user specific settings defined in SODAR Core app plugins.
Different from e.g. Django settings used to configure the web site.
Project, user or site specific settings defined in SODAR Core app
plugins. Different from e.g. Django settings used to configure the web
site in that they can be modified in runtime and from the SODAR Core UI
or REST API.

Backend App
SODAR Core application which is used to provide additional functionality
Expand Down
1 change: 1 addition & 0 deletions docs/source/major_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Release Highlights
==================

- Add site read-only mode
- Add siteappsettings site app plugin
- Add removeroles management command
- Add app setting type constants
- Add app setting definition as objects
Expand Down
2 changes: 1 addition & 1 deletion projectroles/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
default=False,
label='Site read-only mode',
description='Set site in read-only mode. Data altering operations will '
'be prohibited. Mode must be explicitly unset to allow data'
'be prohibited. Mode must be explicitly unset to allow data '
'modification.',
user_modifiable=True,
global_edit=False,
Expand Down
Loading

0 comments on commit 8282c17

Please sign in to comment.