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 [:index, :rss, :show, :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 can [:hide, :hidecomment], [DiaryEntry, DiaryComment] if user.administrator?
22 # Define abilities for the passed in user here. For example:
24 # user ||= User.new # guest user (not logged in)
31 # The first argument to `can` is the action you are giving the user
33 # If you pass :manage it will apply to every action. Other common actions
34 # here are :read, :create, :update and :destroy.
36 # The second argument is the resource the user can perform the action on.
37 # If you pass :all it will apply to every resource. Otherwise pass a Ruby
38 # class of the resource.
40 # The third argument is an optional hash of conditions to further filter the
42 # For example, here the user can only update published articles.
44 # can :update, Article, :published => true
46 # See the wiki for details:
47 # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities