Apply the tag attach and remove permissions to tags too.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -65,8 +65,9 @@ class TagsApp(MayanAppConfig):
|
|||||||
ModelPermission.register(
|
ModelPermission.register(
|
||||||
model=Tag, permissions=(
|
model=Tag, permissions=(
|
||||||
permission_acl_edit, permission_acl_view,
|
permission_acl_edit, permission_acl_view,
|
||||||
permission_tag_delete, permission_tag_edit,
|
permission_tag_attach, permission_tag_delete,
|
||||||
permission_tag_view,
|
permission_tag_edit, permission_tag_remove,
|
||||||
|
permission_tag_view
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+14
-10
@@ -41,10 +41,12 @@ class TagAttachActionView(MultipleObjectFormActionView):
|
|||||||
result = {
|
result = {
|
||||||
'submit_label': _('Attach'),
|
'submit_label': _('Attach'),
|
||||||
'title': ungettext(
|
'title': ungettext(
|
||||||
'Attach tags to document',
|
singular='Attach tags to %(count)d document',
|
||||||
'Attach tags to documents',
|
plural='Attach tags to %(count)d documents',
|
||||||
queryset.count()
|
number=queryset.count()
|
||||||
)
|
) % {
|
||||||
|
'count': queryset.count(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if queryset.count() == 1:
|
if queryset.count() == 1:
|
||||||
@@ -78,7 +80,7 @@ class TagAttachActionView(MultipleObjectFormActionView):
|
|||||||
|
|
||||||
for tag in form.cleaned_data['tags']:
|
for tag in form.cleaned_data['tags']:
|
||||||
AccessControlList.objects.check_access(
|
AccessControlList.objects.check_access(
|
||||||
obj=tag, permissions=permission_tag_view,
|
obj=tag, permissions=permission_tag_attach,
|
||||||
user=self.request.user
|
user=self.request.user
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -245,10 +247,12 @@ class TagRemoveActionView(MultipleObjectFormActionView):
|
|||||||
result = {
|
result = {
|
||||||
'submit_label': _('Remove'),
|
'submit_label': _('Remove'),
|
||||||
'title': ungettext(
|
'title': ungettext(
|
||||||
'Remove tags from document',
|
singular='Remove tags to %(count)d document',
|
||||||
'Remove tags from documents',
|
plural='Remove tags to %(count)d documents',
|
||||||
queryset.count()
|
number=queryset.count()
|
||||||
)
|
) % {
|
||||||
|
'count': queryset.count(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if queryset.count() == 1:
|
if queryset.count() == 1:
|
||||||
@@ -282,7 +286,7 @@ class TagRemoveActionView(MultipleObjectFormActionView):
|
|||||||
|
|
||||||
for tag in form.cleaned_data['tags']:
|
for tag in form.cleaned_data['tags']:
|
||||||
AccessControlList.objects.check_access(
|
AccessControlList.objects.check_access(
|
||||||
obj=tag, permissions=permission_tag_view,
|
obj=tag, permissions=permission_tag_remove,
|
||||||
user=self.request.user
|
user=self.request.user
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user