mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 23:20:27 +00:00
optimized domain permission check for normal users
This commit is contained in:
parent
47cf1aff4a
commit
049a8a4547
@ -366,11 +366,10 @@ class User(db.Model):
|
|||||||
if self.role.name == "Administrator":
|
if self.role.name == "Administrator":
|
||||||
return True
|
return True
|
||||||
|
|
||||||
query = db.session.query(User, DomainUser, Domain).filter(User.id==self.id).filter(User.id==DomainUser.user_id).filter(Domain.id==DomainUser.domain_id).all()
|
query = db.session.query(User, DomainUser, Domain).filter(User.id == self.id).filter(
|
||||||
for q in query:
|
User.id == DomainUser.user_id).filter(Domain.id == DomainUser.domain_id).filter(
|
||||||
if q[2].name == domain_name:
|
Domain.name == domain_name)
|
||||||
return True
|
return query.count() >= 1
|
||||||
return False
|
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user