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
15 can [:token, :request_token, :access_token, :test_request], :oauth
17 if Settings.status != "database_offline"
18 can [:index, :feed, :show], Changeset
19 can :index, ChangesetComment
20 can [:confirm, :confirm_resend, :confirm_email], :confirmation
21 can [:index, :rss, :show], DiaryEntry
22 can :index, DiaryComment
24 can [:new, :create, :edit, :update], :password
25 can [:index, :show], Redaction
26 can [:new, :create, :destroy], :session
27 can [:index, :show, :data, :georss], Trace
28 can [:terms, :new, :create, :save, :suspended, :show, :auth_success, :auth_failure], User
29 can [:index, :show, :blocks_on, :blocks_by], UserBlock
34 can [:revoke, :authorize], :oauth
35 can [:show], :deletion
37 if Settings.status != "database_offline"
38 can [:subscribe, :unsubscribe], Changeset
39 can [:index, :new, :create, :show, :edit, :update, :destroy], ClientApplication
40 can [:index, :new, :create, :show, :edit, :update, :destroy], :oauth2_application
41 can [:index, :destroy], :oauth2_authorized_application
42 can [:new, :show, :create, :destroy], :oauth2_authorization
43 can [:edit, :update, :destroy], :account
44 can [:show], :dashboard
45 can [:new, :create, :subscribe, :unsubscribe], DiaryEntry
46 can :update, DiaryEntry, :user => user
47 can [:create], DiaryComment
48 can [:make_friend, :remove_friend], Friendship
49 can [:new, :create, :reply, :show, :inbox, :outbox, :muted, :mark, :unmute, :destroy], Message
50 can [:close, :reopen], Note
51 can [:show, :edit, :update], :preference
52 can [:edit, :update], :profile
53 can [:new, :create], Report
54 can [:mine, :new, :create, :edit, :update, :destroy], Trace
55 can [:account, :go_public], User
56 can [:index, :create, :destroy], UserMute
59 can [:hide, :unhide], [DiaryEntry, DiaryComment]
60 can [:index, :show, :resolve, :ignore, :reopen], Issue
61 can :create, IssueComment
62 can [:new, :create, :edit, :update, :destroy], Redaction
63 can [:new, :create, :revoke, :revoke_all], UserBlock
64 can :update, UserBlock, :creator => user
65 can :update, UserBlock, :revoker => user
66 can :update, UserBlock, :active? => true
69 if user.administrator?
70 can [:hide, :unhide], [DiaryEntry, DiaryComment]
71 can [:index, :show, :resolve, :ignore, :reopen], Issue
72 can :create, IssueComment
73 can [:set_status, :destroy, :index], User
74 can [:grant, :revoke], UserRole
79 # Define abilities for the passed in user here. For example:
81 # user ||= User.new # guest user (not logged in)
88 # The first argument to `can` is the action you are giving the user
90 # If you pass :manage it will apply to every action. Other common actions
91 # here are :read, :create, :update and :destroy.
93 # The second argument is the resource the user can perform the action on.
94 # If you pass :all it will apply to every resource. Otherwise pass a Ruby
95 # class of the resource.
97 # The third argument is an optional hash of conditions to further filter the
99 # For example, here the user can only update published articles.
101 # can :update, Article, :published => true
103 # See the wiki for details:
104 # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities