1 # frozen_string_literal: true
4 include CanCan::Ability
8 can :show, [Node, Way, Relation]
9 can [:index, :show], [OldNode, OldWay, OldRelation]
10 can [:show, :new], Note
11 can :search, :direction
12 can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :communities, :preview, :copyright, :key, :id], :site
13 can [:finish, :embed], :export
14 can [:search, :search_latlon, :search_osm_nominatim, :search_osm_nominatim_reverse], :geocoder
16 if Settings.status != "database_offline"
17 can [:index, :feed, :show], Changeset
18 can :show, ChangesetComment
19 can [:confirm, :confirm_resend, :confirm_email], :confirmation
20 can [:index, :rss, :show], DiaryEntry
21 can :index, DiaryComment
23 can [:new, :create, :update], :password
24 can [:index, :show], Redaction
25 can [:new, :create, :destroy], :session
26 can [:index, :show, :data, :georss], Trace
27 can [:terms, :new, :create, :save, :suspended, :show, :auth_success, :auth_failure], User
28 can [:index, :show, :blocks_on, :blocks_by], UserBlock
33 can [:show], :deletion
35 if Settings.status != "database_offline"
36 can [:subscribe, :unsubscribe], Changeset
37 can [:index, :new, :create, :show, :update, :destroy], :oauth2_application
38 can [:index, :destroy], :oauth2_authorized_application
39 can [:new, :show, :create, :destroy], :oauth2_authorization
40 can [:update, :destroy], :account
41 can [:show], :dashboard
42 can [:new, :create, :subscribe, :unsubscribe], DiaryEntry
43 can :update, DiaryEntry, :user => user
44 can [:create], DiaryComment
45 can [:make_friend, :remove_friend], Friendship
46 can [:new, :create, :reply, :show, :inbox, :outbox, :muted, :mark, :unmute, :destroy], Message
47 can [:close, :reopen], Note
48 can [:show, :update], :preference
50 can [:new, :create], Report
51 can [:mine, :new, :create, :update, :destroy], Trace
52 can [:account, :go_public], User
53 can [:index, :create, :destroy], UserMute
56 can [:hide, :unhide], [DiaryEntry, DiaryComment]
57 can [:index, :show, :resolve, :ignore, :reopen], Issue
58 can :create, IssueComment
59 can [:new, :create, :update, :destroy], Redaction
60 can [:new, :create, :revoke_all], UserBlock
61 can :update, UserBlock, :creator => user
62 can :update, UserBlock, :revoker => user
63 can :update, UserBlock, :active? => true
66 if user.administrator?
67 can [:hide, :unhide], [DiaryEntry, DiaryComment]
68 can [:index, :show, :resolve, :ignore, :reopen], Issue
69 can :create, IssueComment
70 can [:set_status, :destroy, :index], User
71 can [:grant, :revoke], UserRole
76 # Define abilities for the passed in user here. For example:
78 # user ||= User.new # guest user (not logged in)
85 # The first argument to `can` is the action you are giving the user
87 # If you pass :manage it will apply to every action. Other common actions
88 # here are :read, :create, :update and :destroy.
90 # The second argument is the resource the user can perform the action on.
91 # If you pass :all it will apply to every resource. Otherwise pass a Ruby
92 # class of the resource.
94 # The third argument is an optional hash of conditions to further filter the
96 # For example, here the user can only update published articles.
98 # can :update, Article, :published => true
100 # See the wiki for details:
101 # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities