]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Add support for the tileurl parameter to Potlatch 2
[rails.git] / app / models / user.rb
index 1a50f70532184eacc6a0063c286ae135980052bf..1db8adab7fcea045f4b1a05516859a57aa579043 100644 (file)
@@ -33,6 +33,7 @@ class User < ActiveRecord::Base
   validates_numericality_of :home_lat, :allow_nil => true
   validates_numericality_of :home_lon, :allow_nil => true
   validates_numericality_of :home_zoom, :only_integer => true, :allow_nil => true
+  validates_inclusion_of :preferred_editor, :in => Editors::ALL_EDITORS, :allow_nil => true
 
   before_save :encrypt_password
 
@@ -202,4 +203,10 @@ class User < ActiveRecord::Base
 
     return score.to_i
   end
+
+  ##
+  # return an oauth access token for a specified application
+  def access_token(application_key)
+    return ClientApplication.find_by_key(application_key).access_token_for_user(self)
+  end
 end