Sha256: 6d5b4ec9c21569cde39912b1ef0aa79b0ff725ea27d01e9d1b3a79c1180f6228
Contents?: true
Size: 824 Bytes
Versions: 5
Compression:
Stored size: 824 Bytes
Contents
require_dependency 'avo/application_controller' module Avo class ResourceOverviewController < ApplicationController def index resources = App.get_resources .select { |resource| AuthorizationService::authorize session_user, resource.model, Avo.configuration.authorization_methods.stringify_keys['index'] } .sort_by(&:name) .map do |resource| { name: resource.name, url: resource.url, count: resource.model.count, } end render json: { resources: resources, hidden: Avo.configuration.hide_resource_overview_component, hide_docs: Avo.configuration.hide_documentation_link, } end private def session_user current_user.present? ? current_user : nil end end end
Version data entries
5 entries across 5 versions & 1 rubygems