csv-ldap 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +30 -1
- data/examples/csv_to_ldap.rb +17 -0
- data/examples/ldap_data.csv +11 -0
- data/examples/ldap_to_csv.rb +17 -0
- data/examples/ldap_to_csv_filtered.rb +19 -0
- data/examples/ldap_to_csv_filtered_output.csv +2 -0
- data/examples/ldap_to_csv_output.csv +9 -0
- data/lib/csv/ldap/version.rb +1 -1
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 189069b363602763f37a17178c8a94d8a8babf87
|
4
|
+
data.tar.gz: 362c2fc437e0b492303caefb1ae642c9c1960453
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8a0e746a1596e91127274ba3a2f586dcc2dc631c298e0b06a2f8fde3ba82d26e33d39af171ddb997fad1287148adc06ed8bdad327445792fa22e30fc39560b7
|
7
|
+
data.tar.gz: 822d5ff8faae4633a6bfffef706152f2634ad9b8fa8b2dbf7c2e3edea8c0d0c60fb8453030cbedc4e0bb2e251065cfe81d9002c2edfb06c9c680cb66929cc32b
|
data/README.md
CHANGED
@@ -67,7 +67,36 @@ Or install it yourself as:
|
|
67
67
|
|
68
68
|
## Usage
|
69
69
|
|
70
|
-
|
70
|
+
Make sure to run and confirm that node 'people' exists.
|
71
|
+
|
72
|
+
```
|
73
|
+
$ ldapsearch -x -LLL -H ldap:/// -b dc=example,dc=org dn
|
74
|
+
dn: dc=example,dc=org
|
75
|
+
|
76
|
+
dn: cn=admin,dc=example,dc=org
|
77
|
+
|
78
|
+
dn: ou=people,dc=example,dc=org
|
79
|
+
```
|
80
|
+
|
81
|
+
### Write in ldap from csv.
|
82
|
+
|
83
|
+
```
|
84
|
+
$ cd csv-ldap
|
85
|
+
$ ruby examples/csv_to_ldap.rb csv-ldap/examples/ldap_data.csv
|
86
|
+
```
|
87
|
+
|
88
|
+
### Read from ldap to csv.
|
89
|
+
|
90
|
+
```
|
91
|
+
$ ruby examples/ldap_to_csv.rb output.csv
|
92
|
+
```
|
93
|
+
|
94
|
+
### Seach with filter from ldap to csv.
|
95
|
+
|
96
|
+
```
|
97
|
+
$ ruby examples/ldap_to_csv_filtered.rb ldap_to_csv_filtered_output.csv John*
|
98
|
+
|
99
|
+
```
|
71
100
|
|
72
101
|
## Development
|
73
102
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'csv/ldap'
|
2
|
+
|
3
|
+
ldap = Csv::Ldap.new host: 'localhost',
|
4
|
+
port: 389,
|
5
|
+
auth: {
|
6
|
+
method: :simple,
|
7
|
+
username: 'cn=admin,dc=example,dc=org',
|
8
|
+
password: 'secret'
|
9
|
+
}
|
10
|
+
|
11
|
+
if ldap.bind
|
12
|
+
# authentication succeeded
|
13
|
+
ldap.import(ARGV[0])
|
14
|
+
else
|
15
|
+
# authentication failed
|
16
|
+
puts ldap.get_operation_result
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
cn,sn,mail,uid,homeDirectory,uidNumber,gidNumber
|
2
|
+
John Doe,Doe,john@example.org,john,/home/john,10000,5000
|
3
|
+
Jeannine Sylviane,Sylviane,jeannine@example.org,jeannine,/home/jeannine,10000,5000
|
4
|
+
Hans Rosario,Rosario,hans@example.org,hans,/home/hans,10000,5000
|
5
|
+
Carmina Merche,Merche,carmina@example.org,carmina,/home/carmina,10000,5000
|
6
|
+
Rebecka Flavia,Flavia,rebecka@example.org,rebecka,/home/rebecka,10000,5000
|
7
|
+
Delia Pablo,Pablo,delia@example.org,delia,/home/delia,10000,5000
|
8
|
+
Soraya Sacha,Sacha,soraya@example.org,soraya,/home/soraya,10000,5000
|
9
|
+
Goran Monica,Monica,goran@example.org,goran,/home/goran,10000,5000
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'csv/ldap'
|
2
|
+
|
3
|
+
ldap = Csv::Ldap.new host: 'localhost',
|
4
|
+
port: 389,
|
5
|
+
auth: {
|
6
|
+
method: :simple,
|
7
|
+
username: 'cn=admin,dc=example,dc=org',
|
8
|
+
password: 'secret'
|
9
|
+
}
|
10
|
+
|
11
|
+
if ldap.bind
|
12
|
+
# authentication succeeded
|
13
|
+
ldap.export({output_file_path: ARGV[0]})
|
14
|
+
else
|
15
|
+
# authentication failed
|
16
|
+
puts ldap.get_operation_result
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'csv/ldap'
|
2
|
+
|
3
|
+
ldap = Csv::Ldap.new host: 'localhost',
|
4
|
+
port: 389,
|
5
|
+
auth: {
|
6
|
+
method: :simple,
|
7
|
+
username: 'cn=admin,dc=example,dc=org',
|
8
|
+
password: 'secret'
|
9
|
+
}
|
10
|
+
|
11
|
+
if ldap.bind
|
12
|
+
# authentication succeeded
|
13
|
+
filter = Net::LDAP::Filter.eq( "cn", ARGV[1] )
|
14
|
+
|
15
|
+
ldap.export({output_file_path: ARGV[0], filter: filter})
|
16
|
+
else
|
17
|
+
# authentication failed
|
18
|
+
puts ldap.get_operation_result
|
19
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
cn,sn,mail,uid,homeDirectory,uidNumber,gidNumber
|
2
|
+
John Doe,Doe,john@example.org,john,/home/john,10000,5000
|
3
|
+
Jeannine Sylviane,Sylviane,jeannine@example.org,jeannine,/home/jeannine,10000,5000
|
4
|
+
Hans Rosario,Rosario,hans@example.org,hans,/home/hans,10000,5000
|
5
|
+
Carmina Merche,Merche,carmina@example.org,carmina,/home/carmina,10000,5000
|
6
|
+
Rebecka Flavia,Flavia,rebecka@example.org,rebecka,/home/rebecka,10000,5000
|
7
|
+
Delia Pablo,Pablo,delia@example.org,delia,/home/delia,10000,5000
|
8
|
+
Soraya Sacha,Sacha,soraya@example.org,soraya,/home/soraya,10000,5000
|
9
|
+
Goran Monica,Monica,goran@example.org,goran,/home/goran,10000,5000
|
data/lib/csv/ldap/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv-ldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aashish Kiran
|
@@ -105,6 +105,12 @@ files:
|
|
105
105
|
- bin/console
|
106
106
|
- bin/setup
|
107
107
|
- csv-ldap.gemspec
|
108
|
+
- examples/csv_to_ldap.rb
|
109
|
+
- examples/ldap_data.csv
|
110
|
+
- examples/ldap_to_csv.rb
|
111
|
+
- examples/ldap_to_csv_filtered.rb
|
112
|
+
- examples/ldap_to_csv_filtered_output.csv
|
113
|
+
- examples/ldap_to_csv_output.csv
|
108
114
|
- lib/csv/ldap.rb
|
109
115
|
- lib/csv/ldap/version.rb
|
110
116
|
- lib/csv_ldap.rb
|