Ruby on rails 使用声明性身份验证设置用户权限

Ruby on rails 使用声明性身份验证设置用户权限,ruby-on-rails,windows,authentication,Ruby On Rails,Windows,Authentication,我正在尝试决定我的版主角色的权限。 他所能做的就是向所有订阅他频道的用户发送消息,并修改该频道的页面 以下是我所拥有的: role :moderator do has_permissions_on[:message], :to=> [:index, :show, :new, :create,:edit,:update,:destroy] has_permissions_on[:channel], :to=> [:index, :show, :edit, :update

我正在尝试决定我的版主角色的权限。
他所能做的就是向所有订阅他频道的用户发送消息,并修改该频道的页面

以下是我所拥有的:

role :moderator do
    has_permissions_on[:message], :to=> [:index, :show, :new, :create,:edit,:update,:destroy]
    has_permissions_on[:channel], :to=> [:index, :show, :edit, :update]
  end

我建议您首先定义一些特权,如

privileges do
  privilege :crud do
    includes :show, :index, :create, :edit, :update, :delete
  end

  privilege :read_only do
   includes :show, :index
  end
end

例如,根据您所说的内容,我将进一步检查Authorization::Reader API,以允许管理员销毁他刚刚发送的消息(除非他能够销毁其他用户的消息,但您没有提及)

感谢您的回复。管理员是系统管理员(只有一个)。所以我希望他拥有所有的特权。