]> git.openstreetmap.org Git - rails.git/blob - app/models/ability.rb
864225e8e83a151e737a8246a4d610c2723fae4b
[rails.git] / app / models / ability.rb
1 class Ability
2   include CanCan::Ability
3
4   def initialize(user)
5     can :index, :site
6     can [:permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id, :welcome], :site
7
8     if user
9       can :weclome, :site
10     end
11     # Define abilities for the passed in user here. For example:
12     #
13     #   user ||= User.new # guest user (not logged in)
14     #   if user.admin?
15     #     can :manage, :all
16     #   else
17     #     can :read, :all
18     #   end
19     #
20     # The first argument to `can` is the action you are giving the user
21     # permission to do.
22     # If you pass :manage it will apply to every action. Other common actions
23     # here are :read, :create, :update and :destroy.
24     #
25     # The second argument is the resource the user can perform the action on.
26     # If you pass :all it will apply to every resource. Otherwise pass a Ruby
27     # class of the resource.
28     #
29     # The third argument is an optional hash of conditions to further filter the
30     # objects.
31     # For example, here the user can only update published articles.
32     #
33     #   can :update, Article, :published => true
34     #
35     # See the wiki for details:
36     # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities
37   end
38 end