Sha256: e8c6174b4ab54c4231d2125058673ec7bb39c68d198a82c73f33b91cb05b8227
Contents?: true
Size: 1.17 KB
Versions: 45
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(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
45 entries across 45 versions & 1 rubygems