2010-11-24 31 views
0

我正在嘗試確定我的主持人角色的權限。
他應該能夠做的就是將消息發送給訂閱了他的頻道的所有用戶並修改其頁面。使用聲明式驗證設置用戶密碼

以下是我有:

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 

回答

0

我建議:第一,你這樣定義

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

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

根據你所說例如一些特權,我會檢查更多的授權::例如,Reader API允許管理員銷燬他剛剛發送的消息(除非他能夠銷燬來自其他用戶的消息,但它並未提及任何內容)

+0

感謝您的回覆。管理員是系統管理員(只有一個)。所以我希望他擁有所有的特權。 – 2010-11-24 23:33:37