lib/warden/manager_deprecation.rb in warden-0.8.1 vs lib/warden/manager_deprecation.rb in warden-0.9.0

- old
+ new

@@ -1,62 +1,35 @@ module Warden module ManagerDeprecation + class Dummy + def update(type, &block) + if type == :session + warn "[DEPRECATION] warden.serializers.update(:session) is deprecated. " << + "Please use Warden::Manager.serialize_from_session and Warden::Manager.serialize_into_session" + Warden::SessionSerializer.class_eval(&block) + else + method_missing(update) + end + end + + def method_missing(method, *args) + warn "[DEPRECATION] warden.serializers.#{method} is deprecated." + nil + end + end + # Read the default scope from Warden def default_scope warn "[DEPRECATION] Warden::Manager.default_scope is deprecated. It's now accessible in the Warden::Manager instance." end # Set the default scope for Warden. def default_scope=(scope) warn "[DEPRECATION] Warden::Manager.default_scope= is deprecated. Please set it in the Warden::Manager instance." end - # Prepares the user to serialize into the session. - # Any object that can be serialized into the session in some way can be used as a "user" object - # Generally however complex object should not be stored in the session. - # If possible store only a "key" of the user object that will allow you to reconstitute it. - # - # Example: - # Warden::Manager.serialize_into_session{ |user| user.id } - # - # Deprecation: - # This method was deprecated in favor of serializer in Session. You can set it while setting the middleware: - # - # use Warden::Manager do |manager| - # manager.serializers.update(:session) do - # def serialize(user) - # user.id - # end - # end - # end - # - # :api: public - def serialize_into_session(&block) - warn "[DEPRECATION] serialize_into_session is deprecated. Please overwrite the serialize method in Warden::Serializers::Session." - Warden::Serializers::Session.send :define_method, :serialize, &block + def serializers + warn "[DEPRECATION] warden.serializers is deprecated since Warden::Serializers were merged into Warden::Strategies." + Dummy.new end - - # Reconstitues the user from the session. - # Use the results of user_session_key to reconstitue the user from the session on requests after the initial login - # - # Example: - # Warden::Manager.serialize_from_session{ |id| User.get(id) } - # - # Deprecation: - # This method was deprecated in favor of serializer in Session. You can set it while setting the middleware: - # - # use Warden::Manager do |manager| - # manager.serializers.update(:session) do - # def deserialize(id) - # User.get(id) - # end - # end - # end - # - # :api: public - def serialize_from_session(&block) - warn "[DEPRECATION] serialize_from_session is deprecated. Please overwrite the deserialize method in Warden::Serializers::Session." - Warden::Serializers::Session.send :define_method, :deserialize, &block - end - end end \ No newline at end of file