mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-30 19:45:44 +00:00
Chore: drop get_groups_with_only_permission (#14454)
It worked around get_groups_with_perms lacking only_with_perms_in, which django-guardian added in 3.1.0. The pinned version is newer.
This commit is contained in:
1 parent
e7d70497c2
commit
10a1a9eae8
3 files changed
+30
-17
No files matched your search
@@ -107,20 +107,6 @@ def has_system_status_permission(user: User | None) -> bool:
|
||||
)
|
||||
|
||||
|
||||
def get_groups_with_only_permission(obj, codename):
|
||||
ctype = ContentType.objects.get_for_model(obj)
|
||||
permission = Permission.objects.get(content_type=ctype, codename=codename)
|
||||
group_object_perm_group_ids = (
|
||||
GroupObjectPermission.objects.filter(
|
||||
object_pk=obj.pk,
|
||||
content_type=ctype,
|
||||
)
|
||||
.filter(permission=permission)
|
||||
.values_list("group_id")
|
||||
)
|
||||
return Group.objects.filter(id__in=group_object_perm_group_ids).distinct()
|
||||
|
||||
|
||||
def _resolve_permissions(codenames: set[str], ctype: ContentType) -> list[Permission]:
|
||||
"""
|
||||
Resolve ``codenames`` to Permission rows, raising for any that don't exist
|
||||
|
||||
Reference in new issue
Block a user