]> git.openstreetmap.org Git - rails.git/blob - lib/oauth.rb
Don't allow any abilities for inactive users
[rails.git] / lib / oauth.rb
1 module Oauth
2   SCOPES = %w[read_prefs write_prefs write_diary write_api read_gpx write_gpx write_notes].freeze
3   PRIVILEGED_SCOPES = %w[read_email skip_authorization].freeze
4
5   class Scope
6     attr_reader :name
7
8     def initialize(name)
9       @name = name
10     end
11
12     def description
13       I18n.t("oauth.scopes.#{name}")
14     end
15   end
16
17   def self.scopes(privileged: false)
18     scopes = SCOPES
19     scopes += PRIVILEGED_SCOPES if privileged
20     scopes.collect { |s| Scope.new(s) }
21   end
22 end