synchronize-users 0.0.1 → 0.0.2

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: 6d2897ac45438f6e6570a135aeb8378c1e7b9c33
4
- data.tar.gz: 2a174bea51266178ce799d6c1682ef850a05bd46
3
+ metadata.gz: 250e9a1240d91f89a6e3513dca5bf7a016acb798
4
+ data.tar.gz: 50404d6249483e6c767adfa530f8e8800d2b9787
5
5
  SHA512:
6
- metadata.gz: cd75b9c9df0e2a106d9643007655d8e4696b26e6b2008bfaebd916220145948c9b17297ce0615ed5207c292c24dd88a3ea52bbfe55e304d9ae1aaedde71a9491
7
- data.tar.gz: cf1c6c6a7afeec8037b62631c228940460063638894d2de7d1128b12a202cb76eb1a8a65607598408a880dfe6ad22303b01231f449fd7eb5a2a795d7bbcc1ae7
6
+ metadata.gz: 93392ff3d8328c0e32742482277ed56683fd0092c97a175c812dbe9d4c2b8c895ebbc8ad5ec80f484bdcdf67c91552dca440bac7e0ade71b9aa70de9e9070216
7
+ data.tar.gz: 79da520fc82edfa02797397b5abca6a3d8079bd6c3cdbee63873d69296ab3c1e18ba44ecdbbd6dd60833ceaf68e1b51cb7eb67202296d21a85f5c368dd1fe286
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synchronize-users (0.0.1)
5
- mooset (= 0.0.5)
4
+ synchronize-users (0.0.2)
5
+ mooset (= 0.0.6)
6
6
  pry
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- aruba (0.6.2)
11
+ aruba (0.7.4)
12
12
  childprocess (>= 0.3.6)
13
13
  cucumber (>= 1.1.1)
14
14
  rspec-expectations (>= 2.7.0)
@@ -22,20 +22,20 @@ GEM
22
22
  coderay (1.1.0)
23
23
  coercible (1.0.0)
24
24
  descendants_tracker (~> 0.0.1)
25
- cucumber (2.0.0)
25
+ cucumber (2.0.1)
26
26
  builder (>= 2.1.2)
27
- cucumber-core (~> 1.1.3)
27
+ cucumber-core (~> 1.2.0)
28
28
  diff-lcs (>= 1.1.3)
29
29
  gherkin (~> 2.12)
30
30
  multi_json (>= 1.7.5, < 2.0)
31
31
  multi_test (>= 0.1.2)
32
- cucumber-core (1.1.3)
32
+ cucumber-core (1.2.0)
33
33
  gherkin (~> 2.12.0)
34
34
  descendants_tracker (0.0.4)
35
35
  thread_safe (~> 0.3, >= 0.3.1)
36
36
  diff-lcs (1.2.5)
37
37
  equalizer (0.0.11)
38
- ffi (1.9.9)
38
+ ffi (1.9.10)
39
39
  gherkin (2.12.2)
40
40
  multi_json (~> 1.3)
41
41
  gitlab (3.3.0)
@@ -48,12 +48,12 @@ GEM
48
48
  json (1.8.3)
49
49
  lspace (0.13)
50
50
  method_source (0.8.2)
51
- mooset (0.0.5)
51
+ mooset (0.0.6)
52
52
  gitlab (~> 3.3.0)
53
53
  lspace (~> 0.13)
54
54
  net-ldap (~> 0.10)
55
55
  virtus (~> 1.0.3)
56
- multi_json (1.11.1)
56
+ multi_json (1.11.2)
57
57
  multi_test (0.1.2)
58
58
  multi_xml (0.5.5)
59
59
  net-ldap (0.11)
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ synchronize-users
2
+ ===
3
+
4
+ Create users in gitlab and add them to a group.
5
+
6
+ ## Install
7
+
8
+ ```
9
+ gem install synchronize-users
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ Usage: bin/synchronize-users [options]
16
+ -f, --logfile FILE Logfile
17
+ -v, --verbose Verbose
18
+ -c, --config FILE Config file
19
+ ```
20
+
21
+ ## Configuration
22
+
23
+
24
+ ```
25
+ SynchronizeUsers.configure do |config|
26
+ config.ldap = {
27
+ host: 'ldaphost',
28
+ port: 389,
29
+ bind_dn: 'DC=domain,DC=com',
30
+ bind_password: '123',
31
+ treebase: 'DC=domain,DC=com'
32
+ }
33
+
34
+ config.gitlab = {
35
+ endpoint: 'http://gitlab',
36
+ private_token: 'xxxxx'
37
+ }
38
+
39
+ config.from = { dn: 'CN=Users,DC=domain,DC=com' }
40
+ config.to = "employees"
41
+ config.role = DEVELOPER
42
+ end
43
+ ```
data/config.dist ADDED
@@ -0,0 +1,18 @@
1
+ SynchronizeUsers.configure do |config|
2
+ config.ldap = {
3
+ host: 'ldaphost',
4
+ port: 389,
5
+ bind_dn: 'DC=domain,DC=com',
6
+ bind_password: '123',
7
+ treebase: 'DC=domain,DC=com'
8
+ }
9
+
10
+ config.gitlab = {
11
+ endpoint: 'http://gitlab',
12
+ private_token: 'xxxxx'
13
+ }
14
+
15
+ config.from = { dn: 'CN=Users,DC=domain,DC=com' }
16
+ config.to = "employees"
17
+ config.role = DEVELOPER
18
+ end
data/config.rb ADDED
@@ -0,0 +1,18 @@
1
+ SynchronizeUsers.configure do |config|
2
+ config.ldap = {
3
+ host: '10.0.0.3',
4
+ port: 389,
5
+ bind_dn: 'CN=Gitlab LDAP,OU=Service Users,DC=office,DC=pitechnologies,DC=ro',
6
+ bind_password: '123456',
7
+ treebase: 'DC=office,DC=pitechnologies,DC=ro'
8
+ }
9
+
10
+ config.gitlab = {
11
+ endpoint: 'http://gitlab-dev',
12
+ private_token: 'xks7aJv8yYxkBELQ8194'
13
+ }
14
+
15
+ config.from = { dn: 'CN=Employees,CN=Users,DC=office,DC=pitechnologies,DC=ro' }
16
+ config.to = "pitech"
17
+ config.role = REPORTER
18
+ end
@@ -15,7 +15,7 @@ module SynchronizeUsers
15
15
 
16
16
  def run!
17
17
  @from_group.each_new_user do |user|
18
- @target_group.import_user(user) do |result|
18
+ @target_group.import_user(user, @config.role) do |result|
19
19
  result.on_new_user { |source| @target_group.create_user(source) }
20
20
  result.on_error { |e| logger.error e }
21
21
  end
@@ -42,14 +42,14 @@ module SynchronizeUsers
42
42
  @connection.endpoint.users.import(user)
43
43
  end
44
44
 
45
- def import_user(source)
45
+ def import_user(source, role)
46
46
  to_user = @connection.endpoint.users.find(source)
47
47
 
48
48
  if !to_user
49
49
  to_user = yield Result.new_user(source)
50
50
  end
51
51
 
52
- @group << to_user
52
+ @group.add_member(to_user, role)
53
53
  rescue => e
54
54
  yield Result.error(e)
55
55
  end
@@ -1,3 +1,3 @@
1
1
  module SynchronizeUsers
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -7,6 +7,12 @@ require 'synchronize-users/target_group.rb'
7
7
  require 'synchronize-users/from_group.rb'
8
8
 
9
9
  module SynchronizeUsers
10
+ GUEST = 10
11
+ REPORTER = 20
12
+ DEVELOPER = 30
13
+ MASTER = 40
14
+ OWNER = 50
15
+
10
16
  class << self
11
17
  attr_accessor :configuration
12
18
  end
@@ -25,6 +31,7 @@ module SynchronizeUsers
25
31
  class Configuration
26
32
  attr_reader :gitlab, :ldap
27
33
  attr_accessor :from, :to
34
+ attr_writer :role
28
35
 
29
36
  def gitlab=(opts)
30
37
  @gitlab = Mooset::Endpoints::Endpoint.create(:gitlab, opts)
@@ -33,5 +40,9 @@ module SynchronizeUsers
33
40
  def ldap=(opts)
34
41
  @ldap = Mooset::Endpoints::Endpoint.create(:ldap, opts)
35
42
  end
43
+
44
+ def role
45
+ @role || REPORTER
46
+ end
36
47
  end
37
48
  end
@@ -12,7 +12,7 @@ spec = Gem::Specification.new do |s|
12
12
  ")
13
13
  s.require_paths << 'lib'
14
14
  s.has_rdoc = true
15
- s.extra_rdoc_files = ['README.rdoc','synchronize-users.rdoc']
15
+ s.extra_rdoc_files = ['README.md']
16
16
  s.rdoc_options << '--title' << 'synchronize-users' << '--main' << 'README.rdoc' << '-ri'
17
17
  s.bindir = 'bin'
18
18
  s.executables << 'synchronize-users'
@@ -20,6 +20,6 @@ spec = Gem::Specification.new do |s|
20
20
  s.add_development_dependency('rdoc')
21
21
  s.add_development_dependency('aruba')
22
22
  #s.add_runtime_dependency('gli','2.13.1')
23
- s.add_runtime_dependency('mooset','0.0.5')
23
+ s.add_runtime_dependency('mooset','0.0.6')
24
24
  s.add_runtime_dependency('pry')
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synchronize-users
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandru Keszeg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-30 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.0.5
61
+ version: 0.0.6
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.0.5
68
+ version: 0.0.6
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,15 @@ executables:
86
86
  - synchronize-users
87
87
  extensions: []
88
88
  extra_rdoc_files:
89
- - README.rdoc
90
- - synchronize-users.rdoc
89
+ - README.md
91
90
  files:
92
91
  - Gemfile
93
92
  - Gemfile.lock
94
- - README.rdoc
93
+ - README.md
95
94
  - Rakefile
96
95
  - bin/synchronize-users
96
+ - config.dist
97
+ - config.rb
97
98
  - features/step_definitions/synchronize-users_steps.rb
98
99
  - features/support/env.rb
99
100
  - features/synchronize-users.feature
@@ -104,7 +105,6 @@ files:
104
105
  - lib/synchronize-users/target_group.rb
105
106
  - lib/synchronize-users/version.rb
106
107
  - synchronize-users.gemspec
107
- - synchronize-users.rdoc
108
108
  - test/default_test.rb
109
109
  - test/test_helper.rb
110
110
  homepage: http://github.com/artworx/synchronize-users
data/README.rdoc DELETED
@@ -1,6 +0,0 @@
1
- = synchronize-users
2
-
3
- Describe your project here
4
-
5
- :include:synchronize-users.rdoc
6
-
@@ -1,5 +0,0 @@
1
- = synchronize-users
2
-
3
- Generate this with
4
- synchronize-users rdoc
5
- After you have described your command line interface