Skip to content

Conversation

@mhaya
Copy link
Contributor

@mhaya mhaya commented Jan 21, 2026

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

  • Added the WEKO_RECORDS_UI_USER_STORAGE_MODIFICATION_ENABLED configuration flag to weko_records_ui/config.py to control the availability of user storage modification features.
  • Updated the backend (weko_records_ui/views.py) to pass the is_storage_editable flag to templates based on the new configuration.

UI Conditional Rendering

  • Modified the file details template (weko_records_ui/file_details_contents.html) to conditionally display storage modification controls only when is_storage_editable is true. [1] [2]

Form Field Restriction

  • Updated the ProfileForm in weko_user_profiles/forms.py to 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

  • Enhanced the LocationModelView in invenio_files_rest/admin.py to filter out default locations for non-system administrators, improving role-based visibility in the admin interface.

Copy link

Copilot AI left a 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_ENABLED to 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.

mhaya and others added 5 commits January 22, 2026 16:53
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>
Copy link

Copilot AI commented Jan 22, 2026

@mhaya I've opened a new pull request, #1809, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Jan 22, 2026

@mhaya I've opened a new pull request, #1810, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 7 commits January 22, 2026 08:03
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
@ivis-miyachi ivis-miyachi merged commit ccd8e5a into develop_v2.0.0 Jan 23, 2026
19 of 90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants