activeadmin icon indicating copy to clipboard operation
activeadmin copied to clipboard

scope_to can be skipped by filter

Open quark-zju opened this issue 13 years ago • 3 comments

For example,

# app/admin/articles.rb
scope_to :current_admin_user, :association_method => :managed_articles

# app/models/admin_user.rb
def managed_articles
  Article.where(:owner_user_id => self.id)
end

If there is a filter of owner_user_id and the filter is used, scoped_to has no effect in the index page.

I use scope_to to restrict user's permissions. This issue is serious because it is related to security.

I remember scope_to works well in activeadmin 0.5.0. Appearently some changes in 0.6.0 breaks this.

quark-zju avatar Apr 23 '13 13:04 quark-zju

Have you tried using the latest code on master? #2089 made a lot of changes to the scope_to logic.

seanlinsley avatar Apr 24 '13 16:04 seanlinsley

Sorry for the late reply. I have tried latest master (46b5bf8d7ef9333ee18deb32fb0e1a1a4978f41b) and this issue is fixed.

quark-zju avatar May 12 '13 13:05 quark-zju

Using https://github.com/gregbell/active_admin/commit/46b5bf8d7ef9333ee18deb32fb0e1a1a4978f41b solved my problem too

luk3thomas avatar Jul 03 '13 21:07 luk3thomas