Non-admins should be able to view connection roles

Created on 15 May 2024, 7 months ago
Updated 16 May 2024, 7 months ago

Problem/Motivation

Households are a key feature of RedHen, and it should be possible to display household members and their role in the household to users in that household without them having to be administrators.

Steps to reproduce

SETUP

  1. Build a view based on contacts with relationships to the contact's organization and the organization's connections.
  2. Add a field to display the connection's role.
  3. Add a contextual filter for contact's user ID, defaulting to the logged-in user.
  4. Save the view.
  5. Edit permissions for authenticated users to grant:
    • RedHen Connections: Household Member: View active connections
    • RedHen Connections: Contact: View own active connections
    • RedHen Connections: View active connection entities
    • RedHen Connections: View connection role entities

TEST
View the view as an administrator. Notice that you can see contact role for all members of the household.
View the view as an authenticated but non-admin user.

NOTICE: that you can see no contact roles for anyone in the household.
EXPECT: that you can see contact roles for all household members, given the permission grants mentioned above.

Proposed resolution

Observations:

  • The \Drupal\redhen_connection\Entity\ConnectionRole entity doesn't declare an access handler.
  • There is no ConnectionRoleAccessControlHandler class.

Proposed resolution:

  • Have the ConnectionRole entity declare an access handler.
  • Implement a \Drupal\redhen_connection\ConnectionRoleAccessControlHandler class to regulate access.
  • Use the available "view connection role entities" permission to grant view and view label access.
  • Use the available "administer connection role entities" permission for create, modify and delete operations.

User interface changes

None.

API changes

None.

Data model changes

None.

Feature request
Status

Needs review

Version

2.1

Component

Connections

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024