openstreetmap-website/lib/oauth.rb
Anton Khorev da28c0e561 Remove Oauth::OAUTH2_SCOPES
After OAuth1 was removed, all scopes are OAuth2 scopes. Former OAuth2-only scopes now can be combined with the rest.
2024-09-06 09:14:54 +03:00

27 lines
610 B
Ruby

module Oauth
SCOPES = %w[
read_prefs write_prefs write_diary
write_api read_gpx write_gpx write_notes write_redactions
consume_messages send_messages openid
].freeze
PRIVILEGED_SCOPES = %w[read_email skip_authorization].freeze
MODERATOR_SCOPES = %w[write_redactions].freeze
class Scope
attr_reader :name
def initialize(name)
@name = name
end
def description
I18n.t("oauth.scopes.#{name}")
end
end
def self.scopes(privileged: false)
scopes = SCOPES
scopes += PRIVILEGED_SCOPES if privileged
scopes.collect { |s| Scope.new(s) }
end
end