开发者

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

开发者 https://www.devze.com 2022-12-13 18:23 出处:网络
I\'d like to control the permit method with s开发者_开发技巧omething like this class SomethingController < ApplicationController

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

精彩评论

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

关注公众号