░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
pplmvsvm
LOCATION:
/var/www/canvas/doc/api/fulldoc/html/api_scopes
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: scope_mapper_template.erb
# frozen_string_literal: true # # Copyright (C) 2018 - present Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # ########################################################################################### ### This file is auto generated, any changes made directly will be lost. ### ### To regenerate this file run `bundle exec rake doc:api` ### ### ### ### The template for this file is located here: ### ### doc/api/fulldoc/html/api_scopes/scope_mapper_template.erb ### ########################################################################################### class ApiScopeMapper SCOPE_MAP = { <% mapping.each_with_index do |(controller, children), i| -%> <%="#{controller}: {" %> <% children.each_with_index do |(action, resource), j| -%> <%= "#{action}: :#{resource}" %><%= "," if j < (children.size - 1) %> <% end -%> <%= "}.freeze" %><%= "," if i < (mapping.size - 1) %> <% end -%> }.freeze RESOURCE_NAMES = { oauth2: -> { I18n.t("OAuth 2") }, peer_services: -> { I18n.t("Peer Services") }, <%=resource_lookup.map { |k, v| "#{k}: -> { I18n.t(#{v.inspect}) }"}.join(",\n " ) %> }.freeze def self.lookup_resource(controller, action) controller_class = controller.to_s.split("/").last.to_sym SCOPE_MAP.dig(controller_class, action) end def self.name_for_resource(resource) RESOURCE_NAMES[resource]&.call end end
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 api_scope_mapping_writer.rb
RB
2.2 KB
2023-09-24 03:36
EDIT
📄 scope_mapper_template.erb
ERB
2.1 KB
2023-09-24 03:36
EDIT