Skip to content

Commit

Permalink
Merge pull request #188 from kobotoolbox/enable-anonymous-submissions…
Browse files Browse the repository at this point in the history
…-by-default

Enable anonymous submissions by default
  • Loading branch information
jnm committed May 9, 2024
2 parents 7ff9da5 + a26f982 commit 0afc20c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions equitytool/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,22 @@ def _create_kpi_asset(self):
data = {'active': True}
response = requests.post(deploy_url, data=data, headers=self._headers())
assert response.status_code == 200

# Assign anonymous submissions permissions
permission_assignment_url = '{}api/v2/assets/{}/permission-assignments/'.format(
self.KPI_URL, asset_uid
)
permission_data = {
'user': '{}api/v2/users/AnonymousUser/'.format(self.KPI_URL),
'permission': '{}api/v2/permissions/add_submissions/'.format(self.KPI_URL)
}
permission_response = requests.post(
permission_assignment_url,
data=permission_data,
headers=self._headers()
)
assert permission_response.status_code == 201

return response.json()['asset']

def set_form(self):
Expand Down

0 comments on commit 0afc20c

Please sign in to comment.