Merge branch 'za/bugfix-hide-csv-export-button-on-empty' into za/2348-csv-export-org-member-domain-export

This commit is contained in:
zandercymatics 2024-07-31 11:16:32 -06:00
commit a0bfdbf2b1
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
6 changed files with 11 additions and 2 deletions

View file

@ -428,3 +428,8 @@ class User(AbstractUser):
def is_org_user(self, request):
has_organization_feature_flag = flag_is_active(request, "organization_feature")
return has_organization_feature_flag and self.has_base_portfolio_permission()
def user_domain_count(self):
"""Returns the number of domains associated with this user through UserDomainRole"""
available_domains = UserDomainRole.objects.filter(user=self, domain__isnull=False)
return available_domains.count()