def test_class(self):
     self.assertEqual('state',
                      DomainPermissionsMirror.source_domain('county'))
     self.assertIsNone(DomainPermissionsMirror.source_domain('state'))
     self.assertEqual(['county'],
                      DomainPermissionsMirror.mirror_domains('state'))
     self.assertEqual([], DomainPermissionsMirror.mirror_domains('county'))
Beispiel #2
0
def domain(domain, allow_mirroring=False):
    domains = [domain]
    if allow_mirroring:
        from corehq.apps.users.models import DomainPermissionsMirror
        source_domain = DomainPermissionsMirror.source_domain(domain)
        if source_domain:
            domains.append(source_domain)
    return filters.OR(filters.term("domain.exact", domains),
                      filters.term("domain_memberships.domain.exact", domains))