links_controller.rb 393 B

12345678910111213141516171819
  1. # frozen_string_literal: true
  2. class Api::V1::Admin::Trends::LinksController < Api::V1::Trends::LinksController
  3. before_action -> { authorize_if_got_token! :'admin:read' }
  4. private
  5. def enabled?
  6. super || current_user&.can?(:manage_taxonomies)
  7. end
  8. def links_from_trends
  9. if current_user&.can?(:manage_taxonomies)
  10. Trends.links.query
  11. else
  12. super
  13. end
  14. end
  15. end