Sha256: 7eac3b616ca73e7da50e07c3ef46a6d20ed440feb845795bccbb8e9b86dd5baa
Contents?: true
Size: 1.17 KB
Versions: 33
Compression:
Stored size: 1.17 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 def groups RoleMapper.roles(user_key) 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
33 entries across 33 versions & 1 rubygems