check device approval elsewhere
This commit is contained in:
parent
143e9a9fa9
commit
f2948a7b64
1 changed files with 8 additions and 6 deletions
|
@ -282,22 +282,24 @@ class User(UserBase, table=True):
|
||||||
# deny be default
|
# deny be default
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def can_issue(self, device: Device) -> bool:
|
@property
|
||||||
|
def can_issue(self) -> bool:
|
||||||
"""
|
"""
|
||||||
Check if this user can issue a certificate without approval.
|
Check if this user can issue a certificate without approval.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return (
|
return (
|
||||||
device.approved in (None, False)
|
self.is_admin
|
||||||
and (self.is_admin or self.has_tag(TagValue.issue))
|
or self.has_tag(TagValue.issue)
|
||||||
)
|
)
|
||||||
|
|
||||||
def can_renew(self, device: Device) -> bool:
|
@property
|
||||||
|
def can_renew(self) -> bool:
|
||||||
"""
|
"""
|
||||||
Check if this user can renew a certificate without approval.
|
Check if this user can renew a certificate without approval.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return (
|
return (
|
||||||
device.approved is True
|
self.is_admin
|
||||||
and (self.is_admin or self.has_tag(TagValue.renew))
|
or self.has_tag(TagValue.renew)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue