Sha256: e5d369fb53d4df812a00cc001122733680029238078d97b3c97f7dd59143a359

Contents?: true

Size: 750 Bytes

Versions: 11

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

module Uploader
  class AuthorizationAdapter
    attr_reader :user

    # Initialize a new authorization adapter. This happens on each and
    # every request to a controller.
    def initialize(user)
      @user = user
    end

    # Returns true of false depending on if the user is authorized to perform
    # the action on the subject.
    def authorized?(action, subject = nil)
      true
    end

    # A hook method for authorization libraries to scope the collection. By
    # default, we just return the same collection. The returned scope is used
    # as the starting point for all queries to the db in the controller.
    def scope_collection(collection, action = :index)
      collection
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails-uploader-0.5.9 lib/uploader/authorization_adapter.rb
rails-uploader-0.5.8 lib/uploader/authorization_adapter.rb
rails-uploader-0.5.7 lib/uploader/authorization_adapter.rb
rails-uploader-0.5.6 lib/uploader/authorization_adapter.rb
rails-uploader-0.5.5 lib/uploader/authorization_adapter.rb
rails-uploader-0.5.4 lib/uploader/authorization_adapter.rb
rails-uploader-0.5.3 lib/uploader/authorization_adapter.rb
rails-uploader-0.5.2 lib/uploader/authorization_adapter.rb
rails-uploader-0.5.1 lib/uploader/authorization_adapter.rb
rails-uploader-0.5.0 lib/uploader/authorization_adapter.rb
rails-uploader-0.4.5 lib/uploader/authorization_adapter.rb