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

Fix global record validations with existing scope #294

Merged
merged 1 commit into from
Dec 2, 2022

Conversation

mikecmpbll
Copy link
Contributor

Due to how the args object was being (man)handled, we were leaking
the tenant scope into the global scope validation where it shouldn't
have been. This only happened when there was a scope argument supplied
to validates_uniquness_to_tenant.

Due to how the `args` object was being (man)handled, we were leaking
the tenant scope into the global scope validation where it shouldn't
have been. This only happened when there was a scope argument supplied
to validates_uniquness_to_tenant.
@mikecmpbll mikecmpbll force-pushed the fix-global-record-validations-upstream branch from 4f73802 to 30d0a52 Compare August 18, 2022 09:44
@mikecmpbll
Copy link
Contributor Author

mikecmpbll commented Aug 18, 2022

to expand on this a little; the # if tenant is set (instance is not global) and records can be global - validating within records with blank tenant validation query was:

SELECT 1 AS one
FROM "projects"
WHERE "projects"."name" = ?
  AND "projects"."user_defined_scope" = ?
  AND "projects"."account_id" = ?
  AND "projects"."account_id" IS NULL
LIMIT ?

the account_id = <tenant_id> portion of the query doesn't belong there, and was leaking into args[:scope] from how validation_args was being built for the main validation.

@excid3 excid3 merged commit d7e422f into ErwinM:master Dec 2, 2022
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