]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/capability.rb
Check the oauth token and then use the capabilities directly
[rails.git] / app / models / capability.rb
index 72c5545cb4ec5a9b04d5e0c4b5d453765fa754cc..2a5c927748bbdb969b6d37e376a099374085bed4 100644 (file)
@@ -3,11 +3,9 @@
 class Capability
   include CanCan::Ability
 
-  def initialize(user, token)
-    if user
-      can [:read, :read_one], UserPreference if capability?(token, :allow_read_prefs)
-      can [:update, :update_one, :delete_one], UserPreference if capability?(token, :allow_write_prefs)
-    end
+  def initialize(token)
+    can [:read, :read_one], UserPreference if capability?(token, :allow_read_prefs)
+    can [:update, :update_one, :delete_one], UserPreference if capability?(token, :allow_write_prefs)
   end
 
   private