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.

Forms & Blueprints

Save group permissions to page header

Started by Rob Walton 7 years ago · 1 replies · 562 views
7 years ago

I've created a custom admin page and I need to be able to save group permissions to the page header.

I have my blueprint setup with the following, this is the closest I've been able to get.

YAML
header.access.site:
  type: select
  label: 'Permissions'
  options:
    'level01': 'Access level 01'
    'level02': 'Access level 02'
    'level03': 'Access level 03'

This outputs the following to the page header:

YAML
access:
  site: level01

But what I need is:

YAML
access:
  site:
    level01: true

Using type: permissions instead of type: select in my blueprint outputs the correct format to the page header but it doesn't display my custom group levels on the admin page (the bottom 3 shown below).

perms|690x460,60%

Any ideas?

Any help much appreciated.

Thanks

7 years ago

Hopefully a step closer, I started over with my blueprint but still having problems:

YAML
header.access.site:
  type: checkboxes
  label: Permissions
  data-options@: '\Grav\Common\User\Group::groupNames'
  use: keys
  validate:
    type: array

Output:

YAML
access:
  site:
    level01: true
    level02: false
    level03: false

The problem is the false entries seem to break the permissions, without these it works fine so I need try and prevent them being added. I've tried using ignore_empty hoping it would prevent empty checkboxes creating the false entries but it throws an error:

ignore_empty|690x444

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1136 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 61 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 135 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 110 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 129 7 months ago