-
Notifications
You must be signed in to change notification settings - Fork 45
feat: FORMS-943 Enable File Uploads for Public Forms #1696
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
feat: FORMS-943 Enable File Uploads for Public Forms #1696
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Release 4ad974a deployed at https://chefs-dev.apps.silver.devops.gov.bc.ca/pr-1696 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good @revanth-banala.
The functionality checks out and was able to upload on public form (while not allowing the download after submitted).
Nice work.
@revanth-banala When we try to download the uploaded file after submitting the form, it throws an error. Can you check that? Is it possible to block download or show a proper message? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes for Public file Upload looks good
|
Description
Public (anonymous) users were unable to upload files to forms that allow public access. The existing hasFileCreate middleware was blocking all file uploads for users without authentication, even when the form was configured to accept public submissions.
Solution
Updated the hasFileCreate middleware in /src/forms/file/middleware/filePermissions.js to properly handle public form access by:
Allowing authenticated users - Users with idpUserId can upload files to any form (existing behavior)
Checking form configuration for public users - For non-authenticated users, validate that:
Form exists and is active
Form has public identity provider configured
Consistent permission logic - Uses the same identity provider checking pattern as other middleware in the codebase
Maintained existing security for authenticated users
Security Considerations
authenticated users maintain same access
Public forms still require explicit public identity provider configuration
Form must be active for any file uploads
Type of Change
feat (a new feature)
Checklist
Further comments