adauth 2.0.0pre → 2.0.0pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/adauth/ad_object.rb +8 -0
- data/lib/adauth/connection.rb +1 -1
- data/lib/adauth/rails/model_bridge.rb +2 -1
- data/lib/adauth/version.rb +1 -1
- data/spec/adauth_ad_object_user_spec.rb +15 -0
- metadata +3 -3
data/lib/adauth/ad_object.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
module Adauth
|
2
|
+
def self.add_field(object, adauth_method, ldap_method)
|
3
|
+
object::Fields[adauth_method] = ldap_method
|
4
|
+
end
|
5
|
+
|
2
6
|
# Active Directory Interface Object
|
3
7
|
#
|
4
8
|
# Objects inherit from this class.
|
@@ -81,6 +85,10 @@ module Adauth
|
|
81
85
|
@dn_ous
|
82
86
|
end
|
83
87
|
|
88
|
+
def modify(operations)
|
89
|
+
raise "Modify Operation Failed" unless Adauth.connection.modify :dn => @ldap_object.dn, :operations => operations
|
90
|
+
end
|
91
|
+
|
84
92
|
private
|
85
93
|
|
86
94
|
def convert_to_objects(array)
|
data/lib/adauth/connection.rb
CHANGED
@@ -33,7 +33,8 @@ module Adauth
|
|
33
33
|
def update_from_adauth(adauth_model)
|
34
34
|
self.class::AdauthMappings.each do |k, v|
|
35
35
|
setter = "#{k.to_s}=".to_sym
|
36
|
-
|
36
|
+
value = v.is_a?(Array) ? v.join(", ") : v
|
37
|
+
self.send(setter, adauth_model.send(value))
|
37
38
|
end
|
38
39
|
self.save
|
39
40
|
end
|
data/lib/adauth/version.rb
CHANGED
@@ -24,4 +24,19 @@ describe Adauth::AdObjects::User do
|
|
24
24
|
user = administrator
|
25
25
|
user.member_of?("Domain Admins").should be_true
|
26
26
|
end
|
27
|
+
|
28
|
+
it "should allow for modification" do
|
29
|
+
default_config
|
30
|
+
Adauth.add_field(Adauth::AdObjects::User, :phone, :homePhone)
|
31
|
+
number = administrator.phone
|
32
|
+
administrator.modify([[:replace, :homephone, "8765"]])
|
33
|
+
administrator.phone.should eq "8765"
|
34
|
+
administrator.modify([[:replace, :homephone, number]])
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should allow for additional methods" do
|
38
|
+
default_config
|
39
|
+
Adauth.add_field(Adauth::AdObjects::User, :description, :description)
|
40
|
+
administrator.description.should be_a String
|
41
|
+
end
|
27
42
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 2.0.
|
8
|
+
- 0pre1
|
9
|
+
version: 2.0.0pre1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Adam "Arcath" Laycock
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-08-
|
17
|
+
date: 2012-08-20 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|