]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/ability.rb
Implement the cancan filters for diary entries
[rails.git] / app / models / ability.rb
index 897316691328fc8d673ace7001cbda2f73aa3473..59b1c5ec3e68ebda8edc6e1bddd68d13bfec82a6 100644 (file)
@@ -7,8 +7,16 @@ class Ability
     can :index, :site
     can [:permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id, :welcome], :site
 
+    can [:list, :rss, :view, :comments], DiaryEntry
+
     if user
       can :weclome, :site
+
+      can [:create, :edit, :comment, :subscribe, :unsubscribe], DiaryEntry
+
+      if user.administrator?
+        can [:hide, :hidecomment], [DiaryEntry, DiaryComment]
+      end
     end
     # Define abilities for the passed in user here. For example:
     #