Comments (3)
Dudes.
So, I went and checked this out ... I found out that you're just using @abstract_model.model.arrange
to pull data out of the model, which barring magic (always a possibility in railsland) doesn't seem to allow for CanCan to be applying any sort of filtering from Ability.
But if anyone else out there like me just wants to make CanCan work (ie, not just 'allow/disallow nestable', but full parity with eg 'index' action), go ahead and make a local copy of lib/rails_admin_nestable/nestable.rb, and you can just change lines 75-81 of nestable.rb to
model = @abstract_model.model
# use the accessible_by scope with current user if supported
model = model.accessible_by( Ability.new current_user ) if model.respond_to? :accessible_by
if @nestable_conf.tree?
@tree_nodes = model.arrange(order: @nestable_conf.options[:position_field])
end
if @nestable_conf.list?
@tree_nodes = model.order(@nestable_conf.options[:position_field])
end
That'll apply Devise filtering to the records you see in nestable.
Offhand I can't see why this would be a bad thing, but I might be missing something since it's been a while since I knew CanCan/Devise/Radmin inside and out.
from rails_admin_nestable.
+1 @mrluc
from rails_admin_nestable.
Hi @mrluc,
I released a new version which use the rails_admin method list_entries
to retrieve records.
list_entries
is integrated with the authorization_adapter, generally CanCan, so the issue should be resolved.
Take a look here for the list_entries
implementation: https://github.com/sferik/rails_admin/blob/master/app/controllers/rails_admin/main_controller.rb#L32
Could you try the last release to check if it works correctly?
Sorry for my late reply, but I have little free time to work on rails_admin_nestable..
Thanks
from rails_admin_nestable.
Related Issues (20)
- "undefined method `options' for nil:NilClass" when using nestable_list HOT 1
- wrong number of arguments (1 for 3) when update HOT 3
- nestable_tree true is required
- Sorting a tree
- How to display associated model's name in sorting menu HOT 2
- Corrupt gemfile
- scope does not work as expected
- Any chance to replace default "list" with a "nestable_tree"? HOT 5
- Add possibility to sort by group HOT 1
- Gradient has outdated direction syntax
- Possibility to sort children of a parent (Has many association) HOT 6
- nestable list not nestable HOT 3
- Gets stuck in loop HOT 1
- `render text: msg` is deprecated in Rails 5.1 HOT 1
- NoMethodError in RailsAdmin::Main#nestable HOT 1
- Bundle outdated HOT 1
- jquery.nestable typo
- Render collapsed tree HOT 1
- ActionView::Template::Error on Rails 6 HOT 3
- Compatible with Rails 7.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rails_admin_nestable.