getgrav / grav-plugin-admin

Grav Admin Plugin
http://getgrav.org
MIT License
355 stars 227 forks source link

json syntax error on page save in AdminController #2267

Open Andy-Flack opened 2 years ago

Andy-Flack commented 2 years ago

Trying to set up user specific editing rights on a page Allows setting inherit permissions true and page authors to username crashes when attempting to set any group value arguments coming in to AdminController are

array:11 [[▼]()
  "header" => array:6 [[▼]()
    "title" => "test"
    "media_order" => ""
    "body_classes" => ""
    "order_by" => ""
    "order_manual" => ""
    "permissions" => array:1 [[▼]()
      "authors" => array:1 [[▼]()
        0 => "andyf"
      ]
    ]
  ]
  "content" => "test page"
  "folder" => "test"
  "route" => "/dashboard/exchange"
  "name" => "default"
  "ordering" => "0"
  "order" => ""
  "order-child" => ""
  "blueprint" => "foo"
  "_json" => array:1 [[▼]()
    "header" => array:1 [[▼]()
      "permissions" => array:1 [[▼]()
        "groups" => array:2 [[▼]()
          "internal" => "{"create":"1","read":"1","update":"1","delete":"1"}"
          0 => array:1 [[▼]()
            "dashboard/exchange/test" => ""
          ]
        ]
      ]
    ]
  ]
  "lang" => ""
Andy-Flack commented 2 years ago

Also found that a groups value e.g. site.internal that happily works and exists in the groups.yaml as

internal:
  access:
    site:
      login: true
      internal: true
  readableName: internal
  description: internal
  enabled: true

working fine to restrict access to pages and menus does not show on the list of page access entries, you get an initial flash and the a blank entry in the dropdown because the entry cannot be found. You end up with multiple blank entries with allowed or denied but no idea what the group is it refers to.

Andy-Flack commented 2 years ago

also comes up with a fetch failed cannot convert undefined to object if you set the permissions of a parent page directly in the frontmatter and the group is denied edit rights. It still shows the page on the Admin page list and the contents when you try to edit it, but complains as it shows the page contents.

mahagr commented 2 years ago

Can you please give a screenshot and/or maybe look into logs to get the error?

Andy-Flack commented 2 years ago

Contents of the red error box

56299/fetchMedia/<@http://192.168.1.106:8081/user/plugins/admin/themes/grav/js/admin.min.js?bb1ca06410:4325:16 56299/request/<@http://192.168.1.106:8081/user/plugins/admin/themes/grav/js/admin.min.js?bb1ca06410:1072:12

Debug additions that come up • Page cache disabled, rebuilding pages.. • debugCache miss: 'pages::getDistinctValues()' • debugCache miss: 'pages::getDistinctValues()'

Nothing shows in the grav log

at his point the parent page has