Django GPG: Setting options changes
Remove the SIGNATURES_GPG_HOME settings. The GPG keys are no longer stored in disk but in the database itself making this setting obsolete. This changed happened several versions ago and this removal doesn't affect any code path. Add two new settings to the app: SIGNATURES_GPG_BACKEND and SIGNATURES_GPG_BACKEND_ARGUMENTS. These settings allow changing the GPG backend that the app will use. Remove the settings SIGNATURES_GPG_PATH. The path to the GPG binary is now passed via the SIGNATURES_GPG_BACKEND_ARGUMENTS. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
35
HISTORY.rst
35
HISTORY.rst
@@ -111,6 +111,41 @@
|
||||
The maximum size of the document cache is controlled
|
||||
by the new DOCUMENTS_CACHE_MAXIMUM_SIZE setting.
|
||||
This setting defaults to 500 megabytes.
|
||||
- Add support for post edit callbacks to settings. This
|
||||
callback willl execute when a settings's value is changed.
|
||||
- Switch to full app paths. Instead of inserting the path
|
||||
of the apps into the Python app, the apps are now
|
||||
referenced by their full import path. This avoid app name
|
||||
clashes with external or native Python libraries.
|
||||
Example: Mayan statistics app vs. Python new statistics library.
|
||||
Every app reference is now prepended with 'mayan.apps'.
|
||||
Existing config.yml files need to be updated manually.
|
||||
- Added a colorized console log formatter. New log formatter
|
||||
that colors the output depending on the log level of the
|
||||
message. The default palette handles: INFO, SUCCESS, ERROR,
|
||||
DEBUG and CRITICAL.
|
||||
- Decreased the thumbnail fade-in duration. Reduce the
|
||||
document thumbnail fadein animation length to speed up
|
||||
display of resolved thumbnails. Seems to reduce browser
|
||||
load in FireFox.
|
||||
- Document stubs are now filtered from the search results.
|
||||
- Replaced deprecated string_concat in preparation for an
|
||||
eventual Django 2.x upgrade.
|
||||
- Removed the converter's base64 image support as it was
|
||||
no longer being used by any stock app.
|
||||
- Removed the SIGNATURES_GPG_HOME settings. The GPG keys
|
||||
are no longer stored in disk but in the database itself
|
||||
making this setting obsolete. This changed happened
|
||||
several versions ago and this removal doesn't affect
|
||||
any code path.
|
||||
- Added two new settings to the django_gpg app:
|
||||
SIGNATURES_GPG_BACKEND and SIGNATURES_GPG_BACKEND_ARGUMENTS.
|
||||
These settings allow changing the GPG backend that the
|
||||
app will use.
|
||||
- Removed the settings SIGNATURES_GPG_PATH. The path to the
|
||||
GPG binary is now passed via the
|
||||
SIGNATURES_GPG_BACKEND_ARGUMENTS.
|
||||
|
||||
|
||||
3.1.9 (2018-11-01)
|
||||
==================
|
||||
|
||||
@@ -10,7 +10,8 @@ from mayan.apps.common.utils import mkdtemp
|
||||
|
||||
|
||||
class GPGBackend(object):
|
||||
def __init__(self, **kwargs):
|
||||
def __init__(self, gpg_path, **kwargs):
|
||||
self.gpg_path = gpg_path
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
||||
@@ -76,7 +77,7 @@ class PythonGNUPGBackend(GPGBackend):
|
||||
os.chmod(temporary_directory, 0x1C0)
|
||||
|
||||
gpg = gnupg.GPG(
|
||||
gnupghome=temporary_directory, gpgbinary=self.kwargs['binary_path']
|
||||
gnupghome=temporary_directory, gpgbinary=self.gpg_path
|
||||
)
|
||||
|
||||
result = function(gpg=gpg, **kwargs)
|
||||
|
||||
@@ -2,6 +2,9 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
DEFAULT_GPG_PATH = '/usr/bin/gpg1'
|
||||
DEFAULT_SETTING_GPG_BACKEND = 'mayan.apps.django_gpg.classes.PythonGNUPGBackend'
|
||||
|
||||
KEY_TYPES = {
|
||||
'pub': _('Public'),
|
||||
'sec': _('Secret'),
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
from django.utils.module_loading import import_string
|
||||
|
||||
from .settings import setting_gpg_path
|
||||
|
||||
# TODO: This will become an setting option in 2.2
|
||||
SETTING_GPG_BACKEND = 'mayan.apps.django_gpg.classes.PythonGNUPGBackend'
|
||||
|
||||
gpg_backend = import_string(SETTING_GPG_BACKEND)(
|
||||
binary_path=setting_gpg_path.value
|
||||
from .settings import (
|
||||
setting_gpg_backend, setting_gpg_backend_arguments
|
||||
)
|
||||
|
||||
gpg_backend = import_string(
|
||||
dotted_path=setting_gpg_backend.value
|
||||
)(**setting_gpg_backend_arguments.value)
|
||||
|
||||
@@ -7,18 +7,23 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
|
||||
from .literals import DEFAULT_GPG_PATH, DEFAULT_SETTING_GPG_BACKEND
|
||||
|
||||
namespace = Namespace(name='django_gpg', label=_('Signatures'))
|
||||
setting_gpg_home = namespace.add_setting(
|
||||
global_name='SIGNATURES_GPG_HOME',
|
||||
default=os.path.join(settings.MEDIA_ROOT, 'gpg_home'),
|
||||
help_text=_(
|
||||
'Home directory used to store keys as well as configuration files.'
|
||||
),
|
||||
is_path=True
|
||||
|
||||
setting_gpg_backend = namespace.add_setting(
|
||||
default=DEFAULT_SETTING_GPG_BACKEND,
|
||||
global_name='SIGNATURES_GPG_BACKEND', help_text=_(
|
||||
'Path to the GPG class to use when managing keys.'
|
||||
)
|
||||
)
|
||||
setting_gpg_backend_arguments = namespace.add_setting(
|
||||
global_name='SIGNATURES_GPG_BACKEND_ARGUMENTS',
|
||||
default={
|
||||
'gpg_path': DEFAULT_GPG_PATH
|
||||
}, help_text=_(
|
||||
'Arguments to pass to the SIGNATURES_GPG_BACKEND. '
|
||||
)
|
||||
setting_gpg_path = namespace.add_setting(
|
||||
global_name='SIGNATURES_GPG_PATH', default='/usr/bin/gpg1',
|
||||
help_text=_('Path to the GPG binary.'), is_path=True
|
||||
)
|
||||
setting_keyserver = namespace.add_setting(
|
||||
global_name='SIGNATURES_KEYSERVER', default='pool.sks-keyservers.net',
|
||||
|
||||
Reference in New Issue
Block a user