]> git.openstreetmap.org Git - rails.git/blobdiff - lib/oauth.rb
Add support for OAuth2 using doorkeeper
[rails.git] / lib / oauth.rb
diff --git a/lib/oauth.rb b/lib/oauth.rb
new file mode 100644 (file)
index 0000000..8f45a3b
--- /dev/null
@@ -0,0 +1,19 @@
+module Oauth
+  SCOPES = %w[read_prefs write_prefs write_diary write_api read_gpx write_gpx write_notes].freeze
+
+  class Scope
+    attr_reader :name
+
+    def initialize(name)
+      @name = name
+    end
+
+    def description
+      I18n.t("oauth.scopes.#{name}")
+    end
+  end
+
+  def self.scopes
+    SCOPES.collect { |s| Scope.new(s) }
+  end
+end