socialcast 1.3.14 → 1.3.15
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 773760fd92b5e744a225bcd6dfd00eeb1fa3dd0d
|
4
|
+
data.tar.gz: 80168ae8554b118c9452e388b0a1df35af2eaddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 533bc9e567674bc219a022c032cc15200bd1e843de464720d90292bd6a30e8128d5cca9e7f57ddbde6fd8aa8c4ebbd7b639111b5f793f27965098978498f1ad0
|
7
|
+
data.tar.gz: a1796b2299b36a11d591d607a096dde3756b29a7964f65deaec2bd43777eabc1cafc2fe4540a58c543b1c8e319e1ee51d7ce2c651b081cd2a417e4fa7c932517
|
@@ -6,7 +6,8 @@ module Socialcast
|
|
6
6
|
attr_accessor :sync_strategy
|
7
7
|
|
8
8
|
def sync(strategy_klass = ApiSyncStrategy)
|
9
|
-
|
9
|
+
assert_no_unsupported_configurations
|
10
|
+
|
10
11
|
sync_strategy = strategy_klass.new(self)
|
11
12
|
process_options = {
|
12
13
|
:http_config => http_config,
|
@@ -54,6 +55,16 @@ module Socialcast
|
|
54
55
|
@default_profile_photo_id ||= Socialcast::CommandLine::Authenticate.current_user['community']['default_profile_photo_id']
|
55
56
|
end
|
56
57
|
|
58
|
+
def configured?
|
59
|
+
unsupported_configurations.none?
|
60
|
+
end
|
61
|
+
|
62
|
+
def unsupported_configurations
|
63
|
+
@unsupported_configurations ||= @ldap_config['connections'].reject do |connection_name, _|
|
64
|
+
LDAPConnector.attribute_mappings_for(connection_name, @ldap_config).key? LDAPConnector::PROFILE_PHOTO_ATTRIBUTE
|
65
|
+
end.keys
|
66
|
+
end
|
67
|
+
|
57
68
|
protected
|
58
69
|
|
59
70
|
def each_photo_hash
|
@@ -64,13 +75,11 @@ module Socialcast
|
|
64
75
|
end
|
65
76
|
end
|
66
77
|
|
67
|
-
def
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
raise Socialcast::CommandLine::Provisioner::ProvisionError, message
|
73
|
-
end
|
78
|
+
def assert_no_unsupported_configurations
|
79
|
+
unless configured?
|
80
|
+
message = "Cannot sync photos: #{unsupported_configurations.join(', ')} do not have a mapping for the profile photo field."
|
81
|
+
log(message)
|
82
|
+
raise Socialcast::CommandLine::Provisioner::ProvisionError, message
|
74
83
|
end
|
75
84
|
end
|
76
85
|
|
@@ -98,7 +107,7 @@ module Socialcast
|
|
98
107
|
|
99
108
|
MAX_BATCH_SIZE = 50
|
100
109
|
|
101
|
-
def initialize(provisioner
|
110
|
+
def initialize(provisioner)
|
102
111
|
@provisioner = provisioner
|
103
112
|
end
|
104
113
|
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
# LDAP connections
|
3
|
+
connections:
|
4
|
+
example_connection_1:
|
5
|
+
username: "cn=Directory Manager"
|
6
|
+
password: "test"
|
7
|
+
host: localhost
|
8
|
+
port: 1389
|
9
|
+
basedn: "dc=example,dc=com"
|
10
|
+
filter: "(mail=*)"
|
11
|
+
mappings:
|
12
|
+
email: mailCon
|
13
|
+
profile_photo: photoCon
|
14
|
+
|
15
|
+
example_connection_2:
|
16
|
+
username: "cn=Directory Manager"
|
17
|
+
password: "test"
|
18
|
+
host: localhost
|
19
|
+
port: 1389
|
20
|
+
basedn: "dc=example,dc=com"
|
21
|
+
filter: "(mail=*)"
|
22
|
+
mappings:
|
23
|
+
email: mailCon2
|
24
|
+
first_name: firstName
|
25
|
+
|
26
|
+
# Map LDAP Group Memberships to Socialcast Permissions
|
27
|
+
permission_mappings:
|
28
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
29
|
+
attribute_name: isMemberOf
|
30
|
+
account_types:
|
31
|
+
external: "cn=External,dc=example,dc=com"
|
32
|
+
roles:
|
33
|
+
tenant_admin: "cn=Admins,dc=example,dc=com"
|
34
|
+
sbi_admin: "cn=SbiAdmins,dc=example,dc=com"
|
35
|
+
reach_admin: "cn=ReachAdmins,dc=example,dc=com"
|
36
|
+
town_hall_admin: "cn=TownHallAdmins,dc=example,dc=com"
|
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
|
48
|
+
|
49
|
+
|
50
|
+
# http options for connecting to Socialcast servers
|
51
|
+
http:
|
52
|
+
timeout: 660
|
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Socialcast::CommandLine::ProvisionPhoto do
|
4
4
|
let!(:ldap_with_profile_photo_config) { YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'ldap_with_profile_photo.yml')) }
|
5
5
|
let!(:ldap_multiple_connection_mapping_config) { YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'ldap_with_multiple_connection_mappings.yml')) }
|
6
|
+
let!(:ldap_multiple_incomplete_connection_mapping_config) { YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'ldap_with_multiple_incomplete_connection_mappings.yml')) }
|
6
7
|
let(:default_profile_photo_id) { 3 }
|
7
8
|
let(:another_profile_photo_id) { 4 }
|
8
9
|
|
@@ -20,7 +21,8 @@ describe Socialcast::CommandLine::ProvisionPhoto do
|
|
20
21
|
describe '#sync' do
|
21
22
|
context "with a single ldap connection" do
|
22
23
|
let(:options) { {} }
|
23
|
-
|
24
|
+
let(:provisioner) { Socialcast::CommandLine::ProvisionPhoto.new(ldap_with_profile_photo_config, options) }
|
25
|
+
subject(:sync_photos) { provisioner.sync }
|
24
26
|
let(:user_search_resource) { double(:user_search_resource) }
|
25
27
|
let(:user_submit_resource) { double(:user_submit_resource) }
|
26
28
|
let(:data_fingerprint) { '5d41402abc4b2a76b9719d911017c592' }
|
@@ -110,7 +112,7 @@ describe Socialcast::CommandLine::ProvisionPhoto do
|
|
110
112
|
end
|
111
113
|
end
|
112
114
|
|
113
|
-
context "with multiple ldap connections" do
|
115
|
+
context "with multiple fully configured ldap connections" do
|
114
116
|
let(:user_search_resource) { double(:user_search_resource) }
|
115
117
|
let(:search_api_response) do
|
116
118
|
{
|
@@ -136,8 +138,8 @@ describe Socialcast::CommandLine::ProvisionPhoto do
|
|
136
138
|
]
|
137
139
|
}
|
138
140
|
end
|
139
|
-
|
140
|
-
let(:sync_photos) {
|
141
|
+
let(:provisioner) { Socialcast::CommandLine::ProvisionPhoto.new(ldap_multiple_connection_mapping_config, {}) }
|
142
|
+
let(:sync_photos) { provisioner.sync }
|
141
143
|
let(:binary_photo_data) { "\x89PNGabc".force_encoding('binary') }
|
142
144
|
before do
|
143
145
|
Socialcast::CommandLine::ProvisionPhoto::ApiSyncStrategy.any_instance.stub(:batch_size).and_return(2)
|
@@ -175,6 +177,22 @@ describe Socialcast::CommandLine::ProvisionPhoto do
|
|
175
177
|
sync_photos
|
176
178
|
end
|
177
179
|
it 'uses attributes from each connection' do end
|
180
|
+
it 'is considered fully configured' do
|
181
|
+
expect(provisioner.configured?).to be_true
|
182
|
+
end
|
183
|
+
end
|
184
|
+
context "with multiple incompletely configured ldap connections" do
|
185
|
+
let(:provisioner) { Socialcast::CommandLine::ProvisionPhoto.new(ldap_multiple_incomplete_connection_mapping_config, {}) }
|
186
|
+
let(:sync_photos) { provisioner.sync }
|
187
|
+
before do
|
188
|
+
expect { sync_photos }.to raise_error Socialcast::CommandLine::Provisioner::ProvisionError
|
189
|
+
end
|
190
|
+
it 'is not considered fully configured' do
|
191
|
+
expect(provisioner.configured?).to be_false
|
192
|
+
end
|
193
|
+
it 'provides a list of incomplete configurations' do
|
194
|
+
expect(provisioner.unsupported_configurations).to eq(['example_connection_2'])
|
195
|
+
end
|
178
196
|
end
|
179
197
|
end
|
180
198
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialcast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Sonnek
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-07-
|
13
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
@@ -241,6 +241,7 @@ files:
|
|
241
241
|
- spec/fixtures/ldap_with_manager_attribute.yml
|
242
242
|
- spec/fixtures/ldap_with_multiple_connection_mappings.yml
|
243
243
|
- spec/fixtures/ldap_with_multiple_connection_permission_mappings.yml
|
244
|
+
- spec/fixtures/ldap_with_multiple_incomplete_connection_mappings.yml
|
244
245
|
- spec/fixtures/ldap_with_plugin_mapping.yml
|
245
246
|
- spec/fixtures/ldap_with_profile_photo.yml
|
246
247
|
- spec/fixtures/ldap_with_roles_without_account_type.yml
|
@@ -299,6 +300,7 @@ test_files:
|
|
299
300
|
- spec/fixtures/ldap_with_manager_attribute.yml
|
300
301
|
- spec/fixtures/ldap_with_multiple_connection_mappings.yml
|
301
302
|
- spec/fixtures/ldap_with_multiple_connection_permission_mappings.yml
|
303
|
+
- spec/fixtures/ldap_with_multiple_incomplete_connection_mappings.yml
|
302
304
|
- spec/fixtures/ldap_with_plugin_mapping.yml
|
303
305
|
- spec/fixtures/ldap_with_profile_photo.yml
|
304
306
|
- spec/fixtures/ldap_with_roles_without_account_type.yml
|