Skip to content

Commit

Permalink
Merge pull request #23684 from colemanw/relationshipCachePermissions
Browse files Browse the repository at this point in the history
RelationshipCache - Set 'get' permissions
  • Loading branch information
eileenmcnaughton authored Jun 4, 2022
2 parents 194e85b + 962e14b commit 1db72bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CRM/Contact/BAO/RelationshipCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,18 @@ public static function createInsertUpdateQueries() {
return $queries;
}

/**
* @return array
*/
public function addSelectWhereClause() {
// Permission for this entity depends on access to the two related contacts.
$contactClause = CRM_Utils_SQL::mergeSubquery('Contact');
$clauses = [
'near_contact_id' => $contactClause,
'far_contact_id' => $contactClause,
];
CRM_Utils_Hook::selectWhereClause($this, $clauses);
return $clauses;
}

}
5 changes: 5 additions & 0 deletions CRM/Core/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,11 @@ public static function getEntityActionPermissions() {
'edit all contacts',
],
];
// Readonly relationship_cache table
$permissions['relationship_cache'] = [
// get is managed by BAO::addSelectWhereClause
'get' => [],
];

// CRM-17741 - Permissions for RelationshipType.
$permissions['relationship_type'] = [
Expand Down

0 comments on commit 1db72bc

Please sign in to comment.