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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6070e00a0b098fd0ee8b688433e71f459e64568
4
- data.tar.gz: 6b24b39be04709b41a7c7aa2a5331eeac9b7302a
3
+ metadata.gz: 189069b363602763f37a17178c8a94d8a8babf87
4
+ data.tar.gz: 362c2fc437e0b492303caefb1ae642c9c1960453
5
5
  SHA512:
6
- metadata.gz: 7122abb77d7e1ebeca7c127410730e690b27f62e97e66baa75b6b7cc8ed52192a0fce83bf90c1e23f8092610bbf6b27a1958beefe6f1f18f7b9b871d53d9230b
7
- data.tar.gz: 73716e7289474115f4110b03ff3cb2e4377651e8e026496b9652816df5770b347f745cdbe2ad19f3acc7801ac23908d20d458fb378d18e825ffb0780ae3239d4
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
- TODO: Write usage instructions here
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,2 @@
1
+ cn,sn,mail,uid,homeDirectory,uidNumber,gidNumber
2
+ John Doe,Doe,john@example.org,john,/home/john,10000,5000
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Csv
2
2
  class Ldap
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
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.0
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