1 # frozen_string_literal: true
 
   4   include CanCan::Ability
 
   7     can :read, [:feature_query, :layers_pane, :legend_pane, :share_pane]
 
   8     can :read, [Node, Way, Relation, OldNode, OldWay, OldRelation]
 
   9     can [:show, :create], Note
 
  10     can :read, :directions
 
  11     can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :communities, :preview, :copyright, :id], :site
 
  12     can [:finish, :embed], :export
 
  13     can [:create, :read], :search
 
  15     if Settings.status != "database_offline"
 
  16       can [:read, :feed], Changeset
 
  17       can :read, ChangesetComment
 
  18       can [:confirm, :confirm_resend, :confirm_email], :confirmation
 
  19       can [:read, :rss], DiaryEntry
 
  20       can :read, DiaryComment
 
  22       can [:create, :update], :password
 
  24       can [:create, :destroy], :session
 
  25       can [:read, :data], Trace
 
  26       can [:read, :create, :suspended, :auth_success, :auth_failure], User
 
  32       can :read, [:deletion, :account_terms, :account_pd_declaration, :account_home]
 
  34       if Settings.status != "database_offline"
 
  35         can [:read, :create, :destroy], ChangesetSubscription
 
  36         can [:read, :create, :update, :destroy], :oauth2_application
 
  37         can [:read, :destroy], :oauth2_authorized_application
 
  38         can [:read, :create, :destroy], :oauth2_authorization
 
  39         can [:read, :update, :destroy], :account
 
  40         can :update, :account_terms
 
  41         can :create, :account_pd_declaration
 
  43         can [:read, :update], [:preferences, :profile]
 
  44         can [:create, :subscribe, :unsubscribe], DiaryEntry
 
  45         can :update, DiaryEntry, :user => user
 
  46         can [:create], DiaryComment
 
  47         can [:show, :create, :destroy], Follow
 
  48         can [:read, :create, :destroy], Message
 
  49         can [:close, :reopen], Note
 
  51         can [:mine, :create, :update, :destroy], Trace
 
  52         can [:account, :go_public], User
 
  53         can [:read, :create, :destroy], UserMute
 
  56           can [:hide, :unhide], [DiaryEntry, DiaryComment]
 
  57           can [:read, :resolve, :ignore, :reopen], Issue
 
  58           can :create, IssueComment
 
  59           can [:create, :update, :destroy], Redaction
 
  60           can [:create, :destroy], 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 [:read, :resolve, :ignore, :reopen], Issue
 
  69           can :create, IssueComment
 
  71           can [:update], :user_status
 
  72           can [:read, :update], :users_list
 
  73           can [:create, :destroy], UserRole
 
  78     # Define abilities for the passed in user here. For example:
 
  80     #   user ||= User.new # guest user (not logged in)
 
  87     # The first argument to `can` is the action you are giving the user
 
  89     # If you pass :manage it will apply to every action. Other common actions
 
  90     # here are :read, :create, :update and :destroy.
 
  92     # The second argument is the resource the user can perform the action on.
 
  93     # If you pass :all it will apply to every resource. Otherwise pass a Ruby
 
  94     # class of the resource.
 
  96     # The third argument is an optional hash of conditions to further filter the
 
  98     # For example, here the user can only update published articles.
 
 100     #   can :update, Article, :published => true
 
 102     # See the wiki for details:
 
 103     # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities