X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/e222329d043592af299eed12cf6ad16969c1b46f..5c5695d9c1317a958f85fe85eefb1dc92bb68178:/lib/oauth.rb diff --git a/lib/oauth.rb b/lib/oauth.rb index 8f45a3b4b..0456c0873 100644 --- a/lib/oauth.rb +++ b/lib/oauth.rb @@ -1,5 +1,7 @@ module Oauth SCOPES = %w[read_prefs write_prefs write_diary write_api read_gpx write_gpx write_notes].freeze + PRIVILEGED_SCOPES = %w[read_email skip_authorization].freeze + OAUTH2_SCOPES = %w[openid].freeze class Scope attr_reader :name @@ -13,7 +15,10 @@ module Oauth end end - def self.scopes - SCOPES.collect { |s| Scope.new(s) } + def self.scopes(oauth2: false, privileged: false) + scopes = SCOPES + scopes += PRIVILEGED_SCOPES if privileged + scopes += OAUTH2_SCOPES if oauth2 + scopes.collect { |s| Scope.new(s) } end end