Sha256: d7fa8a53e0f2fde7c4e78988770e9146d6fa35fb3f68b550cbc41483ee1936c9

Contents?: true

Size: 1008 Bytes

Versions: 20

Compression:

Stored size: 1008 Bytes

Contents

# Injects behaviors into User model so that it will work with Hydra Access Controls
# By default, this module assumes you are using the User model created by Blacklight, which uses Devise.
# To integrate your own User implementation into Hydra, override this Module or define your own User model in app/models/user.rb within your Hydra head.
module Hydra::User
  include Blacklight::AccessControls::User
  
  def self.included(klass)
    # Other modules to auto-include
    klass.extend(ClassMethods)
  end

  def groups
    RoleMapper.roles(self)
  end
  
  module ClassMethods
    # This method should find User objects using the user_key you've chosen.
    # By default, uses the unique identifier specified in by devise authentication_keys (ie. find_by_id, or find_by_email).  
    # You must have that find method implemented on your user class, or must override find_by_user_key
    def find_by_user_key(key)
      self.send("find_by_#{Devise.authentication_keys.first}".to_sym, key)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
hydra-access-controls-10.3.4 lib/hydra/user.rb
hydra-access-controls-10.3.3 lib/hydra/user.rb
hydra-access-controls-10.3.2 lib/hydra/user.rb
hydra-access-controls-10.3.0 lib/hydra/user.rb
hydra-access-controls-10.2.0 lib/hydra/user.rb
hydra-access-controls-10.1.0 lib/hydra/user.rb
hydra-access-controls-10.0.2 lib/hydra/user.rb
hydra-access-controls-10.0.1 lib/hydra/user.rb
hydra-access-controls-10.0.0 lib/hydra/user.rb
hydra-access-controls-10.0.0.beta4 lib/hydra/user.rb
hydra-access-controls-10.0.0.beta3 lib/hydra/user.rb
hydra-access-controls-10.0.0.beta2 lib/hydra/user.rb
hydra-access-controls-10.0.0.beta1 lib/hydra/user.rb
hydra-access-controls-9.10.0 lib/hydra/user.rb
hydra-access-controls-9.9.0 lib/hydra/user.rb
hydra-access-controls-9.8.1 lib/hydra/user.rb
hydra-access-controls-9.8.0 lib/hydra/user.rb
hydra-access-controls-9.7.1 lib/hydra/user.rb
hydra-access-controls-9.7.0 lib/hydra/user.rb
hydra-access-controls-9.6.0 lib/hydra/user.rb