1 # frozen_string_literal: true
4 include CanCan::Ability
7 can :index, ChangesetComment
8 can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id], :site
9 can [:index, :rss, :show, :comments], DiaryEntry
10 can [:search, :search_latlon, :search_ca_postcode, :search_osm_nominatim,
11 :search_geonames, :search_osm_nominatim_reverse, :search_geonames_reverse], :geocoder
12 can [:index, :create, :comment, :feed, :show, :search, :mine], Note
13 can [:index, :show], Redaction
14 can [:search_all, :search_nodes, :search_ways, :search_relations], :search
15 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
16 can [:index, :show, :blocks_on, :blocks_by], UserBlock
20 can [:create, :edit, :comment, :subscribe, :unsubscribe], DiaryEntry
21 can [:close, :reopen], Note
22 can [:new, :create], Report
23 can [:account, :go_public, :make_friend, :remove_friend, :api_details, :api_gpx_files], User
24 can [:read, :read_one, :update, :update_one, :delete_one], UserPreference
26 if user.terms_agreed? || !REQUIRE_TERMS_AGREED # rubocop:disable Style/IfUnlessModifier
27 can :create, ChangesetComment
31 can [:destroy, :restore], ChangesetComment
32 can [:index, :show, :resolve, :ignore, :reopen], Issue
33 can :create, IssueComment
35 can [:new, :create, :edit, :update, :destroy], Redaction
36 can [:new, :edit, :create, :update, :revoke], UserBlock
39 if user.administrator?
40 can [:hide, :hidecomment], [DiaryEntry, DiaryComment]
41 can [:index, :show, :resolve, :ignore, :reopen], Issue
42 can :create, IssueComment
43 can [:set_status, :delete, :index], User
44 can [:grant, :revoke], UserRole
48 # Define abilities for the passed in user here. For example:
50 # user ||= User.new # guest user (not logged in)
57 # The first argument to `can` is the action you are giving the user
59 # If you pass :manage it will apply to every action. Other common actions
60 # here are :read, :create, :update and :destroy.
62 # The second argument is the resource the user can perform the action on.
63 # If you pass :all it will apply to every resource. Otherwise pass a Ruby
64 # class of the resource.
66 # The third argument is an optional hash of conditions to further filter the
68 # For example, here the user can only update published articles.
70 # can :update, Article, :published => true
72 # See the wiki for details:
73 # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities