-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restrict case roles by group #15570
Restrict case roles by group #15570
Conversation
(Standard links)
|
Hi @colemanw I can review this week. I might ask about the groups name/id part, but I don't have it in sensible english-y words yet. At the moment it goes something like "managed entities blah blah name xml managed entities". |
@demeritcowboy you make an eloquent point there 😁 but I'm not sure how this would affect managed entities. I just picked "name" as the key in the xml because everything else in the xml is keyed by name so I figure groups should be as well. |
My thinking is like so: Unless there was a request to have groups specifiable by name in external xml files, it's not necessary/useful because:
Hence the managed entities reference in my pseudoglish (TM) earlier, which would now be more like "managed entities name xml relationship types currently yes, groups currently no have managed entities". |
Not sure it has much benefit either, but in general I think storing names is better than storing ids for portability. Sometimes you create groups on a staging site and they end up with a different id than the ones on the live site. Also @lcdservices requested that groups be by name in the xml and he's the one who commissioned this feature :) |
Ok so there was a request - got it. |
@colemanw tested and this is working as expected. Can you detail how these params would be handled in the XML file (vs. via the UI)? I tried adding |
@colemanw based on how the xml is constructed when the case type is configured in the UI, it should look like this:
However, when I add that to our XML file and load the case config via the UI, it does not populate with the group. It does filter in the case activity form. So it's parsing the XML and applying the filter correctly. But I think we should ensure the UI accurately reflects the XML params. The case role groups are a single tag |
I've confirmed that the role filter is working properly when configured via the XML file. However, as with the activity field, the values do not preload when viewing an XML-based config in the UI. |
@lcdservices Is this a case type you've already "forked"? When you make changes in the xml after forking they are disconnected. I've found that confusing but it's always been that way I think. It displays correctly for me in the UI when I add a I have a couple minor things but I'll wait until you guys finish first. |
@demeritcowboy no, it's not forked. We're running off the XML with no modification. But if someone did want to fork it, I would expect the full XML config to load in the UI as their starting point. Other alterations to the XML are reflected in the UI. |
@lcdservices can you show me your xml file? |
If it helps I was noticing that if the group has is_hidden=1 or is_active=0 in civicrm_group it behaves the way you're seeing, where it DOES get picked up for filtering on manage case popups, and other xml file changes get reflected in the UI on the case type edit page, but you don't see the group on the case type edit page. |
@demeritcowboy have you had a chance to |
Did that get resolved? Otherwise the main thing I saw is a visual weirdness. See below.
|
I have to admit that I do not fully understand the discussion.
|
@colemanw @demeritcowboy ping - what is the status? |
I would agree. |
The issue with the group filter loading in the UI is specific to our site. I implemented the PR on a clean install and it loads in the UI as expected. I reviewed the discussion and don't see any other items to discuss. There was discussion about the use of the group name in the xml file, but that was affirmed. It was a specific request because it aids in portability. @colemanw can you do a test for this, and then we can get it merged? |
Thanks everyone for the review. Based on testing by @lcdservices I think the only thing missing from this was a unit test, which I've added. So I believe this can be merged once that passes. |
@colemanw Am curious why the last minute change in line 170 in BAO/CaseType.php? c4bfbde#diff-f9628269feadc01ddab8f94b9be7adb9 |
@demeritcowboy I added the |
I see. I was thinking more about the original |
Well currently only groups is allowed to be an array, so this way we force it to be an array rather than relying on how it's input. |
Overview
Allows an admin to limit selection of contacts to certain groups when adding case roles.
Before
Any contact can be selected for a case role.
After
Each case role selector can be limited to one or more group.
Doing so will affect the contact selectors for add/edit role on the case summary screen. Those selectors will also have the "New Contact" buttons disabled.
Technical Details
Stores group by name in order to be xml-friendly. This also changes the
activityAsgmtGrps
setting to store group name instead of id (although it will still work with previously stored ids for backward-compat).