return $relationshipsDT;
}
+ /**
+ * @inheritDoc
+ */
+ public function apiWhereClause($tableAlias) {
+ // Generate an acl clause for both contacts in the relationship
+ $clauses = array();
+ foreach (array('a', 'b') as $a) {
+ $clause = CRM_Contact_BAO_Contact_Permission::cacheSubquery("`$tableAlias`.contact_id_$a");
+ if ($clause !== NULL) {
+ $clauses[] = $clause;
+ }
+ }
+ return $clauses ? implode(' AND ', $clauses) : NULL;
+ }
+
}
// Contact-related data permissions.
// CRM-14094 - Users can edit and delete contact-related objects using inline edit with 'edit all contacts' permission
$permissions['address'] = array(
- 'get' => array(
- 'access CiviCRM',
- 'view all contacts',
- ),
+ // get is managed by BAO::apiWhereClause
+ 'get' => array(),
'default' => array(
'access CiviCRM',
'edit all contacts',
$permissions['phone'] = $permissions['address'];
$permissions['website'] = $permissions['address'];
$permissions['im'] = $permissions['address'];
- $permissions['loc_block'] = $permissions['address'];
- $permissions['entity_tag'] = $permissions['address'];
- $permissions['note'] = $permissions['address'];
+ // @todo - implement CRM_Core_BAO_EntityTag::apiWhereClause and remove this heavy-handed restriction
+ $permissions['entity_tag'] = array('get' => array('access CiviCRM', 'view all contacts')) + $permissions['address'];
+ // @todo - ditto
+ $permissions['note'] = $permissions['entity_tag'];
// Allow non-admins to get and create tags to support tagset widget
// Delete is still reserved for admins
//relationship permissions
$permissions['relationship'] = array(
- 'get' => array(
- 'access CiviCRM',
- 'view all contacts',
- ),
+ // get is managed by BAO::apiWhereClause
+ 'get' => array(),
'delete' => array(
'access CiviCRM',
'edit all contacts',
'edit all events',
),
);
+ // Loc block is only used for events
+ $permissions['loc_block'] = $permissions['event'];
// File permissions
$permissions['file'] = array(