Skip to content

Enabled ignore_common_filters on IS_IN_DB #642

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

Closed
wants to merge 2 commits into from

Conversation

agrogers
Copy link

@agrogers agrogers commented Oct 6, 2020

IS_NOT_IN_DB('...', ignore_common_filters=True) had already been implemented but IS_IN_DB had not.

Example:
db.auth_user.SelectedOrganisationID.requires = IS_IN_DB(db, 'Organisation.id', '%(LongName)s', ignore_common_filters=True)

Actually, I really wanted to use the Set method (db(query, ignore_common_filters=True)) in IS_IN_DB but it does not seem to work.

IS_NOT_IN_DB('...',  ignore_common_filters=True) had already been implemented but IS_IN_DB had not.

Example:
db.auth_user.SelectedOrganisationID.requires = IS_EMPTY_OR(IS_IN_DB(db, 'Organisation.id', '%(LongName)s', multiple=False, zero=T(''), ignore_common_filters=True))

I really wanted to use this method of getting a Set but it does not seem to work: db(query, ignore_common_filters=True)
The IS_IN_DB validator was ignoring the ignore_common_filters option when it was added to the Set definition. It now checks if this has been specified. This improves the previous change which only checked if the ignore_common_filters option was specified in the IS_IN_DB function.
@leonelcamara
Copy link
Contributor

This should not be merged because it does this while building the set: table._common_filter = None and doesn't set the filters back afterwards. Meaning the table will lose its filters after being used by IS_IN_DB causing potential security problems depending on how the filters are being used by an application.

@mdipierro mdipierro force-pushed the master branch 2 times, most recently from 3b526f9 to 2a77f13 Compare May 8, 2023 01:21
@mdipierro
Copy link
Contributor

Based on leonel's comment above I will decline this

@mdipierro mdipierro closed this Nov 12, 2024
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 70.32%. Comparing base (d699097) to head (c792e58).
Report is 115 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #642      +/-   ##
==========================================
- Coverage   70.33%   70.32%   -0.01%     
==========================================
  Files          73       73              
  Lines       11581    11584       +3     
  Branches     2555     2556       +1     
==========================================
+ Hits         8146     8147       +1     
- Misses       2765     2766       +1     
- Partials      670      671       +1     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants