Sha256: 445d275bcc245a0b8514c06750973f6590850cc0ee7db479f104ba5e72a56dbd

Contents?: true

Size: 967 Bytes

Versions: 17

Compression:

Stored size: 967 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
  extend ActiveSupport::Concern
  include Blacklight::AccessControls::User
  
  included do
    class_attribute :group_service
    self.group_service = RoleMapper
  end

  def groups
    group_service.fetch_groups(user: self)
  end
  
  module ClassMethods
    # This method finds User objects using the user_key as specified by the
    # Devise authentication_keys configuration variable. This method encapsulates
    # whether we use email or username (or something else) as the identifing user attribute.
    def find_by_user_key(key)
      find_by(Hydra.config.user_key_field => key)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hydra-access-controls-13.0.0 lib/hydra/user.rb
hydra-access-controls-12.1.0 lib/hydra/user.rb
hydra-access-controls-12.0.2 lib/hydra/user.rb
hydra-access-controls-11.0.7 lib/hydra/user.rb
hydra-access-controls-12.0.1 lib/hydra/user.rb
hydra-access-controls-11.0.6 lib/hydra/user.rb
hydra-access-controls-12.0.0 lib/hydra/user.rb
hydra-access-controls-11.0.1 lib/hydra/user.rb
hydra-access-controls-11.0.0 lib/hydra/user.rb
hydra-access-controls-11.0.0.rc2 lib/hydra/user.rb
hydra-access-controls-10.7.0 lib/hydra/user.rb
hydra-access-controls-10.6.2 lib/hydra/user.rb
hydra-access-controls-10.6.1 lib/hydra/user.rb
hydra-access-controls-10.6.0 lib/hydra/user.rb
hydra-access-controls-10.5.1 lib/hydra/user.rb
hydra-access-controls-11.0.0.rc1 lib/hydra/user.rb
hydra-access-controls-10.5.0 lib/hydra/user.rb