开发者

How could I implement the permit directive through database in rails-authorization-plugin, in a way that an admin user can change?

I'd like to control the permit method with s开发者_开发技巧omething like this

class SomethingController < ApplicationController permit :somerole end

where ':somerole' is a field in the database linked to a controller and an action. Something that an user with priviledge can administer and change.

Some Idea?


this is just for example i have

class Admin::AdminController < ApplicationController
  before_filter :login_required
  before_filter :only_moderator_and_above

  layout 'admin'

  def only_moderator_and_above
    unless current_user.has_admin_access?
      flash[:notice] = CustomMessages.admin_permission_alert
      redirect_to '/'
    end
  end
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜