Sha256: 371c57e7710a648eadc3d98b82a7a064a60c8452e4d5d22cde49c56bed74031e

Contents?: true

Size: 546 Bytes

Versions: 6

Compression:

Stored size: 546 Bytes

Contents

# encoding: UTF-8

module Spontaneous
  module Rack
    module UserHelpers

      def unauthorised!
        halt 403#, "You do not have the necessary permissions to update the '#{name}' field"
      end

      def api_key
        request.cookies[AUTH_COOKIE]
      end

      def user
        @user ||= load_user
      end

      def load_user
        env[ACTIVE_USER]
      end

      def show_login_page(locals = {})
        halt(401, erb(:login, :views => Spontaneous.application_dir('/views'), :locals => locals))
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta1 lib/spontaneous/rack/user_helpers.rb
spontaneous-0.2.0.alpha7 lib/spontaneous/rack/user_helpers.rb
spontaneous-0.2.0.alpha6 lib/spontaneous/rack/user_helpers.rb
spontaneous-0.2.0.alpha5 lib/spontaneous/rack/user_helpers.rb
spontaneous-0.2.0.alpha4 lib/spontaneous/rack/user_helpers.rb
spontaneous-0.2.0.alpha3 lib/spontaneous/rack/user_helpers.rb