lib/avo/base_resource.rb in avo-2.16.0 vs lib/avo/base_resource.rb in avo-2.16.1.pre.1.nativefields

- old
+ new

@@ -28,10 +28,11 @@ class_attribute :title, default: :id class_attribute :description, default: :id class_attribute :search_query, default: nil class_attribute :search_query_help, default: "" class_attribute :includes, default: [] + class_attribute :authorization_policy class_attribute :translation_key class_attribute :default_view_type, default: :table class_attribute :devise_password_optional, default: false class_attribute :actions_loader class_attribute :filters_loader @@ -90,11 +91,11 @@ authorization.apply_policy final_scope end def authorization - Avo::Services::AuthorizationService.new Avo::App.current_user + Avo::Services::AuthorizationService.new Avo::App.current_user, model_class, policy_class: authorization_policy end def order_actions return {} if ordering.blank? @@ -283,11 +284,12 @@ end model end - def authorization - Avo::Services::AuthorizationService.new(user, model || model_class) + def authorization(user: nil) + current_user = user || Avo::App.current_user + Avo::Services::AuthorizationService.new(current_user, model || model_class, policy_class: authorization_policy) end def file_hash content_to_be_hashed = ""