play with somort of permission management

This commit is contained in:
Holger Sielaff
2024-07-04 14:05:55 +02:00
parent 030d3c8059
commit 7d53df6ea5
4 changed files with 42 additions and 7 deletions

20
lib/mixins/__init__.py Normal file
View File

@@ -0,0 +1,20 @@
from lib import permissions
class PermissionsAdminMixin:
def has_add_permission(self, request, obj=None):
"""If a group right is not set :)
Allways be able to create a version
"""
return permissions(obj) if obj else True
def has_change_permission(self, request, obj=None):
"""Versions are immutable """
return permissions(obj) if obj else True
def has_delete_permission(self, request, obj=None):
"""Versions are immutable """
return permissions(obj) if obj else True
def has_view_permissions(selfself, request, obj=None):
return True