mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-21 13:02:40 +00:00
Fix: let template viewers preview zones
The zone preview is a POST, so it required permission to add templates. Both preview endpoints now require viewing templates and documents.
This commit is contained in:
1 parent
0e7cbda3d9
commit
f401267c4b
3 files changed
+79
-5
No files matched your search
@@ -699,6 +699,21 @@ class ViewDocumentsPermissions(GlobalPermissionsByMethod):
|
||||
}
|
||||
|
||||
|
||||
class ViewOcrTemplatesPermissions(GlobalPermissionsByMethod):
|
||||
"""
|
||||
Requires the global permission to view OCR templates for OPTIONS, GET and
|
||||
POST, for the template editor's read-only preview endpoints.
|
||||
"""
|
||||
|
||||
perms_map = {
|
||||
"OPTIONS": ["documents.view_ocrtemplate"],
|
||||
"GET": ["documents.view_ocrtemplate"],
|
||||
# The zone preview is a POST only to carry the zone in the body; it
|
||||
# creates and changes nothing, so viewing templates is enough.
|
||||
"POST": ["documents.view_ocrtemplate"],
|
||||
}
|
||||
|
||||
|
||||
class TrashPermissions(GlobalPermissionsByMethod):
|
||||
"""Check the global document permission for each trash operation."""
|
||||
|
||||
|
||||
Reference in new issue
Block a user