Thanks for your quick response. So far I had not seen the documentation for conditionals. We are fresh EE users, so yes, we could use that. Do you think something like the following would work (pseudocode):
const condition = {
displayName: "Groups should only be allowed to edit their own pages",
name: "group-is-owner",
async handler(user) {
if (user.role === 'group') {
return {
author: {
$eq: user.id
}
};
}
return true;
},
};
I suppose that could work for some time, but it’s not very clear, since this logic should really live inside of a common controller.
It is possible to do using extensions to the content-manager plugin but it’s a bit of a dirty solution that we want to get rid of in the v4 (at least the way it’s done right now, possibly replaced by a hook system).
Yeah, I went into that rabbithole, but it’s not as easy as I imagined it to be (because the docs don’t mention anything about controllers not being executed by the content manager). Isn’t that a very basic usecase, to be able to change a previously set owner of an entity?
Do I understand you correctly: there will be a new hook system in v4, which will allow to hook into content manager actions? In case the idea of controllers is kept around I’d really appreciate an (internal) discussion if these shouldn’t be used everywhere, so there is a central place for the logic of a content type. Right now, there are so many concepts which all seem to fit somehow. I would have expected to solve this task I have by using a policy and some way to enforce that on all CRUD operations of the model.
Thanks and have a nice weekend!