From d041f205fbc5982d0d021c3592eb8233c58ac187 Mon Sep 17 00:00:00 2001 From: David Paez Date: Wed, 5 Apr 2017 23:47:58 -0500 Subject: [PATCH 01/11] Add http:// to address in index.rst Signed-off-by: David Paez --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 3038bca246..aaace9abb1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,7 +19,7 @@ and install it from PyPI with the following commands: (venv) mayan-edms.py initialsetup (venv) mayan-edms.py runserver -Point your browser to 127.0.0.1:8000 and use the automatically created admin +Point your browser to http://127.0.0.1:8000 and use the automatically created admin account. .. image:: /_static/overview.gif From 25c66a51010fc1e0ef444dd6ab4a9fa6c8e9473d Mon Sep 17 00:00:00 2001 From: David Paez Date: Wed, 5 Apr 2017 23:50:10 -0500 Subject: [PATCH 02/11] Fix typo in deploying.rst Signed-off-by: David Paez --- docs/topics/deploying.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/topics/deploying.rst b/docs/topics/deploying.rst index e9dccbb704..f3c96e5873 100644 --- a/docs/topics/deploying.rst +++ b/docs/topics/deploying.rst @@ -2,7 +2,7 @@ Deploying ========= -Below are some ways to deploye and use Mayan EDMS. Do use more than one method. +Below are some ways to deploy and use Mayan EDMS. Do not use more than one method. OS "bare metal" method ====================== From 2fc462bad5a2ff205d77ab44befef569632376ea Mon Sep 17 00:00:00 2001 From: David Paez Date: Wed, 5 Apr 2017 23:53:41 -0500 Subject: [PATCH 03/11] Character and style fixes in development.rst Signed-off-by: David Paez --- docs/topics/development.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/topics/development.rst b/docs/topics/development.rst index 46fcf90bd4..d855f2da69 100644 --- a/docs/topics/development.rst +++ b/docs/topics/development.rst @@ -16,8 +16,8 @@ request on GitLab_. Project philosophies -------------------- -How to think about Mayan EDMS when doing changes or adding new features, -why things are the way they are in Mayan EDMS. +How to think about Mayan EDMS when doing changes or adding new features; +why things are the way they are in Mayan EDMS: - Functionality must be as market/sector independent as possible, code for the 95% of use cases. @@ -36,7 +36,7 @@ why things are the way they are in Mayan EDMS. not viable/mature/efficient. - Each app is as independent and self contained as possible. Exceptions, the basic requirements: navigation, permissions, common, main. -- If an app is meant to be used by more than one other app it should be as +- If an app is meant to be used by more than one other app, it should be as generic as possible in regard to the project and another app will bridge the functionality. - Example: since indexing (document_indexing) only applies to documents, the @@ -48,7 +48,7 @@ Coding conventions Follow PEP8 ~~~~~~~~~~~ -Whenever possible, but don't obsess over things like line length. +Whenever possible, but don't obsess over things like line length: .. code-block:: bash @@ -103,9 +103,9 @@ Example: ) from .models import Index, IndexInstanceNode, DocumentRenameCount -All local app module imports are in relative form, local app module name is to +All local app module imports are in relative form. Local app module name is to be referenced as little as possible, unless required by a specific feature, -trick, restriction, ie: Runtime modification of the module's attributes. +trick, restriction (e.g., Runtime modification of the module's attributes). Incorrect: @@ -128,7 +128,7 @@ Dependencies Mayan EDMS apps follow a hierarchical model of dependency. Apps import from their parents or siblings, never from their children. Think plugins. A parent app must never assume anything about a possible existing child app. The -documents app and the Document model are the basic entities they must never +documents app and the Document model are the basic entities; they must never import anything else. The common and main apps are the base apps. From 7bd88561d5ce0126a4298b27879db3d7a1e6079a Mon Sep 17 00:00:00 2001 From: David Paez Date: Wed, 5 Apr 2017 23:54:22 -0500 Subject: [PATCH 04/11] Style fixes in features.rst Signed-off-by: David Paez --- docs/topics/features.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/topics/features.rst b/docs/topics/features.rst index 33d32c7159..3d93dc0145 100644 --- a/docs/topics/features.rst +++ b/docs/topics/features.rst @@ -30,7 +30,7 @@ Features * Dynamic default values for metadata. * Metadata fields can have an initial value, which can be static or determined - by an user provided template code snippet. + by a template code snippet provided by the user. * Documents can be uploaded from different sources. @@ -68,7 +68,7 @@ Features * Multi page document support. - * Multiple page PDFs and TIFFs files are supported. + * Multiple page PDF and TIFF files are supported. * Automatic OCR processing. From 78365a7d4c871f5a86468379230a3de84f030608 Mon Sep 17 00:00:00 2001 From: David Paez Date: Wed, 5 Apr 2017 23:55:29 -0500 Subject: [PATCH 05/11] Typo fixes and style improvements in installation.rst Signed-off-by: David Paez --- docs/topics/installation.rst | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/topics/installation.rst b/docs/topics/installation.rst index 813f6a03c0..e559693dcc 100644 --- a/docs/topics/installation.rst +++ b/docs/topics/installation.rst @@ -9,7 +9,7 @@ Being a Django_ and a Python_ project, familiarity with these technologies is recommended to better understand why Mayan EDMS does some of the things it does. -Bellow are the step needed for a test install. +Bellow are the steps needed for a test install. Binary dependencies =================== @@ -45,15 +45,15 @@ With MacPorts installed run the command: Set the Binary paths ******************** -Mayan EDMS by default will look in /usr/bin/ for the binary files it needs -so either you can symlink the binaries installed via MacPorts in /opt/local/bin/ -to /usr/bin/ with ... +Mayan EDMS by default will look in /usr/bin/ for the binary files it needs. +You can symlink the binaries installed via MacPorts in /opt/local/bin/ +to /usr/bin/ with: .. code-block:: bash sudo ln -s /opt/local/bin/tesseract /usr/bin/tesseract -... alternatively set the paths in the ``settings/locals.py`` +Alternatively, set the paths in the ``settings/locals.py`` .. code-block:: python @@ -71,9 +71,9 @@ With Homebrew installed run the command: Set the Binary paths ******************** -Mayan EDMS by default will look in /usr/bin/ for the binary files it needs -so either you can symlink the binaries installed via brew in /usr/local/bin/ -to /usr/bin/ with ... +Mayan EDMS by default will look in /usr/bin/ for the binary files it needs. +You can symlink the binaries installed via brew in /usr/local/bin/ +to /usr/bin/ with: .. code-block:: bash @@ -82,7 +82,7 @@ to /usr/bin/ with ... sudo ln -s /usr/local/bin/pdftotext /usr/bin/pdftotext && \ sudo ln -s /usr/local/bin/gs /usr/bin/gs -... alternatively set the paths in the ``settings/locals.py`` +Alternatively, set the paths in the ``settings/locals.py`` .. code-block:: python @@ -99,7 +99,7 @@ Initialize a ``virtualenv`` to deploy the project: source venv/bin/activate pip install mayan-edms -By default Mayan EDMS will create a single file SQLite_ database, which makes +By default, Mayan EDMS will create a single file SQLite_ database, which makes it very easy to start using Mayan EDMS. Populate the database with the project's schema doing: @@ -117,11 +117,13 @@ Background tasks and scheduled tasks will not run when using the test server. The ``runserver`` command is only meant for testing, do not use in a production server. -Note that the default IP address, 127.0.0.1, is not accessible from other +Note that the default 127.0.0.1 IP address is not accessible from other machines on your network. To make your test server viewable to other -machines on the network, use its own IP address (e.g. 192.168.2.1) or 0.0.0.0 or :: (with IPv6 enabled). +machines on the network, use its own IP address like 192.168.2.1 or 0.0.0.0 or +:: (with IPv6 enabled). -You can provide an IPv6 address surrounded by brackets (e.g. [200a::1]:8000). This will automatically enable IPv6 support. +You can provide an IPv6 address surrounded by brackets (e.g. [200a::1]:8000). +This will automatically enable IPv6 support. Production use ============== @@ -129,7 +131,7 @@ Production use After making sure everything is running correctly, stop the ``runserver`` command. Deploy Mayan EDMS using the webserver of your preference. For more information on deployment instructions and examples, checkout Django's official documentation -on the topic https://docs.djangoproject.com/en/1.7/howto/deployment/ +on the topic at https://docs.djangoproject.com/en/1.7/howto/deployment/ For a simple production deployment setup follow the instructions in the :doc:`deploying` chapter. From ced28963add3de871df5693365ae8a85236f7d66 Mon Sep 17 00:00:00 2001 From: David Paez Date: Wed, 5 Apr 2017 23:56:22 -0500 Subject: [PATCH 06/11] Style improvements in transformations.rst Signed-off-by: David Paez --- docs/topics/transformations.rst | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/docs/topics/transformations.rst b/docs/topics/transformations.rst index ffde0c7c7c..ebe4355be8 100644 --- a/docs/topics/transformations.rst +++ b/docs/topics/transformations.rst @@ -2,21 +2,20 @@ Transformations =============== -Transformation are persistent manipulations to the previews of the stored -documents. For example: a scanning equipment may only produce landscape PDFs. -In this case an useful transformation for that document source would be to -rotate all documents scanned by 270 degrees after being uploaded, this way -whenever a document is uploaded from that scanner it will appear in portrait -orientation. In this case add a this transformation to the Mayan EDMS source -that is connected to that device this way all pages scanned via that source -with inherit the transformation as they are created. +Transformations are persistent manipulations to the previews of the stored +documents. For example: a scanning equipment may only produce landscape PDFs. +In this case a useful transformation for that document source would be to rotate +all scanned documents by 270 degrees after being uploaded. By adding this +transformation to the Mayan EDMS source that is connected to the scanner, all +pages scanned via that source will inherit the transformation as they are +created. The result is that whenever a document is uploaded from that scanner, +it will appear in portrait orientation, instead of landscape orientation. -Transformations can also be added to existing documents, by clicking on a -document's page, then clicking on "transformations". In this view the Actions -menu will have a new option that reads "Create new transformation". At the -moment the rotation, zoom, crop, and resize transformations are available. -Once the document image has been corrected resubmit it for OCR for improved -results. +Transformations can also be added to existing documents by clicking on a +document's page and then clicking on "transformations". In this view the Actions +menu will have a new option that reads "Create new transformation". Currently, +the available transformations are: rotation, zoom, crop, and resize. Once the +document image has been corrected, resubmit it for OCR for improved results. -Transformations are not destructive and do not physically modify the document +Transformations are not destructive and do not physically modify the document file, they just modify the document's graphical representation. From 30caed211bc51e23dfcc54690c76335773b79444 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 11 May 2017 21:22:55 -0400 Subject: [PATCH 07/11] Add link to Ubuntu supervisor enable bug ticket. Signed-off-by: Roberto Rosario --- docs/topics/deploying.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/topics/deploying.rst b/docs/topics/deploying.rst index c03d977158..8952357901 100644 --- a/docs/topics/deploying.rst +++ b/docs/topics/deploying.rst @@ -266,15 +266,18 @@ Make the installation directory readable and writable by the webserver user:: chown www-data:www-data /usr/share/mayan-edms -R -Restart the services:: +Enable and restart the services [1_]:: systemctl enable supervisor systemctl restart supervisor systemctl restart nginx +[1]: https://bugs.launchpad.net/ubuntu/+source/supervisor/+bug/1594740 + .. _Debian: http://www.debian.org/ .. _Django: http://www.djangoproject.com/ .. _Python: http://www.python.org/ .. _SQLite: https://www.sqlite.org/ .. _Ubuntu: http://www.ubuntu.com/ .. _virtualenv: http://www.virtualenv.org/en/latest/index.html +.. _1: https://bugs.launchpad.net/ubuntu/+source/supervisor/+bug/1594740 From ce563bfb6a2b66257610d12f39b7ebca7e08f5e5 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 24 May 2017 00:59:33 -0400 Subject: [PATCH 08/11] Update the index node template expression field from a 128 char field to a text field. Signed-off-by: Roberto Rosario --- HISTORY.rst | 4 + docs/releases/2.2.1.rst | 73 +++++++++++++++++++ docs/releases/index.rst | 1 + .../migrations/0011_auto_20170524_0456.py | 20 +++++ mayan/apps/document_indexing/models.py | 3 +- 5 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 docs/releases/2.2.1.rst create mode 100644 mayan/apps/document_indexing/migrations/0011_auto_20170524_0456.py diff --git a/HISTORY.rst b/HISTORY.rst index c0d083a4f0..96074f7476 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,3 +1,7 @@ +2.2.1 (2017-05-25) +================== +- Allow for bigger indexing expression templates. + 2.2 (2017-04-26) ================ - Remove the installation app (GitLab #301). diff --git a/docs/releases/2.2.1.rst b/docs/releases/2.2.1.rst new file mode 100644 index 0000000000..d65004c2e0 --- /dev/null +++ b/docs/releases/2.2.1.rst @@ -0,0 +1,73 @@ +=============================== +Mayan EDMS v2.2.1 release notes +=============================== + +Released: May 25, 2017 + +What's new +========== + +This is a bug-fix and minor feature release and all users are encouraged to +upgrade. + +Changes +------------- +- Index node expression template field changed from a 128 character field to an + unlimited size text field to allow for complex indexing expressions. + +Removals +-------- +* None + +Upgrading from a previous version +--------------------------------- + +Using PIP +~~~~~~~~~ + +Type in the console:: + + $ pip install -U mayan-edms + +the requirements will also be updated automatically. + +Using Git +~~~~~~~~~ + +If you installed Mayan EDMS by cloning the Git repository issue the commands:: + + $ git reset --hard HEAD + $ git pull + +otherwise download the compressed archived and uncompress it overriding the +existing installation. + +Next upgrade/add the new requirements:: + + $ pip install --upgrade -r requirements.txt + +Common steps +~~~~~~~~~~~~ + +Migrate existing database schema with:: + + $ mayan-edms.py performupgrade + +Add new static media:: + + $ mayan-edms.py collectstatic --noinput + +The upgrade procedure is now complete. + + +Backward incompatible changes +============================= + +* None + +Bugs fixed or issues closed +=========================== + +* `GitLab issue #357 `_ It should be possible to retrieve all workflows for a given DocumentType from the API + +.. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/docs/releases/index.rst b/docs/releases/index.rst index 091513a7f8..d2aaa11fa2 100644 --- a/docs/releases/index.rst +++ b/docs/releases/index.rst @@ -22,6 +22,7 @@ versions of the documentation contain the release notes for any later releases. .. toctree:: :maxdepth: 1 + 2.2.1 2.2 2.1.11 2.1.10 diff --git a/mayan/apps/document_indexing/migrations/0011_auto_20170524_0456.py b/mayan/apps/document_indexing/migrations/0011_auto_20170524_0456.py new file mode 100644 index 0000000000..8f0ac49d50 --- /dev/null +++ b/mayan/apps/document_indexing/migrations/0011_auto_20170524_0456.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.6 on 2017-05-24 04:56 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('document_indexing', '0010_documentindexinstancenode_indexinstance'), + ] + + operations = [ + migrations.AlterField( + model_name='indextemplatenode', + name='expression', + field=models.TextField(help_text="Enter a template to render. Use Django's default templating language (https://docs.djangoproject.com/en/1.7/ref/templates/builtins/)", verbose_name='Indexing expression'), + ), + ] diff --git a/mayan/apps/document_indexing/models.py b/mayan/apps/document_indexing/models.py index a276a8113a..ff0b112a73 100644 --- a/mayan/apps/document_indexing/models.py +++ b/mayan/apps/document_indexing/models.py @@ -114,8 +114,7 @@ class IndexTemplateNode(MPTTModel): index = models.ForeignKey( Index, related_name='node_templates', verbose_name=_('Index') ) - expression = models.CharField( - max_length=128, + expression = models.TextField( help_text=_( 'Enter a template to render. ' 'Use Django\'s default templating language ' From 76e8fd2b07072b22beb0ae2280628a63a074c351 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 24 May 2017 02:27:43 -0400 Subject: [PATCH 09/11] Auto select checkbox when updating metadata values. Closes GitLab issue #371. Signed-off-by: Roberto Rosario --- HISTORY.rst | 1 + docs/releases/2.2.1.rst | 4 +++- mayan/apps/appearance/templates/appearance/base.html | 11 +++++++++++ mayan/apps/metadata/forms.py | 7 ++++++- .../apps/metadata/static/metadata/js/metadata_form.js | 11 +++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 mayan/apps/metadata/static/metadata/js/metadata_form.js diff --git a/HISTORY.rst b/HISTORY.rst index 96074f7476..3e2e221fc9 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,7 @@ 2.2.1 (2017-05-25) ================== - Allow for bigger indexing expression templates. +- Auto select checkbox when updating metadata values. GitLab issue #371. 2.2 (2017-04-26) ================ diff --git a/docs/releases/2.2.1.rst b/docs/releases/2.2.1.rst index d65004c2e0..da8b4abcfa 100644 --- a/docs/releases/2.2.1.rst +++ b/docs/releases/2.2.1.rst @@ -14,6 +14,8 @@ Changes ------------- - Index node expression template field changed from a 128 character field to an unlimited size text field to allow for complex indexing expressions. +- When updating the metadata of a document, any input in the value form field + will select the adjacent checkbox. Removals -------- @@ -68,6 +70,6 @@ Backward incompatible changes Bugs fixed or issues closed =========================== -* `GitLab issue #357 `_ It should be possible to retrieve all workflows for a given DocumentType from the API +* `GitLab issue #371 `_ Auto select checkbox when updating metadata .. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/mayan/apps/appearance/templates/appearance/base.html b/mayan/apps/appearance/templates/appearance/base.html index 57ab139e7e..34bd926549 100644 --- a/mayan/apps/appearance/templates/appearance/base.html +++ b/mayan/apps/appearance/templates/appearance/base.html @@ -33,6 +33,17 @@ {% block stylesheets %}{% endblock %} {% endcompress %} + {% if appearance_type == 'plain' %} diff --git a/mayan/apps/metadata/forms.py b/mayan/apps/metadata/forms.py index c220154ac4..38916ad583 100644 --- a/mayan/apps/metadata/forms.py +++ b/mayan/apps/metadata/forms.py @@ -16,11 +16,16 @@ class DocumentMetadataForm(forms.Form): label=_('Name'), required=False, widget=forms.TextInput(attrs={'readonly': 'readonly'}) ) - value = forms.CharField(label=_('Value'), required=False) + value = forms.CharField(label=_('Value'), required=False, + widget=forms.TextInput(attrs={'class': 'metadata-value'}) + ) update = forms.BooleanField( initial=True, label=_('Update'), required=False ) + class Media: + js = ('metadata/js/metadata_form.js',) + def __init__(self, *args, **kwargs): super(DocumentMetadataForm, self).__init__(*args, **kwargs) diff --git a/mayan/apps/metadata/static/metadata/js/metadata_form.js b/mayan/apps/metadata/static/metadata/js/metadata_form.js new file mode 100644 index 0000000000..a39726fac8 --- /dev/null +++ b/mayan/apps/metadata/static/metadata/js/metadata_form.js @@ -0,0 +1,11 @@ +'use strict'; + +waitForJQuery(function() { + jQuery(document).ready(function() { + $('.metadata-value').on('input', function(event) { + // Check the checkbox next to a metadata value input when there is + // data entry in the value's input. + $(event.target).parents('tr').find(':checkbox').prop('checked', true); + }); + }); +}); From d00f3aaff44f35a445ddf24c77ecdefbad2af278 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 24 May 2017 02:37:21 -0400 Subject: [PATCH 10/11] Add FAQ entry about LDAP authentication. GitLab issue #363. Signed-off-by: Roberto Rosario --- docs/topics/faq.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/topics/faq.rst b/docs/topics/faq.rst index dedf95428f..987e0d2a43 100644 --- a/docs/topics/faq.rst +++ b/docs/topics/faq.rst @@ -126,3 +126,10 @@ dependent support Python 3 then will the project move to fully support Python 3. Make sure that the Celery BEAT scheduler is running correctly as it is the element that triggers the periodics tasks. + +**Q: How to do LDAP authentication** + +A sample settings file called ldap_connection_settings.py is included in the +contrib/settings/ folder of the repository showing how to setup LDAP +authentication. + From 4ffc6fc94fd863a4da82698507fc0bb0094d1df3 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 24 May 2017 03:24:23 -0400 Subject: [PATCH 11/11] Added support for passing the options allow-other and allow-root to the FUSE index mirror. GitLab issue #385 Signed-off-by: Roberto Rosario --- HISTORY.rst | 2 ++ docs/releases/2.2.1.rst | 3 ++ .../management/commands/mountindex.py | 31 ++++++++++++++++--- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 3e2e221fc9..0eb3da1138 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,8 @@ ================== - Allow for bigger indexing expression templates. - Auto select checkbox when updating metadata values. GitLab issue #371. +- Added support for passing the options allow-other and allow-root to the + FUSE index mirror. GitLab issue #385 2.2 (2017-04-26) ================ diff --git a/docs/releases/2.2.1.rst b/docs/releases/2.2.1.rst index da8b4abcfa..de50dcf4f1 100644 --- a/docs/releases/2.2.1.rst +++ b/docs/releases/2.2.1.rst @@ -16,6 +16,8 @@ Changes unlimited size text field to allow for complex indexing expressions. - When updating the metadata of a document, any input in the value form field will select the adjacent checkbox. +- Support for passing the FUSE option `allow-other` and `allow-root` was added + to the index mirroring management command. Removals -------- @@ -71,5 +73,6 @@ Bugs fixed or issues closed =========================== * `GitLab issue #371 `_ Auto select checkbox when updating metadata +* `GitLab issue #385 `_ mountindex: how to specify FUSE mount option allow_other? .. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/mayan/apps/mirroring/management/commands/mountindex.py b/mayan/apps/mirroring/management/commands/mountindex.py index 7244716dae..2a57b9b948 100644 --- a/mayan/apps/mirroring/management/commands/mountindex.py +++ b/mayan/apps/mirroring/management/commands/mountindex.py @@ -11,6 +11,7 @@ from fuse import FUSE, FuseOSError, Operations from django.core import management from django.core.cache import caches from django.core.exceptions import MultipleObjectsReturned +from django.core.management.base import CommandError from django.db.models import Count from document_indexing.models import Index, IndexInstanceNode @@ -214,15 +215,35 @@ class Command(management.BaseCommand): def add_arguments(self, parser): parser.add_argument('slug', nargs='?', help='Index slug') - parser.add_argument('mount_point', nargs='?', help='Mount point') + parser.add_argument( + '--allow-other', action='store_true', dest='allow_other', + default=False, + help='All users (including root) can access the index files.' + ) + parser.add_argument( + '--allow-root', action='store_true', dest='allow_root', + default=False, + help='Mount access is limited to the user mounting the index and ' + 'root. This option and --allow-other are mutually exclusive.' + ) def handle(self, *args, **options): if not options.get('slug') or not options.get('mount_point'): self.stderr.write(self.style.ERROR('Incorrect number of arguments')) exit(1) - FUSE( - operations=IndexFS(index_slug=options['slug']), - mountpoint=options['mount_point'], nothreads=True, foreground=True - ) + try: + FUSE( + operations=IndexFS(index_slug=options['slug']), + mountpoint=options['mount_point'], nothreads=True, foreground=True, + allow_other=options['allow_other'], + allow_root=options['allow_root'] + ) + except RuntimeError as exception: + if options['allow_other'] or options['allow_root']: + raise CommandError( + 'Make sure \'user_allow_other\' is set in /etc/fuse.conf' + ) + else: + raise