Fix GitLab issue #484. Thanks to @Bebef for the report and debug information.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-07-01 23:59:15 -04:00
parent 89a7b9d6b5
commit 29b680ef84
3 changed files with 26 additions and 14 deletions

View File

@@ -621,6 +621,8 @@ Bugs fixed or issues closed
* `GitLab issue #474 <https://gitlab.com/mayan-edms/mayan-edms/issues/474>`_ Provide option to serve Mayan EDMS without a webserver (using Tornado o similar).
* `GitLab issue #480 <https://gitlab.com/mayan-edms/mayan-edms/issues/480>`_ Wrong Environment Variables names in documentation
* `GitLab issue #481 <https://gitlab.com/mayan-edms/mayan-edms/issues/481>`_ IMAP sources with metadata not working in 3.0rc1
* `GitLab issue #484 <https://gitlab.com/mayan-edms/mayan-edms/issues/484>`_ Document upload wizard only works as admin
* `GitHub issue #264 <https://github.com/mayan-edms/mayan-edms/issues/264>`_ migrate fails on document_states 0004_workflow_internal_name
* `GitHub issue #269 <https://github.com/mayan-edms/mayan-edms/issues/269>`_ Lack of authentication for document previews

View File

@@ -9,6 +9,7 @@ from django.utils.translation import ugettext_lazy as _
from sources.wizards import WizardStep
from .forms import CabinetListForm
from .permissions import permission_cabinet_add_document
class WizardStepCabinets(WizardStep):
@@ -28,6 +29,7 @@ class WizardStepCabinets(WizardStep):
def get_form_kwargs(self, wizard):
return {
'help_text': _('Cabinets to which the document will be added.'),
'permission': permission_cabinet_add_document,
'user': wizard.request.user
}

View File

@@ -19,18 +19,31 @@ class WizardStep(object):
_registry = {}
_deregistry = {}
@classmethod
def deregister(cls, step):
cls._deregistry[step.name] = step
@classmethod
def deregister_all(cls):
for step in cls.get_all():
cls.deregister(step=step)
@classmethod
def done(cls, wizard):
return {}
@classmethod
def get(cls, name):
return cls._registry[name]
for step in cls.get_all():
if name == step.name:
return step
@classmethod
def get_all(cls):
return sorted(
cls._registry.values(), key=lambda x: x.number
[
step for step in cls._registry.values() if step.name not in cls._deregistry
], key=lambda x: x.number
)
@classmethod
@@ -56,11 +69,6 @@ class WizardStep(object):
@classmethod
def register(cls, step):
if step in cls._deregistry:
# This step has been marked for reregistration before it was
# registered
return
if step.name in cls._registry:
raise Exception('A step with this name already exists: %s' % step.name)
@@ -70,13 +78,12 @@ class WizardStep(object):
cls._registry[step.name] = step
@classmethod
def deregister(cls, step):
try:
cls._registry.pop(step.name)
except KeyError:
cls._deregistry[step.name] = step
else:
cls._deregistry[step.name] = step
def reregister(cls, name):
cls._deregistry.pop(name)
@classmethod
def reregister_all(cls):
cls._deregistry = {}
@classmethod
def step_post_upload_process(cls, document, querystring=None):
@@ -125,6 +132,7 @@ class DocumentCreateWizard(SessionWizardView):
form_list = WizardStep.get_choices(attribute_name='form_class')
condition_dict = dict(WizardStep.get_choices(attribute_name='condition'))
result = self.__class__.get_initkwargs(form_list=form_list, condition_dict=condition_dict)
self.form_list = result['form_list']
self.condition_dict = result['condition_dict']