Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK-82] Feature: Project-level control of anonymous submission #4719

Merged
merged 59 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
74b8ccf
WIP. Checkbox and basic styling
Oct 23, 2023
45048bb
Move anon submission to a component
Oct 30, 2023
915f011
WIP notice banner. Need to reorder components
Oct 30, 2023
c38634f
Merge branch 'beta' into feature/per-project-anonymous-access
Oct 31, 2023
1f694a6
Per-form anonymous submissions
jnm May 25, 2023
526c968
Update OpenRosa server url when "add_submissions" permission is assig…
noliveleger Nov 1, 2023
180c67e
Rename `ReplaceValues` ORM helper to `UpdateJSONFieldAttributes`
noliveleger Nov 2, 2023
34bd636
Frontend hooked with view_asset endpoint (temp)
Nov 2, 2023
dd00948
linter and cleanup
Nov 2, 2023
f1f2328
remove unused component
Nov 2, 2023
59f69c8
Do not save `_stored_data_key` attribute of `Asset._deployment_data` …
noliveleger Nov 2, 2023
f5bdb5b
Fix unit tests for permissions
noliveleger Nov 2, 2023
736a4c3
Merge branch 'beta' into feature/per-project-anonymous-access
Nov 6, 2023
fafc4e1
Add migration to assign anonymous user "add_submissions"
noliveleger Nov 6, 2023
661748d
Remove `require_auth` PATCH changes
noliveleger Nov 7, 2023
d246833
Remove require_auth from reports
noliveleger Nov 7, 2023
2fef98e
Fix migration with pytest
noliveleger Nov 7, 2023
04dfe37
Merge branch 'beta' into require-auth-at-project-level
noliveleger Nov 8, 2023
92343e8
Merge branch 'require-auth-at-project-level' into feature/per-project…
noliveleger Nov 8, 2023
0c3f8c3
Endpoint changes to add_submissions
Nov 9, 2023
32d58b3
Merge branch 'beta' into feature/per-project-anonymous-access
duvld Nov 9, 2023
fc87ed6
Remove checks for `require_auth` in frontend
duvld Nov 9, 2023
657b7e7
Clean up
Nov 15, 2023
64932b0
Merge branch 'beta' into feature/per-project-anonymous-access
Nov 15, 2023
a247c21
Add checkbox to sharing modal component file
duvld Nov 17, 2023
24599ad
Remove require_auth from reports
noliveleger Nov 7, 2023
ae72415
Merge branch 'require-auth-at-project-level' into feature/per-project…
noliveleger Nov 20, 2023
7594592
Merge branch 'beta' into require-auth-at-project-level
noliveleger Nov 20, 2023
76d0714
Merge branch 'require-auth-at-project-level' into feature/per-project…
noliveleger Nov 20, 2023
511f0d8
Remove debugging dev settings
noliveleger Nov 20, 2023
daf8100
Use Xform require_auth for DDA
noliveleger Nov 20, 2023
6bdccf2
Block paired data based on xform.require_auth boolean
noliveleger Nov 20, 2023
ba584cb
Merge branch 'require-auth-at-project-level' into feature/per-project…
noliveleger Nov 21, 2023
3fe493e
PR changes
duvld Nov 21, 2023
e247d33
Remove doc comment for required_auth
duvld Nov 21, 2023
b4f5454
Merge branch 'beta' into require-auth-at-project-level
noliveleger Nov 21, 2023
8038361
Merge branch 'require-auth-at-project-level' into feature/per-project…
noliveleger Nov 21, 2023
2d922db
Following changes:
duvld Nov 23, 2023
f6db906
Moved some stuff around to fit mockups
duvld Dec 4, 2023
aac700a
PR changes
duvld Dec 11, 2023
c053c5c
missing files and revert Dockerfile change
duvld Dec 11, 2023
39585a0
Merge branch 'beta' into require-auth-at-project-level
noliveleger Dec 14, 2023
d94dac0
Merge branch 'require-auth-at-project-level' into feature/per-project…
noliveleger Dec 14, 2023
71edaf1
Merge pull request #4728 from kobotoolbox/feature/per-project-anonymo…
noliveleger Dec 14, 2023
4fab298
Update OpenRosa server URL when anonymous user is allow to submit data
noliveleger Dec 14, 2023
f930fb5
Fix anon url for android sharing
jamesrkiger Dec 15, 2023
f6deac7
Adjust anon submission tooltip layout issue
jamesrkiger Dec 18, 2023
99a0c24
Merge pull request #4771 from kobotoolbox/fix-tooltip-container-overflow
jamesrkiger Dec 18, 2023
117e4c3
Make the name of the Redis client variable obvious…
noliveleger Dec 21, 2023
0da6e1a
Use same signature for set_enketo_open_rosa_server method
noliveleger Dec 21, 2023
7655a1e
Revert addition of username to OpenRosa server URL
jamesrkiger Dec 26, 2023
f0f1941
Update anon toggle text
jamesrkiger Dec 26, 2023
45de209
Merge branch 'beta' into require-auth-at-project-level
Dec 29, 2023
8a945e3
Fix bug for removing `add_submissions` permission
Dec 29, 2023
bbca5ab
Apply requested changes for PR #4719
noliveleger Jan 8, 2024
b0ad029
Merge branch 'require-auth-at-project-level' of github.com:kobotoolbo…
noliveleger Jan 8, 2024
eb725e2
Add ENKETO_MAIN_URL env var to GH Actions
noliveleger Jan 8, 2024
0f35d78
Use django-redis to update enketo redis entries
noliveleger Jan 10, 2024
e4d6ad3
Add check to service_health for Enketo Redis main
noliveleger Jan 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
REDIS_SESSION_URL: redis://localhost:6379
SERVICE_ACCOUNT_BACKEND_URL: redis://localhost:6379/4
CACHE_URL: redis://localhost:6379/3
ENKETO_REDIS_MAIN_URL: redis://localhost:6379/0
strategy:
matrix:
python-version: ['3.8', '3.10']
Expand Down
22 changes: 0 additions & 22 deletions jsapp/js/account/accountFieldsEditor.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ interface AccountFieldsEditorProps {
*/
values: AccountFieldsValues;
onChange: (fields: AccountFieldsValues) => void;
/**
* Handles the require authentication checkbox. If not provided, the checkbox
* will be displayed.
*/
isRequireAuthDisplayed?: boolean;
}

/**
Expand Down Expand Up @@ -87,23 +82,6 @@ export default function AccountFieldsEditor(props: AccountFieldsEditorProps) {

return (
<div>
<div className={styles.row}>
{/* Privacy */}
{props.isRequireAuthDisplayed !== false && (
<div className={styles.field}>
<label>{t('Privacy')}</label>

<Checkbox
checked={props.values.require_auth}
onChange={(isChecked: boolean) =>
onAnyFieldChange('require_auth', isChecked)
}
label={t('Require authentication to see forms and submit data')}
/>
</div>
)}
</div>

<div className={styles.row}>
{/* Full name */}
{isFieldToBeDisplayed('name') && (
Expand Down
17 changes: 17 additions & 0 deletions jsapp/js/account/accountSettings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@
font-size: 16px;
}
}

.form-modal__item--anonymous-submission-notice {
display: flex;
line-height: sizes.$x24;
background-color: colors.$kobo-light-amber;
margin-top: sizes.$x12;
padding: sizes.$x18;
border-radius: sizes.$x8;

.anonymous-submission-notice-copy {
padding-left: sizes.$x16;
padding-right: sizes.$x8;
> * {
display: inline;
}
}
}
}

.account-settings__actions {
Expand Down
30 changes: 30 additions & 0 deletions jsapp/js/account/accountSettingsRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import './accountSettings.scss';
import {notify, stringToColor} from 'js/utils';
import {dataInterface} from '../dataInterface';
import AccountFieldsEditor from './accountFieldsEditor.component';
import Icon from 'js/components/common/icon';
import envStore from 'js/envStore';
import {
getInitialAccountFieldsValues,
getProfilePatchData,
Expand All @@ -15,6 +17,7 @@ import type {
AccountFieldsValues,
AccountFieldsErrors,
} from './account.constants';
import {HELP_ARTICLE_ANON_SUBMISSIONS_URL} from 'js/constants';

bem.AccountSettings = makeBem(null, 'account-settings');
bem.AccountSettings__left = makeBem(bem.AccountSettings, 'left');
Expand Down Expand Up @@ -151,6 +154,33 @@ const AccountSettings = observer(() => {

{sessionStore.isInitialLoadComplete && form.isUserDataLoaded && (
<bem.AccountSettings__item m='fields'>
<bem.AccountSettings__item m='anonymous-submission-notice'>
<Icon name='information' color='amber' size='m' />
<div className='anonymous-submission-notice-copy'>
<strong>
{t(
'"Require authentication to see forms and submit data" has been moved.'
)}
</strong>
&nbsp;
<div>
{t(
'This privacy feature is now a per-project setting. New projects will require authentication by default.'
)}
</div>
&nbsp;
<a
href={
envStore.data.support_url +
HELP_ARTICLE_ANON_SUBMISSIONS_URL
}
target='_blank'
>
{t('Learn more about these changes here.')}
</a>
</div>
</bem.AccountSettings__item>

<AccountFieldsEditor
errors={form.fieldsWithErrors.extra_details}
values={form.fields}
Expand Down
35 changes: 35 additions & 0 deletions jsapp/js/components/anonymousSubmission.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, {useState} from 'react';
import ToggleSwitch from 'js/components/common/toggleSwitch';
import envStore from 'js/envStore';
import {HELP_ARTICLE_ANON_SUBMISSIONS_URL} from 'js/constants';
import Icon from 'js/components/common/icon';
import styles from './anonymousSubmission.module.scss';

interface AnonymousSubmissionProps {
checked: boolean;
onChange: (isChecked: boolean) => void;
}

export default function AnonymousSubmission(props: AnonymousSubmissionProps) {
return (
<div className={styles.root}>
<ToggleSwitch
checked={props.checked}
onChange={props.onChange}
label={t(
'Allow web submissions to this form without a username and password'
)}
/>
<a
href={envStore.data.support_url + HELP_ARTICLE_ANON_SUBMISSIONS_URL}
className='right-tooltip wrapped-tooltip'
target='_blank'
data-tip={t(
'Allow anyone to see this form and add submissions. Click the icon to learn more.'
)}
>
<Icon size='s' name='help' color='storm' />
</a>
</div>
);
}
13 changes: 13 additions & 0 deletions jsapp/js/components/anonymousSubmission.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@use 'scss/sizes';
@use '~kobo-common/src/styles/colors';

.root {
display: flex;
padding-bottom: sizes.$x12;
padding-top: sizes.$x8;
border-bottom: 1px solid colors.$kobo-gray-96;
}

a {
margin-left: sizes.$x8;
}
Loading
Loading