Answers.Body: <p>To have it so the View only shows 'My Cases' you can build the View based on CiviCRM Relationships then use Contextual Filters to filter to get only those relationships that associate to the current user, and then join on the Case.</p>
  <p><a href="https://i.sstatic.net/fnRu4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fnRu4.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-15T20:28:49.343Z
Answers.Text: I think this is almost there, but I do need the filter to be a group access permission because sometimes supervisors will look up case notes that are both historical and current. The settings above also require a relationship to the case, but supervisors don't need to be a relationship to the case - just the access to view the contact record.
Answers.UserDisplayName: Kristine
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-16T00:12:15.860Z
Answers.Text: i would do that via 2 different displays then
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-17T17:38:20.517Z
Answers.Text: Maybe it's not clear. I'll revise the post to clarify that the case access should be based on an existing group relationship.
Answers.UserDisplayName: Kristine
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-15T20:14:01.310Z
Answers.LastActivityDate: 2022-05-15T20:14:01.310Z
Answers.UserDisplayName: petednz - fuzion
Body: <p>I have a Drupal 7 Views that produces a case activities report. It has columns like scheduled activity date, contact id, notes, etc. The user can search by contact id and all activities related to that contact id appears. From this <a href="https://civicrm.stackexchange.com/questions/15821/civicrm-entity-and-acl-permissions">post</a>, this is because CiviCRM Entity does not respect CiviCRM's ACL permission.</p>
  <p>I want to see if it's possible to restrict the case activities that only show up if the user has an existing group relationship to the case records. I think I'm close. I have the Group ID as a relationship (access control: clients). I just can't get Views to check the login user's CiviCRM group and validate it against the civicrm ACL.</p>
  <p>For example: User A belongs to Group A (staff group). In the ACL, Group A can view contacts from Group B (the clients). When the user uses the case activities report, they should only be able to search contacts to which they have the ACL access from in Group B (not Group C, D, etc.).</p>
  <p>The challenge is filtering on the activities on the user login's group ID.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-17T20:39:07.067Z
Comments.Text: I don't think i can help more. we have tended to avoid ACLs and use Permissioned Relationships instead, and then that is what controls which contacts the logged in user will see via the views (and in CiviCRM itself).
Comments.UserDisplayName: petednz - fuzion
Tags: <groups><drupal-views>
Title: Check Group Permission in Drupal Views
ThreadText: # Check Group Permission in Drupal Views
  
  (Asked by: username_0 on 2022-05-15)
  
  I have a Drupal 7 Views that produces a case activities report. It has columns like scheduled activity date, contact id, notes, etc. The user can search by contact id and all activities related to that contact id appears. From this [post](https://civicrm.stackexchange.com/questions/15821/civicrm-entity-and-acl-permissions), this is because CiviCRM Entity does not respect CiviCRM's ACL permission.
  
  I want to see if it's possible to restrict the case activities that only show up if the user has an existing group relationship to the case records. I think I'm close. I have the Group ID as a relationship (access control: clients). I just can't get Views to check the login user's CiviCRM group and validate it against the civicrm ACL.
  
  For example: User A belongs to Group A (staff group). In the ACL, Group A can view contacts from Group B (the clients). When the user uses the case activities report, they should only be able to search contacts to which they have the ACL access from in Group B (not Group C, D, etc.).
  
  The challenge is filtering on the activities on the user login's group ID.
  
  **Tags:** groups, drupal-views
  
  > **Comments:**
  > **username_1**: I don't think i can help more. we have tended to avoid ACLs and use Permissioned Relationships instead, and then that is what controls which contacts the logged in user will see via the views (and in CiviCRM itself).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-05-15. Score: 0
  
  To have it so the View only shows 'My Cases' you can build the View based on CiviCRM Relationships then use Contextual Filters to filter to get only those relationships that associate to the current user, and then join on the Case.
  
  [![enter image description here](https://i.sstatic.net/fnRu4.png)](https://i.sstatic.net/fnRu4.png)
  
  > **Comments:**
  > **username_0**: I think this is almost there, but I do need the filter to be a group access permission because sometimes supervisors will look up case notes that are both historical and current. The settings above also require a relationship to the case, but supervisors don't need to be a relationship to the case - just the access to view the contact record.  
  > **username_1**: i would do that via 2 different displays then  
  > **username_0**: Maybe it's not clear. I'll revise the post to clarify that the case access should be based on an existing group relationship.  
  
  ---
  
  