socialcast 1.3.16 → 1.3.17

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: aa30064bc024f7760f5eeb31cf6cd716e205ec19
4
- data.tar.gz: a3fac062e94471e4451e9cd2d031d888af401480
3
+ metadata.gz: 0dbbca03d19c73c3c76248ca1157e7f6d47d7354
4
+ data.tar.gz: 5fd8567b4330e9d8a9afe217f1465a20cd31a7c9
5
5
  SHA512:
6
- metadata.gz: 9584c35c3a66db2aaf5306dbea3644a934cf86dfa024c2cd581152c962f91377c782f7c513f972b55e721e585f66e36fd3dc975f6d59fb3a79f2e084b0552780
7
- data.tar.gz: ce57f494ad75c3ddbfd490c7200ba9537ad056153c5133631b9c4affb5e03429c5fcafa5bb6f16aab626df752ff346578d52e67f6bf54a1c881040a5fef96203
6
+ metadata.gz: 0020b41df43901a27516b982bc6ef70b11c5c8c085cc63b4e296b022aa5fa70bf4df3ca7e4d9c03917e53f241e2cc81cbbd3e4c36cae42e70834e2dfe2d5547d
7
+ data.tar.gz: c84885daf855d714b402be2c7100dd69c73169789fd8cb8f06ab0d135092c359f49640db07f8fcd77daa338828628c17640ede31a30cf4da79a365ebfba2878b
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.2.2
data/.travis.yml CHANGED
@@ -2,5 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.1
6
- - 2.1.2
5
+ - 2.1.6
6
+ - 2.2.2
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2011 Socialcast, Inc
3
+ Copyright (c) 2011 - 2015 VMware, Inc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -56,5 +56,5 @@ See [CONTRIBUTORS.txt](https://github.com/socialcast/socialcast-command-line/blo
56
56
 
57
57
  ## Copyright
58
58
 
59
- Copyright (c) 2011 - 2014 Socialcast Inc.
59
+ Copyright (c) 2011 - 2015 VMware Inc.
60
60
  See [LICENSE.txt](https://github.com/socialcast/socialcast-command-line/blob/master/LICENSE.txt) for details.
data/config/ldap.yml CHANGED
@@ -89,3 +89,6 @@ options:
89
89
  # http options for connecting to Socialcast servers
90
90
  http:
91
91
  timeout: 660
92
+ # Skip validation of the SSL certificate on the socialcast server. Default=false
93
+ # WARNING: enabling this could allow an unauthorized party to view your data
94
+ # skip_ssl_validation: false
@@ -2,6 +2,7 @@ require 'zlib'
2
2
  require 'builder'
3
3
  require 'set'
4
4
  require 'fileutils'
5
+ require 'active_support/core_ext/string/strip'
5
6
 
6
7
  module Socialcast
7
8
  module CommandLine
@@ -55,13 +56,32 @@ module Socialcast
55
56
  request_params[:add_only] = 'true' if (@ldap_config.fetch('options', {})['add_only'] || @options[:add_only])
56
57
  resource.post request_params, :accept => :json
57
58
  end
58
- rescue RestClient::Unauthorized => e
59
- raise ProvisionError.new "Authenticated user either does not have administration privileges or the community is not configured to allow provisioning. Please contact Socialcast support to if you need help." if e.http_code == 401
59
+ rescue RestClient::Unauthorized, RestClient::Forbidden => e
60
+ raise ProvisionError.new provision_error_message(e)
60
61
  end
61
62
  log "Finished"
62
63
  end
63
64
  File.delete(output_file) if (@ldap_config.fetch('options', {})['delete_users_file'] || @options[:delete_users_file])
64
65
  end
66
+
67
+ private
68
+
69
+ def provision_error_message(error)
70
+ case error
71
+ when RestClient::Unauthorized
72
+ <<-EOS.strip_heredoc
73
+ Received an "Unauthorized" error from the Socialcast server. Please check the following:
74
+ * Community has basic authentication enabled
75
+ * User has administration privileges
76
+ * User or External System is active
77
+ * Credentials and community domain are correct in #{Socialcast::CommandLine.credentials_file}
78
+ EOS
79
+ when RestClient::Forbidden
80
+ <<-EOS.strip_heredoc
81
+ Received a "Forbidden" error from the Socialcast server. Please check that your community has directory integration enabled.
82
+ EOS
83
+ end
84
+ end
65
85
  end
66
86
  end
67
87
  end
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module CommandLine
3
- VERSION = "1.3.16"
3
+ VERSION = "1.3.17"
4
4
  end
5
5
  end
data/lib/socialcast.rb CHANGED
@@ -40,8 +40,11 @@ module Socialcast
40
40
  def self.resource_for_path(path, options = {}, debug = true)
41
41
  RestClient.log = Logger.new(STDOUT) if debug
42
42
  RestClient.proxy = credentials[:proxy] if credentials[:proxy]
43
+
44
+ rest_client_options = options.merge(authentication(options))
45
+ rest_client_options[:verify_ssl] = OpenSSL::SSL::VERIFY_NONE if rest_client_options.delete('skip_ssl_validation')
43
46
  url = ['https://', credentials[:domain], path].join
44
- RestClient::Resource.new url, options.merge(authentication(options))
47
+ RestClient::Resource.new url, rest_client_options
45
48
  end
46
49
 
47
50
  def self.authentication(options)
data/socialcast.gemspec CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
22
22
  s.add_runtime_dependency 'socialcast-net-ldap', '~> 0.1', '>= 0.1.6'
23
23
  s.add_runtime_dependency 'activeresource', '~> 4.0'
24
24
  s.add_runtime_dependency 'activesupport', '~> 4.0'
25
- s.add_development_dependency "rspec", '~> 2.11'
26
- s.add_development_dependency "webmock", '~> 1.7', '>= 1.7.7'
25
+ s.add_development_dependency 'rspec', '~> 3.3'
26
+ s.add_development_dependency 'webmock', '~> 1.7', '>= 1.7.7'
27
27
  s.add_development_dependency 'rake', '0.9.2.2'
28
28
  s.add_development_dependency 'pry', '~> 0.9'
29
29
 
@@ -7,9 +7,9 @@ describe Socialcast::CommandLine::Authenticate do
7
7
 
8
8
  describe '#request' do
9
9
  before do
10
- RestClient::Resource.should_receive(:new).with(url, {}).and_call_original
11
- RestClient::Resource.any_instance.should_receive(:post).with(subject.params, :accept => :json)
12
- authenticate.should_receive(:set_default_credentials).and_return(true)
10
+ expect(RestClient::Resource).to receive(:new).with(url, {}).and_call_original
11
+ expect_any_instance_of(RestClient::Resource).to receive(:post).with(subject.params, :accept => :json)
12
+ expect(authenticate).to receive(:set_default_credentials).and_return(true)
13
13
  authenticate.request
14
14
  end
15
15
  context 'for a regular user' do
@@ -39,13 +39,13 @@ describe Socialcast::CommandLine::Authenticate do
39
39
  let(:stubbed_config_dir) { File.join(File.dirname(__FILE__), '..', '..', 'fixtures') }
40
40
  let(:current_user_stub) { { :user => { :id => 123 } } }
41
41
  let(:current_user_error) { { :error => "Failed to authenticate due to password" } }
42
- before { Socialcast::CommandLine.stub(:config_dir).and_return(stubbed_config_dir) }
42
+ before { allow(Socialcast::CommandLine).to receive(:config_dir).and_return(stubbed_config_dir) }
43
43
  context 'as a successfull authenticated user' do
44
44
  before do
45
45
  stub_request(:get, "https://ryan%40socialcast.com:foo@test.staging.socialcast.com/api/userinfo.json").
46
46
  to_return(:status => 200, :body => current_user_stub.to_json)
47
47
  end
48
- it { current_user['id'].should == 123 }
48
+ it { expect(current_user['id']).to eq(123) }
49
49
  end
50
50
  context 'when you not authenticated properly' do
51
51
  before do