]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/oauth2_application.rb
Merge pull request #4173 from AntonKhorev/comments
[rails.git] / app / models / oauth2_application.rb
index 16576152026328a3c750c43b62eb172ee358d7d6..73a02417da5223802459d4e75c50f1eb2206f92c 100644 (file)
@@ -3,6 +3,10 @@ class Oauth2Application < Doorkeeper::Application
 
   validate :allowed_scopes
 
+  def authorized_scopes_for(user)
+    authorized_tokens.where(:resource_owner_id => user).sum(Doorkeeper::OAuth::Scopes.new, &:scopes)
+  end
+
   private
 
   def allowed_scopes