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

Command icon 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

freelock created an issue. See original summary.

bluegeek9’s picture

This makes sense.

At an earlier point we did not have individual permissions for relationships. This was updated when we added per bundle relationship permissions.

  • bluegeek9 committed 3c1d34e5 on 1.0.x
    feat: #3601627 crm.contact_relationship_add route should be accessible...
bluegeek9’s picture

Status: Active » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support makes this project sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triage issues and adding more context to existing issues.
  • Flagging CRM as a favorite on the project page to help others discover it and show your support.
  • Review the Developer Docs for accuracy and clarity.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.