Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved support files into seperate support folder, and cleaned up the …
…main RSpec file.
- Loading branch information
Showing
16 changed files
with
169 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
$LOAD_PATH << File.dirname(__FILE__) | ||
require 'spec_helper' | ||
|
||
describe DataMapper::Adapters::LdapAdapter do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
$LOAD_PATH << File.dirname(__FILE__) | ||
require 'spec_helper' | ||
|
||
describe DataMapper.repository(:ldap).adapter do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
$LOAD_PATH << File.dirname(__FILE__) | ||
require 'spec_helper' | ||
require 'ldap/transactions' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
$LOAD_PATH << File.dirname(__FILE__) | ||
require 'spec_helper' | ||
|
||
class Order | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Group | ||
include DataMapper::Resource | ||
property :id, Serial, :field => "gidNumber" | ||
property :name, String, :field => "cn" | ||
|
||
dn_prefix { |group| "cn=#{group.name}" } | ||
|
||
treebase "ou=groups" | ||
|
||
ldap_properties {{:objectclass => "posixGroup"}} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class GroupUser | ||
include DataMapper::Resource | ||
|
||
dn_prefix { |group_user| "cn=#{group_user.group.name}" } | ||
|
||
treebase "ou=groups" | ||
|
||
multivalue_field :memberUid | ||
|
||
ldap_properties do |group_user| | ||
{:cn=>"#{group_user.group.name}", :objectclass => "posixGroup"} | ||
end | ||
|
||
property :user_id, String, :key => true, :field => "memberUid" | ||
property :group_id, Integer, :key => true, :field => "gidNumber" | ||
|
||
def group | ||
Group.get!(group_id) | ||
end | ||
|
||
def group=(group) | ||
group_id = group.id | ||
end | ||
|
||
def user | ||
User.get!(user_id) | ||
end | ||
|
||
def user=(user) | ||
user_id = user.id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#This needs some documentation. | ||
|
||
module DataMapper | ||
module Resource | ||
class State | ||
|
||
# a persisted/deleted resource | ||
class Deleted < Persisted | ||
def set(subject, value) | ||
warn 'Deleted resource cannot be modified ' + subject.inspect + ' ' + value.to_s + " " + @resource.inspect | ||
super | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Role | ||
include DataMapper::Resource | ||
property :id, Serial, :field => "gidNumber" | ||
property :name, String, :field => "cn" | ||
|
||
dn_prefix { |role| "cn=#{role.name}" } | ||
|
||
treebase "ou=groups" | ||
|
||
ldap_properties {{:objectclass => "posixGroup"}} | ||
|
||
belongs_to :user | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class TestContact | ||
include DataMapper::Resource | ||
|
||
property :id, Serial, :field => "uidNumber" | ||
property :login, String, :field => "uid", :unique_index => true | ||
property :hashed_password, String, :field => "userPassword", :lazy => true | ||
property :name, String, :field => "cn" | ||
property :mail, ::Ldap::LdapArray | ||
|
||
dn_prefix { |contact| "uid=#{contact.login}"} | ||
|
||
treebase "ou=people" | ||
|
||
ldap_properties do |contact| | ||
properties = { :objectclass => ["inetOrgPerson", "posixAccount", "shadowAccount"], :loginshell => "/bin/bash", :gidnumber => "10000" } | ||
properties[:sn] = "#{contact.name.sub(/.*\ /, "")}" | ||
properties[:givenname] = "#{contact.name.sub(/\ .*/, "")}" | ||
properties[:homedirectory] = "/home/#{contact.login}" | ||
properties | ||
end | ||
|
||
def password=(password) | ||
attribute_set(:hashed_password, Ldap::Digest.ssha(password, "--#{Time.now}--#{login}--")) if password | ||
end | ||
end |
Oops, something went wrong.