Added support for passing the options allow-other and allow-root to the

FUSE index mirror. GitLab issue #385

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-05-24 03:24:23 -04:00
parent d00f3aaff4
commit 4ffc6fc94f
3 changed files with 31 additions and 5 deletions
+2
View File
@@ -2,6 +2,8 @@
================== ==================
- Allow for bigger indexing expression templates. - Allow for bigger indexing expression templates.
- Auto select checkbox when updating metadata values. GitLab issue #371. - 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) 2.2 (2017-04-26)
================ ================
+3
View File
@@ -16,6 +16,8 @@ Changes
unlimited size text field to allow for complex indexing expressions. unlimited size text field to allow for complex indexing expressions.
- When updating the metadata of a document, any input in the value form field - When updating the metadata of a document, any input in the value form field
will select the adjacent checkbox. 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 Removals
-------- --------
@@ -71,5 +73,6 @@ Bugs fixed or issues closed
=========================== ===========================
* `GitLab issue #371 <https://gitlab.com/mayan-edms/mayan-edms/issues/371>`_ Auto select checkbox when updating metadata * `GitLab issue #371 <https://gitlab.com/mayan-edms/mayan-edms/issues/371>`_ Auto select checkbox when updating metadata
* `GitLab issue #385 <https://gitlab.com/mayan-edms/mayan-edms/issues/385>`_ mountindex: how to specify FUSE mount option allow_other?
.. _PyPI: https://pypi.python.org/pypi/mayan-edms/ .. _PyPI: https://pypi.python.org/pypi/mayan-edms/
@@ -11,6 +11,7 @@ from fuse import FUSE, FuseOSError, Operations
from django.core import management from django.core import management
from django.core.cache import caches from django.core.cache import caches
from django.core.exceptions import MultipleObjectsReturned from django.core.exceptions import MultipleObjectsReturned
from django.core.management.base import CommandError
from django.db.models import Count from django.db.models import Count
from document_indexing.models import Index, IndexInstanceNode from document_indexing.models import Index, IndexInstanceNode
@@ -214,15 +215,35 @@ class Command(management.BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('slug', nargs='?', help='Index slug') parser.add_argument('slug', nargs='?', help='Index slug')
parser.add_argument('mount_point', nargs='?', help='Mount point') 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): def handle(self, *args, **options):
if not options.get('slug') or not options.get('mount_point'): if not options.get('slug') or not options.get('mount_point'):
self.stderr.write(self.style.ERROR('Incorrect number of arguments')) self.stderr.write(self.style.ERROR('Incorrect number of arguments'))
exit(1) exit(1)
FUSE( try:
operations=IndexFS(index_slug=options['slug']), FUSE(
mountpoint=options['mount_point'], nothreads=True, foreground=True 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