Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/policies/application_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def initialize(user, record)

def method_missing(method_name, *_args)
if RESOURCE_ACTIONS.include?(method_name)
Rails.logger.debug { "Pundit policy does not have method #{method_name}. Returning false as default." }
return false
Rails.logger.debug { "Pundit policy does not have method #{method_name}. Returning no_one as default." }
return no_one
end

super
Expand Down Expand Up @@ -46,6 +46,10 @@ def everyone
@user.present?
end

def no_one
false
end

class Scope
def initialize(user, scope)
@user = user
Expand Down
4 changes: 2 additions & 2 deletions app/policies/task_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def create?

%i[add_to_collection? duplicate? export_external_start? export_external_check? export_external_confirm?].each do |action|
define_method(action) do
return false if @user.blank?
return no_one if @user.blank?

record_owner? || task.access_level_public? || task_in_group_with?(@user) || admin?
end
end

def update?
return false if @user.blank?
return no_one if @user.blank?

record_owner? || task_in_group_with?(@user) || admin?
end
Expand Down