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

Disable tenant scope in closure #81

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mbaeuerle
Copy link

Currently disabling Landlord with disable() just affects new types of models and newly created models but not models where the scope has already been added to.
This is because enabled is checked only when a scope should be added to a model but not when the scope is applied to an actual query.

In this PR I moved the enabled-check to the global scope closure so the tenant scope is never applied if it was disabled previously which is the expected behavior in my opinion.
This is also the behavior of Landlord 1.

I also moved the global scope code into a private method to reduce duplication.

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.

1 participant