wagtail / wagtail

A Django content management system focused on flexibility and user experience
https://wagtail.org
BSD 3-Clause "New" or "Revised" License
18.19k stars 3.84k forks source link

Add ownership-based permission for non-page models #6731

Open andre-fuchs opened 3 years ago

andre-fuchs commented 3 years ago

I would love to see the built in permissions for pages to be applied to snippets as well.

So that an editor can only add and change its own snippets. Imagine the following scenario: A website for a cultural festival is managed by multiple editors and moderators. We use snippets to store all the sub-events in the database. No need to use pages for these tiny bits of information as we just show a calendar overview on one page and do not need an URL for each tiny sub-event bit.

The current situation means either that an editor can add snippets, but not change any (via Django permissions), or that the editor can change all snippets, regardless of owner-/authorship.

In general, I would love to see these page permissions and publishing workflow on snippets as well. Naive questions: Is it possible to use the Page model without the view/URL? I know about the concept of the page tree, but maybe there is an quick and dirty way to cripple "pages" back into "models" with most of their goodies.

laymonage commented 8 months ago

Most features from pages are now available via mixins: https://docs.wagtail.org/en/stable/topics/snippets/features.html

We don't have something like an OwnershipMixin yet, but that seems pretty feasible...

For permissions, snippet viewsets can set their permission_policy, but we're looking to have a better way to configure model permissions without tying them to views.