Released: February 12, 2022
Status: Stable
The authentication app was refactored to add several major changes. The first major change was adding support for multi factor authentication. The implementation builds on top of Django's authentication code to provide a secure but at the same time extensible framework with features such as unlimited number of authentication factors and forms for login.
With the addition of multi factor authentication, it was possible to add two step authentication using time based one time password (TOTP) was added. This implementation works in a very similar as most implementations where a random secret is generated and presented as a QR code that is scanned using mobile apps or hardware tokens. During the next login, a token representing the secret will be required to complete the login process.
TOTP authentication can be disabled at anytime either by the user or by an administrator. This can be done via the user interface or via new management commands.
These commands are:
authentication_otp_disable
disable OTP authentication for a userauthentication_otp_initialize
initialize the OTP state data for
all users. This command is for debugging and maintenance in case the
database migration does not correctly initialize the OTP state data
for existing users.authentication_otp_status
display the OTP status of a userThe new authentication app allows for the easy creation of
authentication workflows via backends. These are classes passed via the
setting AUTHENTICATION_BACKEND
, which must be the dotted path to the
backend used to process user authentication and
AUTHENTICATION_BACKEND_ARGUMENTS
which is an optional YAML structure
to pass to the authentication backend.
The authentication backends are able to control and customize the entire login process, including the forms presented to the user. Authentication backends can use mixins and can be subclassed to mix and expand their capabilities.
Included authentication mixins: - AuthenticationBackendRememberMeMixin
Included authentication backends: -
AuthenticationBackendModelDjangoDefault
-
AuthenticationBackendModelEmailPassword
-
AuthenticationBackendModelUsernamePassword
Apps define authentication backends in the module
authentication_backends.py
.
With this new system the old EmailAuthBackend
authentication class is
removed. The same function is now accomplished by the
AuthenticationBackendModelEmailPassword
backend.
To enable TOTP authentication, set AUTHENTICATION_BACKEND
to
mayan.apps.authentication_otp.authentication_backends.AuthenticationBackendModelUsernamePasswordTOTP
for username and TOTP login. For email and TOTP logins use
mayan.apps.authentication_otp.authentication_backends.AuthenticationBackendModelEmailPasswordTOTP
.
Django 2.2 is approaching end of life status, as such this version used Django 3.2 with the next LTS release and will be supported until 2024.
Other packages were updated:
The default version of PostgreSQL is now 12.9. Follow the required database procedure to migrate your data from the existing version to the new default version. This process requires creating a dump of your existing data and then importing it to the new version.
The .env
and env_file
were unified as a single .env
file. Ensure
you copy any custom changes your existing env_file
before updating
your deployment.
The internal Docker network used for the deployment was renamed from
bridge
to mayan
. This helps differentiate the network now that
multiple networks are supported.
The Docker Compose was moved from Debian 10 slim to Debian 11 slim. The build image was moved from Python 3.8-slim to Python 3.11-slim.
The command run_initialsetup_or_performupgrade
was added to facilitate
installations and upgrades in custom Docker deployments.
The default Docker Compose was updated to support more customization. The Redis container is now controlled by its own profile, this allows using external Redis servers is desired.
The deployment now defaults to using RabbitMQ a the message broker.
The RabbitMQ image tag was changed from 3.9-alpine to 3.9-management-alpine. This image includes the management plugins which aid in debugging and optimization of custom deployments.
The Traefik configuration was improved and supports more options. Additionally, the Traefik profile now runs in its own Docker network.
A Docker Compose password randomizer script is now available.
The necessary LDAP libraries and Python modules are now included in the default Docker image. User wanting to use LDAP still need to create a custom settings file but do not need to install the LDAP libraries or worry about dependency conflicts anymore.
The error logger now includes a global error log list view in the tool menu. This view will display error log messages for all objects in the system that have been converted to the unified error logger.
The events "mailing profile created" and "mailing profile edited" were added, enable as workflow triggers and for subscription.
A regular expression metadata validator and parser were added. These offer unlimited verification of user input and transformation of user input.
Support for passing arguments to the metadata validators and parsers was added.
The model field used to store the path to the parser and validator was extended to 224 characters.
Support for MIME type detection backends was added. This feature allows customizing the MIME type detection. Additionally, arguments can be passed to the MIME type backends for things like hardcoding file magic numbers for esoteric file types.
The previous MIME type detection code which used the Python Magic library is now the default backend.
In addition to the default backend two new backends were added:
mimetype
backend.file
command line binary backend.The batch API feature was updated to add support for binary content. Binary content is now returned in the response as a base64 encoded string.
Support for dynamic field API serialization was added. This feature allows specifying which fields are to be included in the response. This can be done by specifying which fields to include or which to exclude.
To support dynamic API fields, two URL query keys were added. These keys
are _fields_only
and _fields_exclude
. Nested objects are supported
using the double underscore (__
) separator.
The serialized first page of each document version and document file is now included in the serialized document object. This helps reduce API requests when attempting to display document thumbnails via the API.
For objects that are children objects, the parent object IDs are now
added to the serializer. The layout is {parent object name}_id
. A few
objects already provided the parent ID but with a different schema.
These objects also now have the parent ID field with the new schema even
if it displays a duplicate value. The old ID field is now deprecated and
will be removed in version 5.0.
The Whoosh backend has been completed and is now the default search engine backend.
The search indexing code was improve and now all object fields are indexed on creation, update or deletion.
Several management commands were added. These are:
search_index_objects
to trigger the queuing of search models from the CLI.search_status
to show indexing status of the search backend.search_initialize
andsearch_upgrade
. These are called automatically after the initial setup and after upgrades, but were added to aid in maintenance.
Add new settings called SEARCH_INDEXING_CHUNK_SIZE
was added to allow
setting the number of objects to prepare when performing bulk search
indexing.
In addition to the Whoosh search backend, support was also added for ElasticSearch.
A new queue was added called search_slow
for the long running tasks of
search indexing.
The sources that provide thumbnails now do so using the unified image
serving code from the converter app. In addition to reducing duplicated
code, the sources app also benefits from the improvements in image
serving from the converter app like the adoption of
StreamingHttpResponse
to serve previews as streamed responses and
allowing showing previews for office documents in the staging folders.
Support was added for inclusion and exclusion regular expressions for watch folders.
Two new settings were added to allow controlling the interval at which expired download files and shared uploaded files are cleaned up. These are:
DOWNLOAD_FILE_EXPIRATION_INTERVAL
which defaults to 2 days.SHARED_UPLOADED_FILE_EXPIRATION_INTERVAL
which defaults to 7 days.
All user menu entries were reorganized to be located under a "User details" link.
Support was added for editing the locale profile of users as well as the theme settings.
Internally, the views for users, current users and superusers were unified resulting in a reduction of code, easier maintenance, and made the user view easier to extend.
New user events named "User theme edited" and "User locale profile edited" were added events.
The workflow template transitions were exposed via the API.
Support was added for launching workflows from the API.
A small change was made to the workflow template permissions to require the view permission instead of the edit permission when attempting to view child objects of a workflow template.
The workflow state now has a column displaying all created actions labels separated by a comma.
ResolverRelatedManager
.traces_sample_rate
from 0.25 to
0.05.parse_range
utility from the documents app to the common
app.prefetch-multiplier
]{.pre} of 1
.docker-dockerfile-update
]{.pre} target to the Docker
makefile.id
instead of name
.StoredEvent
model.KeyError
instead
of masking the exception and returning an error message. It is
now up to the calling code which action to take when the event
type ID is not correct.literals.TEXT_UNKNOWN_EVENT_ID
.ObjectActionAPIView
view to allow passing extra context
to serializers.DynamicSerializerField
to display the
canonical serializer of the model when referenced by other objects.DetailForm
usage for the new interface.resolver_extra_kwargs
.ResolverRelatedManager
.ResolverRelatedManager
. Use Django's internal
get_fields_from_path
for related field introspection. Support
more related field cases.TemporaryDirectory
for test search backend. Do automatic
clean up of the temporary index directory.any_to_bool
function to the common app.get_resolved_field_map
and get_search_model_fields
to
the SearchBackend
class.match_all
.task_reindex_backend
to abstract backend
reindexing.task_deindex_instance
and task_index_instance
tasks.id
field as a search field for all
search models.DynamicSearchRetry
.Renaming of the mimetype
app to mime_types
.
Removal of the .api.get_mimetype
function. The process now
requires instantiating the configured MIME type backend and calling
the get_mime_type
method:
from mayan.apps.mime_types.classes import MIMETypeBackend MIMETypeBackend.get_backend_instance().get_mime_type(...)
Search model names are now specified in lower case in the user interface URL or in the search API URL.