-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
Granting read permission on intermediate STI table prevents any records being returned #810
Comments
Similarly to this comment #663 (comment) adding this before the test "fixes" the test: CanCan::RulesCompressor.class_eval do
def compress(array)
# Don't compress...
array
end
end |
I just wasted a few hours fighting with this error today 😔 |
This solution didn't work for me, I figured out the problem is the At the end I prefered to overwrite the class StiDetector
class << self
alias_method :sti_class_original?, :sti_class?
def sti_class?(subject)
if subject == MyModel
false
else
sti_class_original?(subject)
end
end
end
end |
I am getting the same issue for some reason cancancan 3.5.0 is adding an extra where condition This patch worked fine: #663 (comment) System configuration
|
Steps to reproduce
Similar (but I think a different issue) to #809.
Granting read permission on an intermediate STI subclass as well as the STI base class leads to no records being returned by
accessible_by
. With the following STI hierarchy:Given
compared to
as there is no conflict in permission granted the result is surprising.
For whatever reason the query being issued includes a constraint on the intermediate sub-class type:
and since no rows have this
type
no rows are returned.Reproduction:
Expected behavior
All subclass instances should be returned by
accessible_by
.Actual behavior
No subclass instances are returned by
accessible_by
.System configuration
Rails version:
6.1.7
Ruby version:
2.7.6
CanCanCan version
3.4.0
The text was updated successfully, but these errors were encountered: