This patch defines a new service and a new Access Checking handler.

CommentFileSizeAuthor
group_role_access.patch2.64 KBmatslats
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

matslats created an issue. See original summary.

kristiaanvandeneynde’s picture

So the goal is to have a _group_type requirement where you add the machine name as the value? Provided the route has a {group} parameter.

Do you have any example use cases for this? A little more explanation would go a long way :)

matslats’s picture

Yeah Sorry.
This patch enables a new requirement in the routing yml files

  requirements:
    _group_type: 'my_group_type'

My use case builds extensively on one group type - every member of the site is in one and only one such group, but other group types are used also. So I want to make routes specific to group types.

kristiaanvandeneynde’s picture

Right, I see.

That actually makes a lot of sense and the code to achieve this is exactly how it should be done (i.e. a route requirement). I'm just on the fence whether we should add edge cases like these into the module or rely on people to put it in their "glue code" for the project that requires it.

I'm worried that if we add a lot of route checks like these and hardly ever use them, we'll decrease the performance or increase the complexity of the routing system for no good reason.

What do you think?

matslats’s picture

I didn't suppose that route checks like this would affect performance.
The service is only loaded as needed.
The code is very discreet.
The meaning and usage is very straight forward.
Putting it in would I suppose save less-than-elite developers a lot of time working out how to do it.