Skip to content

Added "rename" action on dms files, only zope admins can edit id#111

Open
chris-adam wants to merge 1 commit intomasterfrom
PARAF-405/dms_file_rename
Open

Added "rename" action on dms files, only zope admins can edit id#111
chris-adam wants to merge 1 commit intomasterfrom
PARAF-405/dms_file_rename

Conversation

@chris-adam
Copy link
Copy Markdown
Contributor

@chris-adam chris-adam commented Apr 3, 2026

Summary by CodeRabbit

  • New Features
    • Added a dedicated rename action and multi-item rename form for DMS files, with UI controls to rename identifiers and titles where permitted.
  • Permissions
    • Editing of item IDs is restricted to Zope administrators; form enforces per-item permission checks and shows/hides inputs accordingly.
  • Changelog
    • Updated changelog with the new rename action and contributor attribution.

@chris-adam chris-adam requested a review from sgeulette April 3, 2026 13:18
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3942b38c-7dee-449e-9b8f-8c62f8578ecc

📥 Commits

Reviewing files that changed from the base of the PR and between cbc535e and e6918b5.

📒 Files selected for processing (6)
  • CHANGES.rst
  • imio/dms/mail/browser/actionspanel.py
  • imio/dms/mail/configure.zcml
  • imio/dms/mail/skins/imio_dms_mail/folder_rename_form.cpt
  • imio/dms/mail/skins/imio_dms_mail/folder_rename_form.cpt.metadata
  • imio/dms/mail/utils.py
✅ Files skipped from review due to trivial changes (4)
  • imio/dms/mail/skins/imio_dms_mail/folder_rename_form.cpt.metadata
  • CHANGES.rst
  • imio/dms/mail/browser/actionspanel.py
  • imio/dms/mail/utils.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • imio/dms/mail/configure.zcml
  • imio/dms/mail/skins/imio_dms_mail/folder_rename_form.cpt

📝 Walkthrough

Walkthrough

Adds a "rename" action for DMS files, exposes an is_zope_admin utility, updates allowed attributes in ZCML, adds a rename form template and its metadata, and exposes the action in the actions panel.

Changes

Cohort / File(s) Summary
Changelog
CHANGES.rst
Replaced placeholder with entry for version 3.1.2 documenting the new "rename" action and contributor attribution.
Actions Panel
imio/dms/mail/browser/actionspanel.py
Extended DmsFileActionsPanelView.ACCEPTABLE_ACTIONS to include "rename".
ZCML
imio/dms/mail/configure.zcml
Added is_zope_admin to various-utils page allowed_attributes.
Utils
imio/dms/mail/utils.py
Added is_zope_admin(self) method to UtilsMethods to expose Zope-admin status to templates.
Templates
imio/dms/mail/skins/imio_dms_mail/folder_rename_form.cpt
New TAL template rendering the rename form with permission- and admin-gated fields and validation handling.
Form Metadata
imio/dms/mail/skins/imio_dms_mail/folder_rename_form.cpt.metadata
New metadata registering validator validate_folder_rename and wiring success/cancel/failure actions.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant ActionPanel as ActionPanel<br/>(View)
    participant Template as Rename Form<br/>(TAL)
    participant Utils as UtilsMethods<br/>(BrowserView)
    participant Storage as DMS Item<br/>(Backend)

    User->>ActionPanel: Request object actions / click "rename"
    ActionPanel->>ActionPanel: Check ACCEPTABLE_ACTIONS contains "rename"
    ActionPanel->>Template: Render folder_rename_form
    Template->>Utils: is_zope_admin()
    Utils-->>Template: return admin status
    Template->>User: Display form (editable id if admin, gated fields otherwise)
    User->>Template: Submit rename form
    Template->>Storage: Validate and perform rename
    Storage-->>Template: success / failure
    Template->>User: Redirect or show errors
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • sgeulette

Poem

🐰 A little rabbit found a name to mend,

Hopped to templates, checks, and ZCML to send.
Admins may tweak the id with cheer,
While forms validate and errors clear.
Hop—rename—then hop away, my dear!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding a 'rename' action to dms files with access restriction to zope admins for id editing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PARAF-405/dms_file_rename

Comment @coderabbitai help to get the list of available commands and usage tips.

@chris-adam chris-adam force-pushed the PARAF-405/dms_file_rename branch from cbc535e to fbeb8d1 Compare April 3, 2026 13:19
@chris-adam chris-adam force-pushed the PARAF-405/dms_file_rename branch from fbeb8d1 to e6918b5 Compare April 3, 2026 13:19
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.

1 participant