Structure field: disable add/delete row only?

Hi,

In a specific type of page, I programmatically populate a structure field regarding a another structure field defined elsewhere in the panel.

I would like that users with role “A” were able to edit fields from this structure field but unable to add or delete a row in this structure field.

Is there a way to achieve this?
Thanks for your advises :slight_smile:

Certainly not out of the box, at least not in a nice way. We don’t even have editing options per role on the field level, anyway.

You can definitely set a max limit for the number of entries. And you could probably use a pre update hook to check if the number of entries is still the same as before, but this only kicks in after the user has already tried to remove an entry. It would work to prevent deleting entries, but is not very user friendly. If you combine it with some info or help text, you can at least warn the user to not even try and delete stuff. If they do it anyway and fail, too bad.

Maybe if I replace structure field rows by sub-pages, I probably could achieve something similar with the new role permissions settings developed in the 3.2 Kirby version :thinking:

If you use subpages, you can prevent deletion, anyway.

Yes but as I use hook to delete/add rows in the structure field if the admin user modified the “original” structure field from which the second structure field is populated, I can’t set page delete to false.

But with Kirby 3.2 I will be able to set delete page to false for role “A” and delete page to true for admin, so my hook will do the job if the admin user change number of row in the “original” structure field I’m right?

We’ll see. We need an option to override blueprint settings programmatically, hope that will come in 3.2 as well.

I found a feature that max: true by coincidence :slight_smile:
This provide disable to create new item. But to disable delete min: true not working :frowning:
I think more management features should come to structure field.
Of course it doesn’t allow adding items when max is true

@byybora Excactly, that’s what I already mentioned above in my first post…