lib/scrivito/user.rb in scrivito_sdk-0.70.2 vs lib/scrivito/user.rb in scrivito_sdk-0.71.0.rc1

- old
+ new

@@ -50,12 +50,12 @@ # user_definition.description('Bob Doe') # # user_definition.can_never(:create, :workspace, 'You are not allowed to create workspaces.') # user_definition.can_always(:read, :workspace) # - # user_definition.restrict_obj_publish(using: :_obj_class_name) do |obj_class_name| - # if obj_class_name == 'BlogPost' + # user_definition.restrict_obj_publish(using: :_obj_class) do |obj_class| + # if obj_class == 'BlogPost' # false # else # 'You are not allowed to publish blog posts.' # end # end @@ -153,24 +153,24 @@ # # Checks whether the User may publish changes to a specific {Scrivito::BasicObj Obj}. # # @api public - # @param [BasicObj] obj the object to be published + # @param [Scrivito::BasicObj] obj the object to be published # @return [Boolean] true if the user is allowed to publish the object, otherwise false # def can_publish?(obj) restriction_messages_for(obj).empty? end # # Checks whether the User may publish changes to an {Scrivito::BasicObj Obj} and returns - # the message specified in a {UserDefinition#restrict_obj_publish} callback if they may not. - # If the user may publish the CMS object, an empty array is returned. + # the message specified in a {Scrivito::UserDefinition#restrict_obj_publish} callback if they + # may not. If the user may publish the CMS object, an empty array is returned. # # @api public - # @param [BasicObj] obj the object to be published + # @param [Scrivito::BasicObj] obj the object to be published # @return [Array<String>] Hints on why the user cannot publish the object # def restriction_messages_for(obj) assert_restrictions_applicable(obj) @@ -234,13 +234,12 @@ end def sandbox_suggest_user_proc(input) suggest_users_proc.call(input) rescue Exception => e - Rails.logger.error(%{ -Method `suggest_users' of the user "#{id}" raised an error on input "#{input}": #{e} - #{e.backtrace.join("\n")} - }) + message = %{Method `suggest_users' of the user "#{id}" raised an error on input "#{input}"} + Warning.error(message, e) + nil end end end