1 # frozen_string_literal: true
4 include CanCan::Ability
6 def initialize(user, token)
8 can [:permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id, :welcome], :site
13 # Define abilities for the passed in user here. For example:
15 # user ||= User.new # guest user (not logged in)
22 # The first argument to `can` is the action you are giving the user
24 # If you pass :manage it will apply to every action. Other common actions
25 # here are :read, :create, :update and :destroy.
27 # The second argument is the resource the user can perform the action on.
28 # If you pass :all it will apply to every resource. Otherwise pass a Ruby
29 # class of the resource.
31 # The third argument is an optional hash of conditions to further filter the
33 # For example, here the user can only update published articles.
35 # can :update, Article, :published => true
37 # See the wiki for details:
38 # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities
41 def has_capability?(token, cap)
42 token && token.read_attribute(cap)