Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Entity overview list permission #2289

Closed
sgurlt opened this issue May 19, 2016 · 3 comments
Closed

Custom Entity overview list permission #2289

sgurlt opened this issue May 19, 2016 · 3 comments

Comments

@sgurlt
Copy link

sgurlt commented May 19, 2016

Hey,

I created a custom entity with the drupal console. After that I gave all the newly created permissions to a editor role. The editor is now able to add,delete,update the custom entities. So this works fine :)

The only thing that is not working the overview of the existing entities located at the path "admin/structure/myentity". When it try to open the url I get a access denied page.
Any thoughts?

@sgurlt
Copy link
Author

sgurlt commented May 19, 2016

Found the issue.
The console creates a access check in: /src/MyEntityHtmlRouteProvider.php:

`protected function getCollectionRoute(EntityTypeInterface $entity_type) {
if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) {
$entity_type_id = $entity_type->id();
$route = new Route($entity_type->getLinkTemplate('collection'));
$route
->setDefaults([
'_entity_list' => $entity_type_id,
'_title' => "{$entity_type->getLabel()} list",
])
->setRequirement('_permission', 'access ibe query overview')
->setOption('_admin_route', TRUE);

return $route;

}
}`

So the access check is performed on 'administer ibe query entities'.

But the permission file that got created just got the following perms:

`add myentity entities:
title: 'Create new myentity entities'

administer myentity entities:
title: 'Administer myentity entities'
description: 'Allow to access the administration form to configure myentity entities.'
restrict access: true

delete myentity entities:
title: 'Delete myentity entities'

edit myentity entities:
title: 'Edit myentity entities'

access myentity overview:
title: 'Access myentity overview'

view published myentity entities:
title: 'View published myentity entities'

view unpublished myentity entities:
title: 'View unpublished myentity entities'
`

The permission 'administer ibe query entities' is not created. I would suggest to add a permission same like nodes have here 'access myentity overview'.

@jlbellido
Copy link
Contributor

I sent a first pull request trying to solve the issue: #2394

Thanks for reporting!

@jmolivas
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants