1 # frozen_string_literal: true
4 include CanCan::Ability
7 can [:index, :feed, :read, :download, :query], Changeset
8 can :index, ChangesetComment
9 can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id], :site
10 can [:index, :rss, :show, :comments], DiaryEntry
11 can [:search, :search_latlon, :search_ca_postcode, :search_osm_nominatim,
12 :search_geonames, :search_osm_nominatim_reverse, :search_geonames_reverse], :geocoder
13 can [:index, :create, :comment, :feed, :show, :search, :mine], Note
14 can [:index, :show], Redaction
15 can [:index, :show, :data, :georss, :picture, :icon], Trace
16 can [:terms, :api_users, :login, :logout, :new, :create, :save, :confirm, :confirm_resend, :confirm_email, :lost_password, :reset_password, :show, :api_read, :auth_success, :auth_failure], User
17 can [:index, :show, :blocks_on, :blocks_by], UserBlock
21 can [:create, :edit, :comment, :subscribe, :unsubscribe], DiaryEntry
22 can [:close, :reopen], Note
23 can [:new, :create], Report
24 can [:mine, :new, :create, :edit, :update, :delete, :api_create, :api_read, :api_update, :api_delete, :api_data], Trace
25 can [:account, :go_public, :make_friend, :remove_friend, :api_details, :api_gpx_files], User
26 can [:read, :read_one, :update, :update_one, :delete_one], UserPreference
28 if user.terms_agreed? || !REQUIRE_TERMS_AGREED
29 can [:create, :update, :upload, :close, :subscribe, :unsubscribe, :expand_bbox], Changeset
30 can :create, ChangesetComment
34 can [:destroy, :restore], ChangesetComment
35 can [:index, :show, :resolve, :ignore, :reopen], Issue
36 can :create, IssueComment
38 can [:new, :create, :edit, :update, :destroy], Redaction
39 can [:new, :edit, :create, :update, :revoke], UserBlock
42 if user.administrator?
43 can [:hide, :hidecomment], [DiaryEntry, DiaryComment]
44 can [:index, :show, :resolve, :ignore, :reopen], Issue
45 can :create, IssueComment
46 can [:set_status, :delete, :index], User
47 can [:grant, :revoke], UserRole
51 # Define abilities for the passed in user here. For example:
53 # user ||= User.new # guest user (not logged in)
60 # The first argument to `can` is the action you are giving the user
62 # If you pass :manage it will apply to every action. Other common actions
63 # here are :read, :create, :update and :destroy.
65 # The second argument is the resource the user can perform the action on.
66 # If you pass :all it will apply to every resource. Otherwise pass a Ruby
67 # class of the resource.
69 # The third argument is an optional hash of conditions to further filter the
71 # For example, here the user can only update published articles.
73 # can :update, Article, :published => true
75 # See the wiki for details:
76 # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities