You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
661 B

module Carto
module OauthProvider
module Scopes
class DefaultScope < Scope
def initialize(type, service, category, description)
super("#{type}:#{service}", category, description)
@type = type
@service = service
end
def grant_section(grants)
section = grants.find { |i| i[:type] == @type }
section || { type: @type, @grant_key => [] }
end
def add_to_api_key_grants(grants, _user = nil)
section = grant_section(grants)
section[@grant_key] << @service
ensure_grant_section(grants, section)
end
end
end
end
end