The index rebuild permission can now be set as part of the index ACL for each individual index. Add cascade permission check to the index rebuild tool link. The index rebuild tool now responds with the number of indexes queued to rebuild instead of a static acknowledment.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-08-22 00:36:19 -04:00
parent 76895db846
commit 5210fdc9d8
5 changed files with 41 additions and 7 deletions

View File

@@ -4,19 +4,30 @@ from django import forms
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from acls.models import AccessControlList
from common.classes import ModelAttribute
from documents.models import Document
from .models import Index, IndexTemplateNode
from .permissions import permission_document_indexing_rebuild
class IndexListForm(forms.Form):
indexes = forms.ModelMultipleChoiceField(
help_text=_('Indexes to be queued for rebuilding.'),
label=_('Indexes'), queryset=Index.objects.filter(enabled=True),
label=_('Indexes'), queryset=Index.objects.none(),
required=False, widget=forms.widgets.CheckboxSelectMultiple()
)
def __init__(self, *args, **kwargs):
user = kwargs.pop('user')
super(IndexListForm, self).__init__(*args, **kwargs)
queryset = AccessControlList.objects.filter_by_access(
permission=permission_document_indexing_rebuild, user=user,
queryset=Index.objects.filter(enabled=True)
)
self.fields['indexes'].queryset = queryset
class IndexTemplateNodeForm(forms.ModelForm):
"""