Sha256: b0565017c6c6bbd91c2627cd5211a1ed8aff4ecb27bfd4eb650cb57dde4050dd
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require 'example/posix.rb' USER_REPO = :default class User def self.ddefault_repository_name USER_REPO end def self.repository_name USER_REPO end def authenticate(pwd) require 'base64' Base64.encode64(Digest::SHA1.digest(pwd)).gsub(/\n/, '') == attribute_get(:hashed_password)[5,1000] end end class GroupUser def self.ddefault_repository_name USER_REPO end def self.repository_name USER_REPO end end class Group def self.ddefault_repository_name USER_REPO end def self.repository_name USER_REPO end end require 'adapters/memory_adapter' DATA_REPO=:store DataMapper.setup(DATA_REPO, {:adapter => 'memory'}) class Item include DataMapper::Resource property :id, Serial end DataMapper.repository(USER_REPO) do |repository| repository.adapter.open_ldap_connection do DataMapper.repository(DATA_REPO) do root = User.create(:id => 0, :login => :root, :name => 'root', :password => 'none') admin = Group.create(:name => :admin) root.groups << admin p DataMapper.repository(USER_REPO).identity_map(User) p DataMapper.repository(USER_REPO).identity_map(Group) p root.authenticate('none') p root.groups (1..10).each {Item.create} p DataMapper.repository(DATA_REPO).identity_map(Item) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dm-ldap-adapter-0.2.0 | example/identity_map.rb |