Hi there,
I'm trying to hide some columns and fields on my backend plugin. Here is what I have:
I've set my permission (acme.test.admin), and have some user groups without it.
I've created /models/post/columns.yaml and /models/post/columns_limited.yaml.
And finaly, I have /controllers/posts/config.list.yaml (poiting list parameter to /models/post/columns.yaml) and /controllers/posts/config_limited.list.yaml (poiting list parameter to /models/post/columns_limited.yaml).
What I'm trying to do is, on Posts controller, switch config files, like this:
public function __construct()
{
// Permissions
if (!$this->user->hasAccess('acme.test.admin')) {
$this->listConfig = 'config_list_limited.yaml';
}
parent::__construct();
BackendMenu::setContext('Acme.Test', 'test', 'posts');
}
I've checked the Backend\Classes\Controller code, and user is beign set on run method, not in __contruct.
How I can do this in best practice?
Last updated