Use cancancan to authorize user_preference_controller
This commit is contained in:
parent
ac7c45bca0
commit
060c686c19
4 changed files with 8 additions and 5 deletions
|
@ -14,6 +14,9 @@ class Ability
|
|||
|
||||
can [:create, :edit, :comment, :subscribe, :unsubscribe], DiaryEntry
|
||||
|
||||
can [:read, :read_one], UserPreference if has_capability?(token, :allow_read_prefs)
|
||||
can [:update, :update_one, :delete_one], UserPreference if has_capability?(token, :allow_write_prefs)
|
||||
|
||||
if user.administrator?
|
||||
can [:hide, :hidecomment], [DiaryEntry, DiaryComment]
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue