Scope reseller access to assigned hosting accounts
Allow operators to assign accounts to resellers and give each reseller read-only access to their own accounts and Apache previews.
This commit is contained in:
1 parent
bb95b86173
commit
39243a8ab3
13 files changed
+325
-33
No files matched your search
@@ -1,9 +1,22 @@
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
|
||||
from .fields import DomainNameField
|
||||
|
||||
|
||||
class Reseller(models.Model):
|
||||
user = models.OneToOneField(
|
||||
settings.AUTH_USER_MODEL,
|
||||
on_delete=models.PROTECT,
|
||||
related_name="hosting_reseller",
|
||||
limit_choices_to={"is_superuser": False},
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.user.get_username()
|
||||
|
||||
|
||||
class HostingPlan(models.Model):
|
||||
name = models.CharField(max_length=120, unique=True)
|
||||
description = models.CharField(max_length=240, blank=True)
|
||||
@@ -21,6 +34,9 @@ class HostingAccount(models.Model):
|
||||
hosting_plan = models.ForeignKey(
|
||||
HostingPlan, on_delete=models.PROTECT, null=True, blank=True
|
||||
)
|
||||
reseller = models.ForeignKey(
|
||||
Reseller, on_delete=models.PROTECT, null=True, blank=True
|
||||
)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def get_absolute_url(self):
|
||||
|
||||
Reference in new issue
Block a user