Skip to content
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

Enabled ignore_common_filters on IS_IN_DB #642

Open
wants to merge 2 commits into
base: master
Choose a base branch
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
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.

2 participants