Sha256: e652d048f1b1138af896c2ec3d1a39ee9297cf3203da5a6ffdd4440a3d9a52de
Contents?: true
Size: 1.12 KB
Versions: 10
Compression:
Stored size: 1.12 KB
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 def self.included(klass) # Other modules to auto-include klass.extend(ClassMethods) end # This method should display the unique identifier for this user as defined by devise. # The unique identifier is what access controls will be enforced against. def user_key send(Devise.authentication_keys.first) 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
10 entries across 10 versions & 1 rubygems