Skip to content

[RECYCLE BIN] Implement permission for accessing recyclebin#4176

Open
rohnsha0 wants to merge 7 commits into
rohnsha0-plip-recyclebinfrom
rohnsha0/issue-4173
Open

[RECYCLE BIN] Implement permission for accessing recyclebin#4176
rohnsha0 wants to merge 7 commits into
rohnsha0-plip-recyclebinfrom
rohnsha0/issue-4173

Conversation

@rohnsha0

@rohnsha0 rohnsha0 commented May 14, 2025

Copy link
Copy Markdown
Member

fixes #4173

includes:-

  • centralised features custom permission
  • recyclebin content filters out contents deleted or owned by a user, but all contents shown to site admin/manager

@rohnsha0 rohnsha0 requested a review from davisagli May 14, 2025 15:58
@rohnsha0 rohnsha0 linked an issue May 14, 2025 that may be closed by this pull request

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Casing of recycle bin. Otherwise this looks good. Needs a technical review.

Comment thread Products/CMFPlone/controlpanel/permissions.zcml Outdated
Comment thread Products/CMFPlone/profiles/default/actions.xml Outdated
Comment thread Products/CMFPlone/profiles/default/controlpanel.xml Outdated
Comment thread Products/CMFPlone/profiles/default/rolemap.xml Outdated
Comment thread news/4172.feature Outdated
@rohnsha0 rohnsha0 mentioned this pull request May 17, 2025
Comment thread Products/CMFPlone/browser/recyclebin.py Outdated

def _get_context(self):
"""Get the context (Plone site)"""
return self.context

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't appear to be used.

Comment thread Products/CMFPlone/recyclebin.py Outdated
# Additional check for Manager or Site Administrator roles
user = sm.getUser()
user_roles = user.getRolesInContext(context)
return "Manager" in user_roles or "Site Administrator" in user_roles

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the explicit check for roles. That's already included in the checkPermission call (it checks that the current user has one of the roles for which the permission has been granted)

Comment thread Products/CMFPlone/recyclebin.py Outdated
"""Stores deleted content items"""

# Permission for managing recycle bin
MANAGE_RECYCLEBIN = "Products.CMFPlone.ManageRecycleBin"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be "Manage recycle bin". checkPermission uses the permission's title, not its id

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

Comment thread Products/CMFPlone/recyclebin.py Outdated
1. They have the ManageRecycleBin permission, or
2. They are a Manager or Site Administrator, or
3. They are the owner of the item, or
4. They deleted the item

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

3 and 4 are a nice idea, but currently the "Manage recycle bin" permission is only granted to Managers and Site Administrators, which means that the recycle bin can't be accessed by users who don't have one of those roles.

There are a lot of details to get right here. I strongly suggest we focus on making this work only for Managers and Site Administrators for now, and then come back to it later if we want to provide more filtered access to other users.

@rohnsha0 rohnsha0 May 23, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done
will soon create an issue for tracking

edit: #4185

# Log in as the test user
user = self.portal.acl_users.getUser("testuser")
user = user.__of__(self.portal.acl_users)
newSecurityManager(None, user)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use the login function from plone.app.testing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

@rohnsha0 rohnsha0 requested a review from davisagli May 29, 2025 15:51
@rohnsha0 rohnsha0 changed the base branch from rohnsha0-plip-recyclebin to rohnsha0-plip-recyclebin-patch September 21, 2025 10:28
@rohnsha0 rohnsha0 changed the base branch from rohnsha0-plip-recyclebin-patch to rohnsha0-plip-recyclebin September 21, 2025 10:29
@cekk

cekk commented Mar 19, 2026

Copy link
Copy Markdown
Member

@davisagli Is this ready to merge, or do you have any remaining concerns?

@davisagli

Copy link
Copy Markdown
Member

@cekk We decided this is out of scope for the first version of the recycle bin. Too many potential edge cases. For now, the recycle bin is available to site admins only.

@pnicolli pnicolli moved this from Todo to In progress in Bucharest Sprint 2026 Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

Recycle bin: allow non-admins to access the recycle bin?

6 participants