Add superadmin routes to API
This commit is contained in:
@@ -134,6 +134,46 @@ class User(BaseModel):
|
||||
def get_organizations(self):
|
||||
"""Get all active organizations the user is a member of."""
|
||||
return [membership.organization for membership in self.get_active_memberships()]
|
||||
def get_active_ssh_keys(self):
|
||||
"""Get active (non-deleted) SSH keys.
|
||||
|
||||
Returns:
|
||||
List of SSHKey instances where deleted_at is None.
|
||||
"""
|
||||
return [k for k in self.ssh_keys if k.deleted_at is None]
|
||||
|
||||
def get_active_auth_methods(self):
|
||||
"""Get active (non-deleted) authentication methods.
|
||||
|
||||
Returns:
|
||||
List of AuthenticationMethod instances where deleted_at is None.
|
||||
"""
|
||||
return [m for m in self.authentication_methods if m.deleted_at is None]
|
||||
|
||||
def get_active_department_memberships(self):
|
||||
"""Get active (non-deleted) department memberships.
|
||||
|
||||
Returns:
|
||||
List of DepartmentMembership instances where deleted_at is None.
|
||||
"""
|
||||
return [m for m in self.department_memberships if m.deleted_at is None]
|
||||
|
||||
def get_active_principal_memberships(self):
|
||||
"""Get active (non-deleted) principal memberships.
|
||||
|
||||
Returns:
|
||||
List of PrincipalMembership instances where deleted_at is None.
|
||||
"""
|
||||
return [m for m in self.principal_memberships if m.deleted_at is None]
|
||||
|
||||
def get_active_ca_permissions(self):
|
||||
"""Get active (non-deleted) CA permissions.
|
||||
|
||||
Returns:
|
||||
List of CAPermission instances where deleted_at is None.
|
||||
"""
|
||||
return [p for p in self.ca_permissions if p.deleted_at is None]
|
||||
|
||||
|
||||
def has_totp_enabled(self) -> bool:
|
||||
"""Check if user has TOTP enabled and verified.
|
||||
|
||||
Reference in New Issue
Block a user