Skip to content

Instantly share code, notes, and snippets.

@radar
Created March 11, 2014 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radar/9496629 to your computer and use it in GitHub Desktop.
Save radar/9496629 to your computer and use it in GitHub Desktop.
module Spree
module Api
class Ability
def initialize(user, tokens={})
if tokens[:order]
can :read, Spree::Order do |order|
order.token == tokens[:order]
end
end
if tokens[:base] # TODO: better name
can :read, Spree::Everything
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment