Skip to content

Commit

Permalink
Add Enterprise 2FA report resource to API
Browse files Browse the repository at this point in the history
  • Loading branch information
jingcheng16 committed Dec 17, 2024
1 parent 579a84f commit b901b0d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions corehq/apps/enterprise/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ODataFeedResource,
WebUserResource,
SMSResource,
TwoFactorAuthResource,
)

v1_api = Api(api_name='v1')
Expand All @@ -18,3 +19,4 @@
v1_api.register(ODataFeedResource())
v1_api.register(CommCareVersionComplianceResource())
v1_api.register(SMSResource())
v1_api.register(TwoFactorAuthResource())
13 changes: 13 additions & 0 deletions corehq/apps/enterprise/api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,19 @@ def get_primary_keys(self):
return ('form_id', 'submitted',)


class TwoFactorAuthResource(ODataEnterpriseReportResource):
domain_not_having_2fa_enforced = fields.CharField()

REPORT_SLUG = EnterpriseReport.TWO_FACTOR_AUTH

def dehydrate(self, bundle):
bundle.data['domain_not_having_2fa_enforced'] = bundle.obj[0]
return bundle

def get_primary_keys(self):
return ('domain_not_having_2fa_enforced',)


class CommCareVersionComplianceResource(ODataEnterpriseReportResource):
mobile_worker = fields.CharField()
project_space = fields.CharField()
Expand Down

0 comments on commit b901b0d

Please sign in to comment.