-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Provide a config option for RailsAdmin to override default_scope #2428
Conversation
Update from source
Alternative way already exists - please take a look at #1348 (comment). |
Tried it, it doesn't work. It only works for list views, and if you try to view or edit a record it breaks. Unless I'm missing something? (See also this comment on Stack Overflow: this only works "if you only need to list the records": http://stackoverflow.com/a/28205484/1279840 |
Thanks for reopening. @dburt You're right, reopened This communication is confidential. If you are not the intended recipient of this email, any use, forwarding, printing or reproduction of it or any attachment, is prohibited. If you have received this communication in Please consider the environment and don't print this e-mail unless you really need to. |
@mshibuya @dburt I think you could already manage it, using an authorization adapert like https://github.com/sferik/rails_admin/wiki/CanCanCan For instance: class Ability
include CanCan::Ability
def initialize(user)
if user.admin?
can :manage, User, User.unscoped
else
can :manage, User, User.another_scope
end
end
end |
Thanks @dalpo and I can see that that can work. But I don't think it's the best solution to use a separate authorization tool with 8 extra lines of configuration for each model for this simple, non-authorization-related use-case. @mshibuya please show me what you want the DSL to look like, and I'll be happy to change my implementation. |
@mshibuya can this change be acceptable with a new DSL? If so, could you please show me what you'd like the DSL to look like? Then I could change the implementation. Otherwise, we could abandon and close this ticket. |
@dburt, I'm interested in this feature; maybe doing a quick search for instance option style can give you some clue to what @mshibuya refers to. |
Synopsis:
I've modelled my approach on this comment by @jxpx777 (#1348 (comment)) but made it more flexible by allowing a block.
There are some things that still need to be resolved, which I need help with: