Allow operators to assign accounts to resellers and give each reseller read-only access to their own accounts and Apache previews.
16 lines
428 B
Python
16 lines
428 B
Python
from django.contrib.admin import AdminSite
|
|
from django.contrib.admin.apps import AdminConfig
|
|
|
|
from .hosting.access import reseller_for_user
|
|
|
|
|
|
class CoulobreAdminSite(AdminSite):
|
|
def has_permission(self, request):
|
|
return (
|
|
super().has_permission(request) and reseller_for_user(request.user) is None
|
|
)
|
|
|
|
|
|
class CoulobreAdminConfig(AdminConfig):
|
|
default_site = "coulobre.admin.CoulobreAdminSite"
|