In this way, I show only the pages with template ‘noticias’ or ‘grupos’. The problem is that I can’t show the childrens/subpages of these pages:
'panel.page.read' => function() {
if($this->target()->page()->template() === 'noticias' ||
$this->target()->page()->template() === 'noticia' || //This is the template for pages of main page 'noticias'
$this->target()->page()->template() === 'grupos' ||
$this->target()->page()->template() === 'grupo') { //This is the template for pages of main page 'grupos'
return true;
};
}
All subpages are hidden, avoid create new subpages… (There are a lot of subpages for this pages)
I tested your code in a Starterkit with blog/articles and projects/project instead of your blueprint names and it works as it should. What happens if you create a new page, does this not show up, either?
For the admin user all is ok. All pages and subpages are visible and editables.
I need that editor user can’t add new pages (the rest of pages don’t have subpages). The only thing that editor could be do is add/delete/edit subpages of ‘noticias’ and ‘grupos’.
I tested again. User editor can create a new page if the template is ‘noticias’ or ‘grupos’ (This new page is visible in panel… I check this later, because i need that he can’t do it. Now, all fields are readonly). If the template is different, he can’t create a new page.
Now, If user editor tries to create a new subpage in any of these pages, he can’t do it. Show the message " Error. You are not allowed to do this). Really, this new subpage has been created, but it’s hidden too.
This is my editor.php:
<?php
return [
'name' => 'Editor',
'default' => false,
'permissions' => [
'*' => true,
'panel.user.*' => false,
'panel.user.read' => true,
'panel.user.update' => function() {
return $this->user()->is($this->target()->user());
},
'panel.page.url' => false,
'panel.page.visibility' => false,
'panel.page.template' => false,
'panel.page.read' => function() {
if($this->target()->page()->template() === 'noticias' ||
$this->target()->page()->template() === 'noticia' || //This is the template for pages of main page 'noticias'
$this->target()->page()->template() === 'grupos' ||
$this->target()->page()->template() === 'grupo') { //This is the template for pages of main page 'grupos'
return true;
};
}
]
];
I try using only ‘panel.page.read’ but, nothing, the same problem.