-
Notifications
You must be signed in to change notification settings - Fork 92
disable storage function #1808
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
disable storage function #1808
Conversation
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.
Pull request overview
This pull request introduces a feature flag to control user storage modification capabilities across the application. The changes span configuration, backend logic, UI templates, user profile forms, and admin interfaces.
Changes:
- Adds a new configuration flag
WEKO_RECORDS_UI_USER_STORAGE_MODIFICATION_ENABLEDto control storage modification features - Updates UI templates and backend logic to conditionally render storage modification controls based on the flag
- Modifies ProfileForm to dynamically remove storage-related fields when the feature is disabled
- Enhances admin interface to filter default storage locations based on user roles
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/weko-records-ui/weko_records_ui/config.py | Introduces the feature flag with default value of False |
| modules/weko-records-ui/weko_records_ui/views.py | Passes the feature flag value to templates as is_storage_editable |
| modules/weko-records-ui/weko_records_ui/templates/weko_records_ui/file_details_contents.html | Conditionally displays file replacement and bucket copy buttons based on the flag |
| modules/weko-user-profiles/weko_user_profiles/forms.py | Dynamically removes S3 storage fields from ProfileForm when feature is disabled |
| modules/invenio-files-rest/invenio_files_rest/admin.py | Adds role-based filtering to hide default locations from non-system administrators |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: mhaya <2446046+mhaya@users.noreply.github.com>
Co-authored-by: mhaya <2446046+mhaya@users.noreply.github.com>
Co-authored-by: mhaya <2446046+mhaya@users.noreply.github.com>
Co-authored-by: mhaya <2446046+mhaya@users.noreply.github.com>
Co-authored-by: mhaya <2446046+mhaya@users.noreply.github.com>
Add test coverage for role-based location filtering in LocationModelView
Add test coverage for ProfileForm storage field conditional removal
This pull request introduces a new configuration flag to control user storage modification features and applies this flag across the UI and backend logic to restrict access and visibility based on user roles and permissions. The changes ensure that storage modification options are only available when enabled and to authorized users, improving both security and user experience.
Feature Flag Introduction and Usage
WEKO_RECORDS_UI_USER_STORAGE_MODIFICATION_ENABLEDconfiguration flag toweko_records_ui/config.pyto control the availability of user storage modification features.weko_records_ui/views.py) to pass theis_storage_editableflag to templates based on the new configuration.UI Conditional Rendering
weko_records_ui/file_details_contents.html) to conditionally display storage modification controls only whenis_storage_editableis true. [1] [2]Form Field Restriction
ProfileForminweko_user_profiles/forms.pyto remove storage-related fields (access_key,secret_key,s3_endpoint_url,s3_region_name) when user storage modification is disabled via the feature flag.Admin View Filtering
LocationModelViewininvenio_files_rest/admin.pyto filter out default locations for non-system administrators, improving role-based visibility in the admin interface.