-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
APIv4-based smart groups #16666
APIv4-based smart groups #16666
Conversation
(Standard links)
|
@colemanw style warning |
@colemanw one issue we have with existing smart groups is that they can become a security hole in some cases ie
I feel this has mostly been seen with custom groups but probably could be seen with an entity tag or similar & I think we should have some (tested) way to identify what entities are required for a saved search to be valid |
In that scenario the APIv4 query would bomb with a missing sql column. But if we were to fix that issue then yes we'd wind up with the potential security implication. |
@colemanw which is good & we should lock that in with a test. It doesn't have to be in scope for this PR but we should be thinking about how to identify when a search is invalidated by a DB change |
I'm not sure that's necessary and would worry about that information getting out of sync with the API params. If we can parse it from the params once then we can do it again. |
@eileenmcnaughton @colemanw My thinking is that if all the where entities are no longer present in the database for whatever reason, rather than trying to run the SQL we should throw and Exception or something so that it can bubble up somewhere sensible. The other part of things would be handy to have is that we have no way when say a user goes to delete a custom field or a group or a tag for instance, saying Hey this thing is required as part of smart groups x y z a b c (or maybe saved search rather than smart group) Where as if you look at price sets if a price set is linked to a related entity (contribution, contribution page, event) then it will stop you from deleting it which feels like a better user flow. I tend to feel an Exception is much nicer error than say a DB error |
retest this please |
@colemanw my position on the depends-on-entities is that it's not blocking but we should continue to think about it & keep it at the top of mind. But, can we add a test to ensure that the use of a deleted-custom-group in the where clause throws an exception to protect against someone fixing it |
eee8efb
to
4de4307
Compare
Calling api get with no return fields specified is always risky during upgrades because upgrades can add/drop columns.
4de4307
to
47cef48
Compare
I think this is OK to merge as is - there are some outstanding things
However, as a first step in this area I feel this is solid and we can still evolve it more over the next few months. This will have no impact on anyone who doesn't actively use this new function |
@eileenmcnaughton take note of the commit message in 47cef48 - that's not the first time I've had to fix a crash caused by the use of api.get in an upgrade fn. |
Overview
Allows smart groups to be created with APIv4 params instead of search form values. Adds a button to save them from the api explorer.
Before
Smart groups only work with search form values.
After