Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Protect a folder from deletion without protecting children pages

Started by nix 2 years ago · 0 replies · 118 views
2 years ago

Hello,

In many grav sites, I have the following architecture:

  • page A
    • children 1
    • children 2
    • ...
    • children N

I would like to prevent a user to delete the page A by mistake, as it deletes all the children pages. If I edit the CRUD on page A with :

YAML
permissions:
    groups:
        defaults:
            delete: false

The delete button in admin disappear on page A, and that is perfect. But it also disappears on the children pages.

So I need the children pages not to inherit permissions by default. I have tried many different solutions for that.

  • Editing the root page doesn't seem to have an effect.

  • Modifying the template of the children pages with:

    YAML
    form:
    fields:
    tabs:
      type: tabs
      active: 1
    
      fields:
        security:
          fields:
                header.permissions.inherit:
                  replace@: true
                  type : toggle
                  toggleable: true
                  default: 0
                  label: Permissions des parents
                  help: PLUGIN_ADMIN.PAGE_INHERIT_PERMISSIONS_HELP
                  highlight: 1
                  options:
                    1: PLUGIN_ADMIN.YES
                    0: PLUGIN_ADMIN.NO
                  validate:
                    type: bool
    

to change the default value of the inherit permission. It results in an odd behavior : the inherit permission field is still present in the admin and also the new field, and there is a mirrored behavior : when i change the value of one of these field, the other field is changed as well. Anyhow, the delete button is not present.

Do you have an idea of what I can try?
Best
n

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 195 2 months ago
Themes & Styling · by Ian, 2 months ago
3 91 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 451 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 45 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 125 3 months ago