adapt CanAccessLookup to api key auth

This commit is contained in:
imperosol
2025-05-20 21:04:49 +02:00
parent b5d65133f3
commit 52e53da9ef
10 changed files with 75 additions and 9 deletions

View File

@ -754,6 +754,23 @@ class UserBan(models.Model):
return f"Ban of user {self.user.id}"
class GlobalPermissionRights(models.Model):
"""Little hack to have permissions not linked to a specific db table."""
class Meta:
# No database table creation or deletion
# operations will be performed for this model.
managed = False
# disable "add", "change", "delete" and "view" default permissions
default_permissions = []
permissions = [("access_lookup", "Can access any lookup in the sith")]
def __str__(self):
return self.__class__.__name__
class Preferences(models.Model):
user = models.OneToOneField(
User, related_name="_preferences", on_delete=models.CASCADE