X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/b16aa11f65ed1120ee546712150ad6f57ec50102..6da3ece68354f77f626de8963770c0217048e19d:/app/models/ability.rb diff --git a/app/models/ability.rb b/app/models/ability.rb index 864225e8e..897316691 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + class Ability include CanCan::Ability - def initialize(user) + def initialize(user, token) can :index, :site can [:permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id, :welcome], :site @@ -35,4 +37,8 @@ class Ability # See the wiki for details: # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities end + + def has_capability?(token, cap) + token && token.read_attribute(cap) + end end