Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/series/4.0'
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Rosario <[email protected]>
  • Loading branch information
Roberto Rosario committed Oct 19, 2021
2 parents 0c20c86 + 2f9f662 commit ecde5b6
Show file tree
Hide file tree
Showing 27 changed files with 533 additions and 86 deletions.
30 changes: 30 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,42 @@
- Add document template state action API endpoints. Closes GitLab issue #1043
Thanks to Ludovic Anterieur (@lanterieur) for the request.
- Pin jsonschema to version 3.2.0 to avoid errors with

4.0.17 (2021-10-18)
===================
- Backport workaround for swagger-spec-validator dependency
bug. Pin jsonschema to version 3.2.0 to avoid errors with
swagger-spec-validator 2.7.3. swagger-spec-validator does not specify a
version for jsonschema
(https://github.com/Yelp/swagger_spec_validator/blob/master/setup.py#L17),
which installs the latest version 4.0.1. This version removes
``jsonschema.compat`` still used by swagger-spec-validator.
- Add ``project_url`` to the Python setup file.
- Add support for ``COMMON_EXTRA_APPS_PRE``. This setting works
like ``COMMON_EXTRA_APPS`` but installs the new apps before the default
apps. This allows the extra apps to override templates and other system
data.
- Fix usage of ``.user.has_usable_password``. Use as a method not a flag.
Fixes the `Change Password` link appearing even when using external
authentication.
- Support blank app URL namespaces. These are used to register the
``urlpatterns`` of encapsulated libraries as top level named URLs.
- Add a stacked Font Awesome icon class.
- Ensure ``MAYAN_GUNICORN_TEMPORARY_DIRECTORY`` is exported and available to
``supervisord``.
- Always change the owner of ``/var/lib/mayan/``. Ensure that the ``mayan``
operating system user can always read and write from and to the mounted
volume.
- Fix asset image caching. Closes GitLab issue #1047 for series 4.0.
Thanks to Ryan Showalter (@ryanshow) for the report and debug information.
- Expand help text of ``ORGANIZATIONS_INSTALLATION_URL`` and
``ORGANIZATIONS_URL_BASE_PATH`` settings. GitLab issue #1045. Thanks to
bw (@bwakkie) for the report.
- Create the ``user_settings`` folder on upgrades too.
- Improve initial setup folder creation error logic. Add keyword arguments.
Use storages app ``touch`` function.
- Ensure only one document version is active when migrating from version 3.5.
Forum topic 9430. Thanks to forum user @woec for the report.

4.0.16 (2021-09-29)
===================
Expand Down
132 changes: 132 additions & 0 deletions docs/releases/4.0.17.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
Version 4.0.17
==============

Released: October 18, 2021

Status: Maintenance

Changes
--------


Appearance
^^^^^^^^^^

A new icon driver was added to support stacked Font Awesome icons.


Authentication
^^^^^^^^^^^^^^

The usage ``.user.has_usable_password`` was fixed. This solves the
"Change Password" link not being disabled when using external authentication.


Common
^^^^^^

Support was added for ``COMMON_EXTRA_APPS_PRE``. This setting works like
``COMMON_EXTRA_APPS`` but installs the new apps before the default
apps. This allows the extra apps to override templates and other system
data.

Support for blank/empty app URL namespaces was added. These are used to
register the ``urlpatterns`` of encapsulated libraries as top level named
URLs.

The ``user_settings`` folder is now created and initialized on upgrades too.

The error handling logic of the initial folder creation was improved.


Converter
^^^^^^^^^

Asset image cache creation was fixed. Allows using assets for decorations
in all cases.


Docker
^^^^^^

The ``MAYAN_GUNICORN_TEMPORARY_DIRECTORY`` environment variable is now
exported and available to ``supervisord`` in all cases.

The owner of the ``/var/lib/mayan/`` is now always changed on container
startup. This ensures that the ``mayan`` operating system user can always
read and write from and to the mounted volume.


Documents
^^^^^^^^^

The migration from version 3.5.x to 4.0.x was improved to ensure only one
document version per document is active after the migration.


Organizations
^^^^^^^^^^^^^

The help texts of the ``ORGANIZATIONS_INSTALLATION_URL`` and
``ORGANIZATIONS_URL_BASE_PATH`` settings were expanded to better explain
their functions.


REST API
^^^^^^^^

A workaround for a ``swagger-spec-validator`` dependency bug was backported
from version 4.1. The library ``jsonschema`` is now pinned to version 3.2.0
to avoid errors with ``swagger-spec-validator`` 2.7.3.
``swagger-spec-validator`` does not specify a version for ``jsonschema``
(https://github.com/Yelp/swagger_spec_validator/blob/master/setup.py#L17),
which installs the latest version of ``jsonschema``, 4.0.1. This version
removes ``jsonschema.compat`` still used by ``swagger-spec-validator``.


Other
^^^^^

- Add ``project_url`` attribute to the Python setup file.
- Move the filesystem ``touch`` function to the storages app.
- Add Redis restart step to the upgrade instructions.


Removals
--------

- None


Upgrade process
---------------

.. include:: partials/upgrade-3.5-4.0.txt


Troubleshooting
---------------

If you observe the errors:

- ``mayan.apps.file_caching.models.CachePartitionFile.DoesNotExist: CachePartitionFile matching query does not exist.``

or:

- ``FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/mayan/document_file_storage/...``

follow the solution outlined in the troubleshooting section: :ref:`troubleshooting-version-4.0`


Backward incompatible changes
-----------------------------

- None


Issues closed
-------------

- None

.. _PyPI: https://pypi.python.org/pypi/mayan-edms/
1 change: 1 addition & 0 deletions docs/releases/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ versions of the documentation contain the release notes for any later releases.
:maxdepth: 1

4.1
4.0.17
4.0.16
4.0.15
4.0.14
Expand Down
29 changes: 11 additions & 18 deletions docs/releases/partials/upgrade-3.5-4.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,25 @@ Direct deployment

.. code-block:: bash

sudo -u |DEFAULT_OS_USERNAME| |MAYAN_PIP_BIN| install -U pip
sudo --user=|DEFAULT_OS_USERNAME| |MAYAN_PIP_BIN| install --upgrade pip


#. Remove deprecated requirements:

.. code-block:: bash

sudo -u |DEFAULT_OS_USERNAME| curl |SOURCE_CODE_REPOSITORY|raw/master/removals.txt -o /tmp/removals.txt \
&& sudo -u |DEFAULT_OS_USERNAME| |MAYAN_PIP_BIN| uninstall -y -r /tmp/removals.txt
sudo --user=|DEFAULT_OS_USERNAME| curl |SOURCE_CODE_REPOSITORY|raw/master/removals.txt --output /tmp/removals.txt \
&& sudo --user=|DEFAULT_OS_USERNAME| |MAYAN_PIP_BIN| uninstall --requirement /tmp/removals.txt --yes


#. Update the Mayan EDMS Python package:

.. code-block:: bash

sudo -u |DEFAULT_OS_USERNAME| |MAYAN_PIP_BIN| install mayan-edms==|MAYAN_VERSION|
sudo --user=|DEFAULT_OS_USERNAME| |MAYAN_PIP_BIN| install mayan-edms==|MAYAN_VERSION|

the requirements will also be updated automatically.


#. Create the ``|DEFAULT_USER_SETTINGS_FOLDER|`` folder inside the ``media``
folder and convert it into a Python module. This folder is used for
custom setting modules. Adjust the path of the ``media`` folder for your
installation:

.. code-block:: bash

sudo -u |DEFAULT_OS_USERNAME| mkdir --parents |MAYAN_MEDIA_ROOT||DEFAULT_USER_SETTINGS_FOLDER|
sudo -u |DEFAULT_OS_USERNAME| touch |MAYAN_MEDIA_ROOT||DEFAULT_USER_SETTINGS_FOLDER|__init__.py


#. Update the Redis configuration to serve at least 3 databases:

Replace:
Expand All @@ -74,6 +62,11 @@ Direct deployment

databases 3

#. Restart Redis for the changes to take effect:

.. code-block:: bash

sudo systemctl restart redis

#. Edit the config file at ``|MAYAN_MEDIA_ROOT|config.yml``:

Expand All @@ -99,7 +92,7 @@ Direct deployment

.. code-block:: bash

sudo -u |DEFAULT_OS_USERNAME| MAYAN_MEDIA_ROOT=|MAYAN_MEDIA_ROOT| \
sudo --user=|DEFAULT_OS_USERNAME| MAYAN_MEDIA_ROOT=|MAYAN_MEDIA_ROOT| \
|MAYAN_BIN| platformtemplate supervisord | sudo sh -c "cat > |MAYAN_SUPERVISOR_CONF|"


Expand All @@ -114,7 +107,7 @@ Direct deployment

.. code-block:: bash

sudo -u |DEFAULT_OS_USERNAME| MAYAN_MEDIA_ROOT=|MAYAN_MEDIA_ROOT| \
sudo --user=|DEFAULT_OS_USERNAME| MAYAN_MEDIA_ROOT=|MAYAN_MEDIA_ROOT| \
|MAYAN_BIN| performupgrade


Expand Down
14 changes: 14 additions & 0 deletions mayan/apps/appearance/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ def get_context(self):
}


class FontAwesomeStackDriver(IconDriver):
name = 'fontawesome-stack'
template_name = 'appearance/icons/font_awesome_stack.html'

def __init__(self, data):
self.data = data

def get_context(self):
return {
'data': self.data,
}


class Icon:
def __init__(self, driver_name, **kwargs):
self.kwargs = kwargs
Expand All @@ -136,3 +149,4 @@ def render(self, **kwargs):
IconDriver.register(driver_class=FontAwesomeDualDriver)
IconDriver.register(driver_class=FontAwesomeLayersDriver)
IconDriver.register(driver_class=FontAwesomeMasksDriver)
IconDriver.register(driver_class=FontAwesomeStackDriver)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<span class="fa-stack" style="margin-left: -11px; margin-right: -5px; ">
{% for entry in data %}
{% if entry.type == 'icon' %}
<i class="{{ entry.class }} fa-stack-1x" data-fa-transform="grow-3"></i>
{% else %}
<strong class="fa-stack-1x" style="color:white; font-size: 50%; margin-top: 1px;">{{ entry.text }}</strong>
{% endif %}
{% endfor %}
</span>
18 changes: 12 additions & 6 deletions mayan/apps/authentication/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,25 @@

def _condition_user_has_usable_password_and_can_change_password(user):
if user.is_authenticated:
return user.has_usable_password and not user.user_options.block_password_change
return user.has_usable_password() and not user.user_options.block_password_change
else:
return False


def condition_user_has_usable_password_and_can_change_password(context, resolved_object):
user = context['request'].user

return _condition_user_has_usable_password_and_can_change_password(user=user)
return _condition_user_has_usable_password_and_can_change_password(
user=user
)


def condition_user_has_usable_password_and_can_change_password_and_is_not_admin(context, resolved_object):
return _condition_user_has_usable_password_and_can_change_password(user=resolved_object) and condition_user_is_not_admin(context=context, resolved_object=resolved_object)
return _condition_user_has_usable_password_and_can_change_password(
user=resolved_object
) and condition_user_is_not_admin(
context=context, resolved_object=resolved_object
)


link_logout = Link(
Expand All @@ -49,7 +55,7 @@ def condition_user_has_usable_password_and_can_change_password_and_is_not_admin(
text=_('Set password'), view='authentication:user_multiple_set_password'
)
link_user_set_password = Link(
args='object.id', condition=condition_user_has_usable_password_and_can_change_password_and_is_not_admin, icon=icon_password_change,
permissions=(permission_user_edit,), text=_('Set password'),
view='authentication:user_set_password'
args='object.id', condition=condition_user_has_usable_password_and_can_change_password_and_is_not_admin,
icon=icon_password_change, permissions=(permission_user_edit,),
text=_('Set password'), view='authentication:user_set_password'
)
10 changes: 9 additions & 1 deletion mayan/apps/common/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,18 @@ def configure_urls(self):
traceback.print_exception(*exc_info)
raise exception
else:
# Allow blank namespaces. These are used to register the
# urlpatterns of encapsulated libraries as top level named
# URLs.
if self.app_namespace is not None:
app_namespace = self.app_namespace
else:
app_namespace = self.name

mayan_urlpatterns += (
url(
regex=r'^{}'.format(top_url), view=include(
(app_urlpatterns, self.app_namespace or self.name)
(app_urlpatterns, app_namespace)
)
),
)
Expand Down
1 change: 1 addition & 0 deletions mayan/apps/common/literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
DEFAULT_COMMON_COLLAPSE_LIST_MENU_OBJECT = False
DEFAULT_COMMON_DISABLED_APPS = settings.COMMON_DISABLED_APPS
DEFAULT_COMMON_EXTRA_APPS = settings.COMMON_EXTRA_APPS
DEFAULT_COMMON_EXTRA_APPS_PRE = settings.COMMON_EXTRA_APPS_PRE
DEFAULT_COMMON_HOME_VIEW = 'common:home'
DEFAULT_COMMON_HOME_VIEW_DASHBOARD_NAME = 'user'
DEFAULT_COMMON_PROJECT_TITLE = mayan.__title__
Expand Down
Loading

0 comments on commit ecde5b6

Please sign in to comment.