]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Add a privileged scope that allows email addresses to be returned
[rails.git] / app / controllers / application_controller.rb
index 2083627f56da30349b6b85eb679dca4d543e45d0..517b11e140818818dd7ab16b7219a39f04337720 100644 (file)
@@ -17,7 +17,6 @@ class ApplicationController < ActionController::Base
 
   helper_method :current_user
   helper_method :oauth_token
-  helper_method :preferred_langauges
 
   private
 
@@ -67,7 +66,7 @@ class ApplicationController < ActionController::Base
   end
 
   def require_oauth
-    @oauth_token = current_user.access_token(Settings.oauth_key) if current_user && Settings.key?(:oauth_key)
+    @oauth_token = current_user.oauth_token(Settings.oauth_application) if current_user && Settings.key?(:oauth_application)
   end
 
   ##
@@ -396,4 +395,10 @@ class ApplicationController < ActionController::Base
 
     referer.to_s
   end
+
+  def scope_enabled?(scope)
+    doorkeeper_token&.includes_scope?(scope) || current_token&.includes_scope?(scope)
+  end
+
+  helper_method :scope_enabled?
 end