Skip to content

Commit

Permalink
Hound
Browse files Browse the repository at this point in the history
  • Loading branch information
pablobm committed May 26, 2022
1 parent 7442a21 commit db59493
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions app/controllers/administrate/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ def nav_link_state(resource)

# Whether the named action route exists for the resource class.
#
# @param resource [Class, String, Symbol] A class of resources, or the name of a class of resources.
# @param action_name [String, Symbol] The name of an action that might be possible to
# perform on a resource or resource class.
# @return [Boolean] `true` if a route exists for the resource class and the action. `false` otherwise.
# @param resource [Class, String, Symbol] A class of resources, or the name
# of a class of resources.
# @param action_name [String, Symbol] The name of an action that might be
# possible to perform on a resource or resource class.
# @return [Boolean] `true` if a route exists for the resource class and the
# action. `false` otherwise.
def existing_action?(resource, action_name)
routes.include?([resource.to_s.underscore.pluralize, action_name.to_s])
end
Expand Down Expand Up @@ -225,12 +227,15 @@ def show_search_bar?
).any? { |_name, attribute| attribute.searchable? }
end

# Whether the current user is authorized to perform the named action on the resource.
# Whether the current user is authorized to perform the named action on the
# resource.
#
# @param _resource [ActiveRecord::Base, Class, String, Symbol] The temptative target of the action, or the name of its class.
# @param _action_name [String, Symbol] The name of an action that might be possible to
# perform on a resource or resource class.
# @return [Boolean] `true` if the current user is authorized to perform the action on the resource. `false` otherwise.
# @param _resource [ActiveRecord::Base, Class, String, Symbol] The
# temptative target of the action, or the name of its class.
# @param _action_name [String, Symbol] The name of an action that might be
# possible to perform on a resource or resource class.
# @return [Boolean] `true` if the current user is authorized to perform the
# action on the resource. `false` otherwise.
def authorized_action?(_resource, _action_name)
true
end
Expand Down

0 comments on commit db59493

Please sign in to comment.