grav-plugin-admin icon indicating copy to clipboard operation
grav-plugin-admin copied to clipboard

json syntax error on page save in AdminController

Open Andy-Flack opened this issue 2 years ago • 4 comments

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 avatar Apr 01 '22 09:04 Andy-Flack

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 avatar Apr 01 '22 10:04 Andy-Flack

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.

Andy-Flack avatar Apr 01 '22 10:04 Andy-Flack

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

mahagr avatar Apr 04 '22 08:04 mahagr

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

Andy-Flack avatar Apr 04 '22 14:04 Andy-Flack