Problem/Motivation
The "Create Relationship" route (crm.contact_relationship_add) has a _permission set to "administer crm". We want to allow users to create relationships if they have the "create [bundle] crm relationship" permission.
Steps to reproduce
I overrode the route using a Route Alter hook (created a custom ECA action plugin to do this), changing the permission to "create employee crm relationship", and now as a user with this permission, I can use this route -- however, I see all the available relationship types, not just the ones I have permission to.
When following a link to create a specific relationship, permissions do apply correctly -- I can create relationships for the bundles I have permission for, and get access denied for those I don't.
Proposed resolution
Create a new permission handler to grant access to this route if the user has permission to create any type of relationship.
Update the resulting page to only show bundles that the user has permission to create.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork crm-3601627
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
bluegeek9 commentedThis makes sense.
At an earlier point we did not have individual permissions for relationships. This was updated when we added per bundle relationship permissions.
Comment #5
bluegeek9 commented