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

Conversation

noliveleger
Copy link
Contributor

@noliveleger noliveleger commented Nov 6, 2023

Description

Account setting Require auth to see forms and data is not used anymore and OpenRosa server URL is updated based on anonymous user Add submissions permission.

⚠️ Add submissions do NOT imply View form anymore.

Additional info

A new environment variable has been introduced ENKETO_REDIS_MAIN_URL and must be set.
require_auth field has been removed from reports (Admin and Project views)

Notes

OpenRosa server url is modified directly in redis for Enketo to comply Kobocat (new) requirements. i.e.: Projects with required auth are listed at https://kobocat/ and projects which allow anonymous submissions are listed at https://kobocat/

Related issues

Needs kobotoolbox/kobo-install#236

Blocked by
kobotoolbox/kobocat#904

@noliveleger noliveleger marked this pull request as draft November 6, 2023 22:12
@noliveleger noliveleger requested a review from jnm November 7, 2023 14:17
@noliveleger noliveleger changed the title WIP - Require auth at project level Allow Add submissions permission assignment to anonymous user Nov 7, 2023
@noliveleger noliveleger added API Changes related to API endpoints Back end labels Nov 7, 2023
@noliveleger noliveleger marked this pull request as ready for review November 7, 2023 16:04
@noliveleger noliveleger changed the base branch from feature/per-project-anonymous-access to beta November 7, 2023 17:35
@noliveleger noliveleger changed the title Allow Add submissions permission assignment to anonymous user [TASK - 82 ] Allow Add submissions permission assignment to anonymous user Nov 8, 2023
@noliveleger noliveleger changed the title [TASK - 82 ] Allow Add submissions permission assignment to anonymous user [TASK-82] Allow Add submissions permission assignment to anonymous user Nov 8, 2023
Copy link

@jamesrkiger
Copy link
Contributor

jamesrkiger commented Dec 15, 2023

The tooltip in the Anonymous Submission component is causing sizing issues in the forms it has placed in. It seems to be making the form containers horizontally scrollable. For example, in the modal sharing form:
image

And in the form landing component:
image

Cutoff tooltip:
image

Adjust anon submission tooltip layout issue
@jnm jnm changed the base branch from beta to release/2.023.48 December 20, 2023 17:27
@jnm jnm changed the base branch from release/2.023.48 to release/2.023.52 December 30, 2023 03:34
kobo/settings/base.py Outdated Show resolved Hide resolved
kpi/deployment_backends/mock_backend.py Outdated Show resolved Hide resolved
kpi/migrations/0055_set_require_auth_per_project.py Outdated Show resolved Hide resolved
kpi/mixins/object_permission.py Outdated Show resolved Hide resolved
kpi/mixins/object_permission.py Outdated Show resolved Hide resolved
kpi/permissions.py Outdated Show resolved Hide resolved
except (User.extra_details.RelatedObjectDoesNotExist, KeyError):
require_auth = False
require_auth = obj.asset.deployment.xform.require_auth
except (DeploymentNotFound, AttributeError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of a weird situation, but I guess AttributeError is needed because it's possible for the xform property to return None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly.

'kpi.deployment_backends.backends.MockDeploymentBackend.xform',
MagicMock(),
) as xf_mock:
type(xf_mock).require_auth = PropertyMock(return_value=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wild. If you explain it to me, I might learn something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, you won't learn anything today. It's a wrong try/error mock of a non-existing property (i.e.: MockDeploymentBackend.xform) but I could not make it work so I added a dummy property xform to MockDeploymentBackend.
Long story short: this can be simplified with xf_mock.require_auth = False

kpi/utils/django_orm_helper.py Outdated Show resolved Hide resolved
@noliveleger noliveleger requested a review from jnm January 8, 2024 15:18
@noliveleger noliveleger force-pushed the require-auth-at-project-level branch 2 times, most recently from 31c5143 to f496808 Compare January 11, 2024 19:59
@noliveleger noliveleger force-pushed the require-auth-at-project-level branch from f496808 to e4d6ad3 Compare January 11, 2024 20:02
@jnm jnm merged commit 527eb46 into release/2.023.52 Jan 11, 2024
4 checks passed
@jnm jnm deleted the require-auth-at-project-level branch January 11, 2024 20:27
@jnm jnm removed the blocked label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Changes related to API endpoints Back end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants