bsb_active_directory 8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +675 -0
- data/README.md +43 -0
- data/VERSION +1 -0
- data/lib/bsb_active_directory/attributes/group_type.rb +11 -0
- data/lib/bsb_active_directory/attributes/sam_account_type.rb +16 -0
- data/lib/bsb_active_directory/attributes.rb +3 -0
- data/lib/bsb_active_directory/base.rb +645 -0
- data/lib/bsb_active_directory/computer.rb +35 -0
- data/lib/bsb_active_directory/container.rb +114 -0
- data/lib/bsb_active_directory/field_type/binary.rb +39 -0
- data/lib/bsb_active_directory/field_type/date.rb +39 -0
- data/lib/bsb_active_directory/field_type/dn_array.rb +40 -0
- data/lib/bsb_active_directory/field_type/group_dn_array.rb +40 -0
- data/lib/bsb_active_directory/field_type/member_dn_array.rb +47 -0
- data/lib/bsb_active_directory/field_type/password.rb +41 -0
- data/lib/bsb_active_directory/field_type/timestamp.rb +45 -0
- data/lib/bsb_active_directory/field_type/user_dn_array.rb +40 -0
- data/lib/bsb_active_directory/group.rb +160 -0
- data/lib/bsb_active_directory/member.rb +53 -0
- data/lib/bsb_active_directory/user.rb +182 -0
- data/lib/bsb_active_directory/version.rb +3 -0
- data/lib/bsb_active_directory.rb +94 -0
- metadata +110 -0
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
= Active Directory
|
2
|
+
|
3
|
+
Ruby Integration with Microsoft's Active Directory system based on original code by Justin Mecham and James Hunt at http://rubyforge.org/projects/activedirectory
|
4
|
+
|
5
|
+
See documentation on ActiveDirectory::Base for more information.
|
6
|
+
|
7
|
+
Caching:
|
8
|
+
Queries for membership and group membership are based on the distinguished name of objects. Doing a lot of queries, especially for a Rails app, is a sizable slowdown. To alleviate the problem, I've implemented a very basic cache for queries which search by :distinguishedname. This is disabled by default. All other queries are unaffected.
|
9
|
+
|
10
|
+
|
11
|
+
A code example is worth a thousand words:
|
12
|
+
|
13
|
+
<pre>
|
14
|
+
require 'rubygems'
|
15
|
+
require 'bsb_active_directory'
|
16
|
+
|
17
|
+
# Uses the same settings as net/ldap
|
18
|
+
settings = {
|
19
|
+
:host => 'domain-controller.example.local',
|
20
|
+
:base => 'dc=example,dc=local',
|
21
|
+
:port => 636,
|
22
|
+
:encryption => :simple_tls,
|
23
|
+
:auth => {
|
24
|
+
:method => :simple,
|
25
|
+
:username => "username",
|
26
|
+
:password => "password"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
# Basic usage
|
31
|
+
ActiveDirectory::Base.setup(settings)
|
32
|
+
|
33
|
+
ActiveDirectory::User.find(:all)
|
34
|
+
ActiveDirectory::User.find(:first, :userprincipalname => "john.smith@domain.com")
|
35
|
+
|
36
|
+
ActiveDirectory::Group.find(:all)
|
37
|
+
|
38
|
+
#Caching is disabled by default, to enable:
|
39
|
+
ActiveDirectory::Base.enable_cache
|
40
|
+
ActiveDirectory::Base.disable_cache
|
41
|
+
ActiveDirectory::Base.cache?
|
42
|
+
|
43
|
+
</pre>
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.6.2
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ActiveDirectory
|
2
|
+
module GroupType
|
3
|
+
BUILTIN_LOCAL_GROUP = 0x00000001
|
4
|
+
ACCOUNT_GROUP = 0x00000002
|
5
|
+
RESSOURCE_GROUP = 0x00000004
|
6
|
+
UNIVERSAL_GROUP = 0x00000008
|
7
|
+
APP_BASIC_GROUP = 0x00000010
|
8
|
+
APP_QUERY_GROUP = 0x00000020
|
9
|
+
SECURITY_ENABLED = 0x80000000
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ActiveDirectory
|
2
|
+
module SamAccountType
|
3
|
+
DOMAIN_OBJECT = 0x0
|
4
|
+
GROUP_OBJECT = 0x10000000
|
5
|
+
NON_SECURITY_GROUP_OBJECT = 0x10000001
|
6
|
+
ALIAS_OBJECT = 0x20000000
|
7
|
+
NON_SECURITY_ALIAS_OBJECT = 0x20000001
|
8
|
+
USER_OBJECT = 0x30000000
|
9
|
+
NORMAL_USER_ACCOUNT = 0x30000000
|
10
|
+
MACHINE_ACCOUNT = 0x30000001
|
11
|
+
TRUST_ACCOUNT = 0x30000002
|
12
|
+
APP_BASIC_GROUP = 0x40000000
|
13
|
+
APP_QUERY_GROUP = 0x40000001
|
14
|
+
ACCOUNT_TYPE_MAX = 0x7fffffff
|
15
|
+
end
|
16
|
+
end
|