activedirectory 0.9.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE DELETED
@@ -1,24 +0,0 @@
1
-
2
- The ActiveDirectory Module for Ruby is licensed under the MIT license (below).
3
-
4
- ------------------------------------------------------------------------------
5
-
6
- Copyright (c) 2005-2006 Justin Mecham
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to
10
- deal in the Software without restriction, including without limitation the
11
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12
- sell copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
- IN THE SOFTWARE.
data/README DELETED
@@ -1,139 +0,0 @@
1
- = Active Directory Module for Ruby
2
-
3
- This module enables effortless interaction with Active Directory servers.
4
-
5
- It is built atop the Ruby/LDAP[http://ruby-ldap.sourceforge.net/] extension
6
- with explicit support for the idiosyncrasies of Microsoft Windows Servers and
7
- the LDAP objects defined therein. This includes support for:
8
-
9
- * Users (objectClass=user)
10
- * Groups (objectClass=group)
11
- * Additional objects will be supported in future releases (e.g. Computers,
12
- Printers, etc)
13
-
14
- == Installation
15
-
16
- === RubyGems
17
-
18
- The preferred method if installing the Active Directory Module for Ruby is
19
- with RubyGems[http://docs.rubygems.org/]. Installing with RubyGems is as
20
- simple as typing:
21
-
22
- gem install activedirectory-x.x.x.gem
23
-
24
- If you did not download the gem file and instead have the source distribution
25
- extracted you may create a gem by typing:
26
-
27
- rake package
28
-
29
- in the directory containing the Active Directory Module for Ruby source.
30
-
31
- === Source
32
-
33
- If you prefer not to use RubyGems to install the library, you may install the
34
- module from source by typing:
35
-
36
- ruby install.rb
37
-
38
- in the directory containing the Active Directory Module for Ruby source.
39
-
40
- == Usage Instructions
41
-
42
- === Including the module
43
-
44
- Once installed, you must include the ActiveDirectory module into your project.
45
- If you are using RubyGems, use:
46
-
47
- require_gem "activedirectory"
48
-
49
- Otherwise, include the module with:
50
-
51
- require "activedirectory"
52
-
53
- === Configuring your Active Directory instance
54
-
55
- Interacting with an Active Directory instance requires that you first
56
- configure the connection to a Windows domain controller. This configuration
57
- needs to be called only once when your application starts up. If you are using
58
- this module within a Ruby on Rails[http://www.rubyonrails.org/] application,
59
- you would place this in your environment.rb file.
60
-
61
- ActiveDirectory::Base.server_settings = {
62
- :host => "server.example.com",
63
- :username => "username",
64
- :password => "password",
65
- :domain => "example.com",
66
- :base_dn => "DC=example,DC=com"
67
- }
68
-
69
- Once ActiveDirectory::Base has been configured, any call into the API will
70
- open a new connection to the server on-demand (or use an existing open
71
- connection).
72
-
73
- == Example Usage
74
-
75
- === User Objects
76
-
77
- Locating users within a directory is very flexible. You may load individual
78
- users by their account name (sAMAccountName), their distinguished name (dn),
79
- or any number of users based on the criteria used in your LDAP search base and
80
- filters.
81
-
82
- # Load all users (including disabled) within the default Base DN.
83
- all_users = ActiveDirectory::User.find(:all)
84
-
85
- # Load all disabled users within the default Base DN.
86
- disabled_users = ActiveDirectory::User.find(:all,
87
- :filter => "(userAccountControl=514)")
88
-
89
- # Load all users who are in the Managers organizational unit whose accounts
90
- # are not disabled.
91
- managers = ActiveDirectory::User.find(:all,
92
- :base => "OU=Managers,DC=example,DC=com",
93
- :filter => "(userAccountControl=512)")
94
-
95
- # Load the user "John Doe" by his sAMAccountName.
96
- user = ActiveDirectory::User.find("jdoe")
97
-
98
- # Load the user "John Doe" by his distinguished name (DN).
99
- user = ActiveDirectory::User.find("CN=John Doe,CN=Users,DC=example,DC=com")
100
-
101
- === Group Objects
102
-
103
- Locating Groups is just as simple as Users, however, you must provide a
104
- Distinguished Name (DN) for loading.
105
-
106
- # Load all groups within the default Base DN.
107
- all_groups = ActiveDirectory::Group.find(:all)
108
-
109
- # Load the "Developers" group by its distinguished name (DN).
110
- developers = ActiveDirectory::Group.find("CN=Developers,DC=example,DC=com")
111
-
112
- == License
113
-
114
- The Active Directory Module for Ruby module is licensed under the MIT License.
115
-
116
- Copyright (c) 2005-2006 Justin Mecham
117
-
118
- Permission is hereby granted, free of charge, to any person obtaining a copy
119
- of this software and associated documentation files (the "Software"), to
120
- deal in the Software without restriction, including without limitation the
121
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
122
- sell copies of the Software, and to permit persons to whom the Software is
123
- furnished to do so, subject to the following conditions:
124
-
125
- The above copyright notice and this permission notice shall be included in
126
- all copies or substantial portions of the Software.
127
-
128
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
129
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
130
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
131
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
133
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
134
- IN THE SOFTWARE.
135
-
136
- == Contact
137
-
138
- The Active Directory Module for Ruby is developed and maintained by Justin
139
- Mecham (jmecham@justin@aspect.net[mailto:jmecham@justin@aspect.net]).
data/Rakefile DELETED
@@ -1,76 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/testtask'
4
- require 'rake/rdoctask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require File.join(File.dirname(__FILE__), 'lib', 'active_directory', 'version')
8
-
9
- PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
10
- PKG_NAME = 'activedirectory'
11
- PKG_VERSION = ActiveDirectory::VERSION::STRING + PKG_BUILD
12
- PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
13
-
14
- RELEASE_NAME = "REL #{PKG_VERSION}"
15
-
16
- desc "Default Task"
17
- task :default => [ :test ]
18
-
19
-
20
- # Run the unit tests
21
- Rake::TestTask.new { |t|
22
- t.libs << "test"
23
- t.pattern = 'test/*_test.rb'
24
- t.verbose = true
25
- }
26
-
27
-
28
- # Genereate the RDoc documentation
29
- Rake::RDocTask.new { |rdoc|
30
- rdoc.rdoc_dir = 'doc'
31
- rdoc.title = "Active Directory Module for Ruby -- Effortless Interaction with Active Directory"
32
- rdoc.options << "--line-numbers" << "--inline-source"
33
- rdoc.template = "#{ENV['template']}.rb" if ENV['template']
34
- rdoc.rdoc_files.include(['README', 'LICENSE'])
35
- rdoc.rdoc_files.include('lib/**/*.rb')
36
- }
37
-
38
- # Create compressed packages
39
- spec = Gem::Specification.new do |s|
40
- s.platform = Gem::Platform::RUBY
41
- s.name = PKG_NAME
42
- s.summary = "Module for easy interaction with Active Directory servers."
43
- s.description = %q{Makes it trivial to integrate with Active Directory servers for information and authentication concerning users and groups.}
44
- s.version = PKG_VERSION
45
-
46
- s.author = "Justin Mecham"
47
- s.email = "justin@aspect.net"
48
-
49
- s.has_rdoc = true
50
- s.requirements << 'none'
51
- s.require_path = 'lib'
52
- s.autorequire = 'active_directory'
53
-
54
- s.files = [ "Rakefile", "install.rb", "README", "LICENSE" ]
55
- s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
56
- s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
57
- end
58
-
59
- Rake::GemPackageTask.new(spec) do |pkg|
60
- pkg.gem_spec = spec
61
- pkg.need_tar = true
62
- pkg.need_zip = true
63
- end
64
-
65
-
66
- #desc "Publish the API documentation"
67
- #task :pgem => [:package] do
68
- # Rake::SshFilePublisher.new("[user@host]", "[path]", "pkg", "#{PKG_FILE_NAME}.gem").upload
69
- #end
70
-
71
-
72
- #desc "Publish the API documentation"
73
- #task :pdoc => [:rdoc] do
74
- # Rake::SshDirPublisher.new("[user@host]", "[path]", "doc").upload
75
- #end
76
-
data/install.rb DELETED
@@ -1,27 +0,0 @@
1
- require 'rbconfig'
2
- require 'find'
3
- require 'ftools'
4
-
5
- include Config
6
-
7
- $sitedir = CONFIG["sitelibdir"]
8
- unless $sitedir
9
- version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
10
- $libdir = File.join(CONFIG["libdir"], "ruby", version)
11
- $sitedir = $:.find {|x| x =~ /site_ruby/ }
12
- if !$sitedir
13
- $sitedir = File.join($libdir, "site_ruby")
14
- elsif $sitedir !~ Regexp.quote(version)
15
- $sitedir = File.join($sitedir, version)
16
- end
17
- end
18
-
19
- Dir.chdir("lib")
20
-
21
- Find.find("active_directory", "active_directory.rb") { |f|
22
- if f[-3..-1] == ".rb"
23
- File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
24
- else
25
- File::makedirs(File.join($sitedir, *f.split(/\//)))
26
- end
27
- }
@@ -1,50 +0,0 @@
1
- #
2
- # Extends the class object with class and instance accessors for class
3
- # attributes, just like the native attr* accessors for instance attributes.
4
- #
5
- # This was taken from ActiveSupport (see rubyonrails.org)
6
- #
7
- class Class # :nodoc:
8
-
9
- def cattr_reader(*syms)
10
- syms.flatten.each do |sym|
11
- class_eval(<<-EOS, __FILE__, __LINE__)
12
- unless defined? @@#{sym}
13
- @@#{sym} = nil
14
- end
15
-
16
- def self.#{sym}
17
- @@#{sym}
18
- end
19
-
20
- def #{sym}
21
- @@#{sym}
22
- end
23
- EOS
24
- end
25
- end
26
-
27
- def cattr_writer(*syms)
28
- syms.flatten.each do |sym|
29
- class_eval(<<-EOS, __FILE__, __LINE__)
30
- unless defined? @@#{sym}
31
- @@#{sym} = nil
32
- end
33
-
34
- def self.#{sym}=(obj)
35
- @@#{sym} = obj
36
- end
37
-
38
- def #{sym}=(obj)
39
- @@#{sym} = obj
40
- end
41
- EOS
42
- end
43
- end
44
-
45
- def cattr_accessor(*syms)
46
- cattr_reader(*syms)
47
- cattr_writer(*syms)
48
- end
49
-
50
- end
@@ -1,10 +0,0 @@
1
- #
2
- # This was taken from ActiveSupport (see rubyonrails.org)
3
- #
4
- class Hash #:nodoc:
5
- def assert_valid_keys(*valid_keys)
6
- unknown_keys = keys - [valid_keys].flatten
7
- raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") \
8
- unless unknown_keys.empty?
9
- end
10
- end
@@ -1,37 +0,0 @@
1
- #--
2
- # Active Directory Module for Ruby
3
- #
4
- # Copyright (c) 2005-2006 Justin Mecham
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to
8
- # deal in the Software without restriction, including without limitation the
9
- # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
- # sell copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22
- # IN THE SOFTWARE.
23
- #++
24
-
25
- module ActiveDirectory
26
-
27
- module VERSION #:nodoc:
28
-
29
- MAJOR = 0
30
- MINOR = 9
31
- TINY = 3
32
-
33
- STRING = [MAJOR, MINOR, TINY].join('.')
34
-
35
- end
36
-
37
- end