-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Collection list does not prevent user from deleting items, even though access control does #12362
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
Comments
First thing to consider regarding this:
For This doesn't solve your UI problem. For the admin UI deleting from the list view, we cannot run the access control for all selected documents in the list view in realtime. For this reason we allow a user to select what they need and then click delete, only then will they encounter feedback that they are prevented from deleting documents. If you consider that the list view lets you select every document available and the access control functions need to be run on the server, there isn't a good way that this can happen programatically. For your use-case it might make sense for us to add a config property to the collection config What do you think about that option? Would you use it if given this choice? |
I would, as it's probably the easiest work-around, although it's taking away from the functionality that was promised for our client. More and more, working with locales on payload we're coming to a realization that there are a lot of limitations in the current locales implementation and this probably stems from being used to a more standard way of working with locales within other content management systems, where you'd actually have the possibility to separate the locales of a document/page and be able to remove/unpublish each individually by default without doing too much custom stuff. The way that payload does this is more like "The document has duplicated fields for each locale, but depending on the locale selected we're just hiding the fields that do not belong to that locale", instead of having normal separation that we're used to. I know you have an option to publish individual locales using versions, but we tried that with multiple clients and it was extremely confusing and didn't always work as expected, that's why we decided not to use versions for per-locale publishing and instead added our arbirtrary way of handling different users having access to different locales and somehow trying to have the separation at least visually in the panel (use baseListFilter and filter out list items that have no title in the current locale, this way "indicating" which documents "actually exist" in a locale), but it (obviously from this issue) still has many limitations due to the base implementation of locales in payload. I got your suggestion, thanks for that. Hopefully payload will someday have proper locales without the need of custom solutions when trying to work with locale availability/access based on roles. |
Hey @DanRibbens, I just want this clarified. For example, I have a collection with delete access that only allows deletion for items with specific slugs. In the collection list, I should still be able to select these deletable items but when I click "Delete", the deletion won't proceed? Is that right? |
Uh oh!
There was an error while loading. Please reload this page.
Describe the Bug
Currently I have a localised website. We have a few editor roles for local markets, each of which has a few locales that they can edit and can't edit others.
For our collections, we have access controls set up in a way that should prevent users to delete/create/update locales that are not assigned to the role.
Now, probably because of the way locales are saved in payload (which is very unintuitive), an interesting phenomenon occurs with this setup: regardless of the access control rules, the user is able to delete the collection item when deleting from the list view, but is not able to delete (even his own assigned locale) from within the document edit view.
Link to the code that reproduces this issue
https://github.com/iamlinkus/payload-access-control-localization-bug
Reproduction Steps
Which area(s) are affected? (Select all that apply)
area: core, area: ui
Environment Info
The text was updated successfully, but these errors were encountered: