socialcast 1.0.0.beta3 → 1.0.0.beta4

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/config/ldap.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- # LDAP connection information
2
+ # LDAP connections
3
3
  connections:
4
4
  example_connection_1:
5
5
  username: "cn=Directory Manager"
@@ -24,21 +24,30 @@ connections:
24
24
  filter: "(mail=*)"
25
25
  encryption: simple_tls
26
26
 
27
+
27
28
  # LDAP attribute mappings
28
29
  mappings:
29
30
  first_name: givenName
30
31
  last_name: sn
31
32
  email: mail
32
- #only use employee_number if the email is unknown
33
- #employee_number: emp_id
34
- #only use unique_identifier if you do not wish to use email as the main user identification method
35
- #unique_identifier: samaccountname
33
+ # only use employee_number if the email is unknown
34
+ # employee_number: emp_id
35
+ # only use unique_identifier if you do not wish to use email as the main user identification method
36
+ # unique_identifier: samaccountname
37
+
38
+
39
+ # general script options
40
+ options:
41
+ # cleanup the extracted ldap data file after run is complete
42
+ delete_users_file: false
43
+ # skip sending emails to newly activated users
44
+ skip_emails: true
45
+ # do not actually provision accounts
46
+ # useful during testing
47
+ test: true
36
48
 
37
- delete_users_file: false
38
- # test being true implies that you wish to skip_emails
39
- test: true
40
- skip_emails: true
41
49
 
42
- # (optional) http_proxy setting
43
- # only needed if the script must connect to Socialcast through a proxy
44
- # http_proxy: "http://username:password@proxy.company.com:3128"
50
+ # http options for connecting to Socialcast servers
51
+ http:
52
+ # optional setting if script must connect to Socialcast server through a proxy
53
+ # proxy: "http://username:password@proxy.company.com:3128"
@@ -68,10 +68,12 @@ module Socialcast
68
68
  end
69
69
 
70
70
  desc 'provision', 'provision users from ldap compatible user repository'
71
- method_option :setup, :default => false
72
71
  method_option :config, :default => 'ldap.yml', :aliases => '-c'
73
72
  method_option :output, :default => 'users.xml.gz', :aliases => '-o'
74
- method_option :delete_users_file, :default => true
73
+ method_option :setup, :type => :boolean
74
+ method_option :delete_users_file, :type => :boolean
75
+ method_option :test, :type => :boolean
76
+ method_option :skip_emails, :type => :boolean
75
77
  def provision
76
78
  config_file = File.join Dir.pwd, options[:config]
77
79
 
@@ -141,18 +143,19 @@ module Socialcast
141
143
  say "Finished Scanning"
142
144
  say "Sending to Socialcast"
143
145
 
146
+ http_config = config.fetch('http', {})
144
147
  RestClient.log = Logger.new(STDOUT)
145
- RestClient.proxy = config["http_proxy"] if config["http_proxy"]
148
+ RestClient.proxy = http_config['proxy'] if http_config['proxy']
146
149
  url = ['https://', credentials[:domain], '/api/users/provision'].join
147
150
  private_resource = RestClient::Resource.new url, :user => credentials[:username], :password => credentials[:password], :timeout => 660
148
151
  File.open(output_file, 'r') do |file|
149
152
  request_params = {:file => file}
150
- request_params[:skip_emails] = "true" if config["skip_emails"]
151
- request_params[:test] = "true" if config["test"]
153
+ request_params[:skip_emails] = 'true' if (config['options']["skip_emails"] || options[:skip_emails])
154
+ request_params[:test] = 'true' if (config['options']["test"] || options[:test])
152
155
  private_resource.post request_params
153
156
  end
154
157
 
155
- File.delete(output_file) if options[:delete_users_file]
158
+ File.delete(output_file) if (config['options']['delete_users_file'] || options[:delete_users_file])
156
159
 
157
160
  say "Finished"
158
161
  end
@@ -1,3 +1,3 @@
1
1
  module Socialcast
2
- VERSION = "1.0.0.beta3"
2
+ VERSION = "1.0.0.beta4"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196357
4
+ hash: 62196363
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
10
  - beta
11
- - 3
12
- version: 1.0.0.beta3
11
+ - 4
12
+ version: 1.0.0.beta4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Ryan Sonnek
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-06-30 00:00:00 Z
21
+ date: 2011-07-07 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: shoulda