Use cancancan to authorize user_preference_controller

This commit is contained in:
Chris Flipse 2018-06-09 19:53:45 -04:00
parent ac7c45bca0
commit 060c686c19
4 changed files with 8 additions and 5 deletions

View file

@ -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