usmannasir
2025-08-11 00:33:25 +05:00
parent 753f4f0606
commit d64ccc381e
5 changed files with 2894 additions and 26 deletions

8
.idea/workspace.xml generated
View File

@@ -4,7 +4,11 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="5251c5c9-f2a1-41f2-bc76-10b517091df1" name="Changes" comment="" />
<list default="true" id="5251c5c9-f2a1-41f2-bc76-10b517091df1" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dns/dnsManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/dns/dnsManager.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/plogical/acl.py" beforeDir="false" afterPath="$PROJECT_DIR$/plogical/acl.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -115,7 +119,7 @@
<workItem from="1754429757112" duration="3503000" />
<workItem from="1754433799097" duration="517000" />
<workItem from="1754448353513" duration="2970000" />
<workItem from="1754511414251" duration="25159000" />
<workItem from="1754511414251" duration="36009000" />
</task>
<servers />
</component>

View File

@@ -166,17 +166,8 @@ class DNSManager:
else:
finalData = {"status": 1}
tempList = ACLManager.findAllDomains(currentACL, userID)
finalData['domainsList'] = []
import tldextract
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
for items in tempList:
extractDomain = no_cache_extract(items)
subDomain = extractDomain.subdomain
if len(subDomain) == 0:
finalData['domainsList'].append(items)
# Get DNS zones directly from the Domains table instead of just websites
finalData['domainsList'] = ACLManager.findAllDNSZones(currentACL, userID)
template = 'dns/addDeleteDNSRecords.html'
@@ -520,7 +511,8 @@ class DNSManager:
else:
finalData = {"status": 1}
finalData['domainsList'] = ACLManager.findAllDomains(currentACL, userID)
# Get DNS zones directly from the Domains table instead of just websites
finalData['domainsList'] = ACLManager.findAllDNSZones(currentACL, userID)
template = 'dns/deleteDNSZone.html'
proc = httpProc(request, template, finalData, 'deleteZone')
return proc.render()

File diff suppressed because it is too large Load Diff

View File

@@ -724,6 +724,31 @@ class ACLManager:
domainsList.append(dom.domain)
return domainsList
@staticmethod
def findAllDNSZones(currentACL, userID):
from dns.models import Domains
zonesList = []
if currentACL['admin'] == 1:
zones = Domains.objects.all().order_by('name')
for zone in zones:
zonesList.append(zone.name)
else:
admin = Administrator.objects.get(pk=userID)
zones = Domains.objects.filter(admin=admin).order_by('name')
for zone in zones:
zonesList.append(zone.name)
# Include zones from owned admins
admins = Administrator.objects.filter(owner=admin.pk)
for item in admins:
owned_zones = Domains.objects.filter(admin=item).order_by('name')
for zone in owned_zones:
zonesList.append(zone.name)
return list(set(zonesList)) # Remove duplicates
@staticmethod
def checkOwnership(domain, admin, currentACL):
try:
@@ -767,20 +792,39 @@ class ACLManager:
@staticmethod
def checkOwnershipZone(domain, admin, currentACL):
try:
domain = Websites.objects.get(domain=domain)
except:
domain = ChildDomains.objects.get(domain=domain)
domain = domain.master
# First check if user is admin
if currentACL['admin'] == 1:
return 1
elif domain.admin == admin:
return 1
elif domain.admin.owner == admin.pk:
return 1
else:
return 0
# Try to find domain in Websites table
try:
websiteDomain = Websites.objects.get(domain=domain)
if websiteDomain.admin == admin or websiteDomain.admin.owner == admin.pk:
return 1
except:
pass
# Try to find domain in ChildDomains table
try:
childDomain = ChildDomains.objects.get(domain=domain)
if childDomain.master.admin == admin or childDomain.master.admin.owner == admin.pk:
return 1
except:
pass
# Try to find domain in DNS Domains table (for standalone DNS zones)
try:
from dns.models import Domains
dnsDomain = Domains.objects.get(name=domain)
if dnsDomain.admin == admin:
return 1
# Check if the DNS zone is owned by a user owned by current admin
if dnsDomain.admin.owner == admin.pk:
return 1
except:
pass
return 0
@staticmethod
def executeCall(command):

File diff suppressed because it is too large Load Diff