1 # frozen_string_literal: true
4 include CanCan::Ability
8 can [:permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id, :welcome], :site
10 can [:list, :rss, :view, :comments], DiaryEntry
12 can [:search, :search_latlon, :search_ca_postcode, :search_osm_nominatim,
13 :search_geonames, :search_osm_nominatim_reverse, :search_geonames_reverse], :geocoder
18 can [:create, :edit, :comment, :subscribe, :unsubscribe], DiaryEntry
20 if user.administrator?
21 can [:hide, :hidecomment], [DiaryEntry, DiaryComment]
24 # Define abilities for the passed in user here. For example:
26 # user ||= User.new # guest user (not logged in)
33 # The first argument to `can` is the action you are giving the user
35 # If you pass :manage it will apply to every action. Other common actions
36 # here are :read, :create, :update and :destroy.
38 # The second argument is the resource the user can perform the action on.
39 # If you pass :all it will apply to every resource. Otherwise pass a Ruby
40 # class of the resource.
42 # The third argument is an optional hash of conditions to further filter the
44 # For example, here the user can only update published articles.
46 # can :update, Article, :published => true
48 # See the wiki for details:
49 # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities