socialcast 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +1 -2
- data/bin/socialcast +2 -2
- data/lib/socialcast.rb +7 -15
- data/lib/socialcast/command_line/cli.rb +161 -0
- data/lib/socialcast/command_line/message.rb +18 -0
- data/lib/socialcast/command_line/provision.rb +330 -0
- data/lib/socialcast/command_line/version.rb +5 -0
- data/socialcast.gemspec +13 -10
- data/spec/fixtures/fake_attribute_map.rb +8 -6
- data/spec/fixtures/ldap_with_account_type_without_roles.yml +44 -0
- data/spec/fixtures/ldap_with_class_ldap_attribute.yml +47 -0
- data/spec/fixtures/ldap_with_connection_mapping.yml +52 -0
- data/spec/fixtures/ldap_with_connection_permission_mapping.yml +59 -0
- data/spec/fixtures/ldap_with_custom_attributes.yml +50 -0
- data/spec/fixtures/ldap_with_manager_attribute.yml +6 -3
- data/spec/fixtures/ldap_with_multiple_connection_mappings.yml +51 -0
- data/spec/fixtures/ldap_with_multiple_connection_permission_mappings.yml +75 -0
- data/spec/fixtures/ldap_with_plugin_mapping.yml +1 -1
- data/spec/fixtures/ldap_with_roles_without_account_type.yml +48 -0
- data/spec/fixtures/ldap_with_unique_identifier.yml +50 -0
- data/spec/fixtures/ldap_without_account_type_or_roles.yml +42 -0
- data/spec/{cli_spec.rb → socialcast/command_line/cli_spec.rb} +94 -82
- data/spec/socialcast/command_line/provision_spec.rb +497 -0
- data/spec/spec_helper.rb +2 -1
- metadata +103 -26
- data/lib/ext/array_ext.rb +0 -11
- data/lib/ext/string_ext.rb +0 -13
- data/lib/socialcast/cli.rb +0 -339
- data/lib/socialcast/message.rb +0 -17
- data/lib/socialcast/net_ldap_ext.rb +0 -87
- data/lib/socialcast/version.rb +0 -3
- data/spec/net_ldap_ext_spec.rb +0 -107
data/socialcast.gemspec
CHANGED
@@ -1,28 +1,31 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "socialcast/version"
|
3
|
+
require "socialcast/command_line/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "socialcast"
|
7
|
-
s.version = Socialcast::VERSION
|
7
|
+
s.version = Socialcast::CommandLine::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Ryan Sonnek","Sean Cashin","Lars Klevan"]
|
10
10
|
s.email = ["sean@socialcast.com"]
|
11
11
|
s.homepage = "http://github.com/socialcast/socialcast-command-line"
|
12
12
|
s.summary = %q{command line interface to socialcast api}
|
13
13
|
s.description = %q{publish messages to your stream from a command line interface}
|
14
|
+
s.license = 'MIT'
|
14
15
|
|
15
16
|
s.rubyforge_project = "socialcast"
|
16
17
|
|
17
|
-
s.add_runtime_dependency 'rest-client', '
|
18
|
-
s.add_runtime_dependency 'json', '>= 1.4.6'
|
19
|
-
s.add_runtime_dependency 'thor', '>= 0.14.6'
|
20
|
-
s.add_runtime_dependency 'highline', '>= 1.6.2'
|
21
|
-
s.add_runtime_dependency 'socialcast-net-ldap', '>= 0.1.6'
|
22
|
-
s.add_runtime_dependency 'activeresource', '
|
23
|
-
s.
|
24
|
-
s.add_development_dependency "
|
18
|
+
s.add_runtime_dependency 'rest-client', '~> 1.4'
|
19
|
+
s.add_runtime_dependency 'json', '~> 1.4', '>= 1.4.6'
|
20
|
+
s.add_runtime_dependency 'thor', '~> 0.14', '>= 0.14.6'
|
21
|
+
s.add_runtime_dependency 'highline', '~> 1.6', '>= 1.6.2'
|
22
|
+
s.add_runtime_dependency 'socialcast-net-ldap', '~> 0.1', '>= 0.1.6'
|
23
|
+
s.add_runtime_dependency 'activeresource', '~> 4.0'
|
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
27
|
s.add_development_dependency 'rake', '0.9.2.2'
|
28
|
+
s.add_development_dependency 'pry', '~> 0.9'
|
26
29
|
|
27
30
|
s.files = `git ls-files`.split("\n")
|
28
31
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module Socialcast
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
module CommandLine
|
3
|
+
class FakeAttributeMap
|
4
|
+
def self.attributes
|
5
|
+
%w{plugin_attr}
|
6
|
+
end
|
7
|
+
def self.run(entry)
|
8
|
+
return "#{entry[:plugin_attr].first.gsub(/a/,'b')}"
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
10
12
|
end
|
@@ -0,0 +1,44 @@
|
|
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
|
+
|
12
|
+
|
13
|
+
# LDAP attribute mappings
|
14
|
+
mappings:
|
15
|
+
first_name: givenName
|
16
|
+
last_name: sn
|
17
|
+
email: mail
|
18
|
+
# only use employee_number if the email is unknown
|
19
|
+
# employee_number: emp_id
|
20
|
+
# only use unique_identifier if you do not wish to use email as the main user identification method
|
21
|
+
# unique_identifier: samaccountname
|
22
|
+
|
23
|
+
|
24
|
+
# Map LDAP Group Memberships to Socialcast Permissions
|
25
|
+
permission_mappings:
|
26
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
27
|
+
attribute_name: isMemberOf
|
28
|
+
account_types:
|
29
|
+
external: "cn=External,dc=example,dc=com"
|
30
|
+
|
31
|
+
# general script options
|
32
|
+
options:
|
33
|
+
# cleanup the extracted ldap data file after run is complete
|
34
|
+
delete_users_file: false
|
35
|
+
# skip sending emails to newly activated users
|
36
|
+
skip_emails: true
|
37
|
+
# do not actually provision accounts
|
38
|
+
# useful during testing
|
39
|
+
test: true
|
40
|
+
|
41
|
+
|
42
|
+
# http options for connecting to Socialcast servers
|
43
|
+
http:
|
44
|
+
timeout: 660
|
@@ -0,0 +1,47 @@
|
|
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
|
+
|
12
|
+
|
13
|
+
# LDAP attribute mappings
|
14
|
+
mappings:
|
15
|
+
email: test_ldap_attribute_mapping
|
16
|
+
# only use employee_number if the email is unknown
|
17
|
+
# employee_number: emp_id
|
18
|
+
# only use unique_identifier if you do not wish to use email as the main user identification method
|
19
|
+
# unique_identifier: samaccountname
|
20
|
+
|
21
|
+
# Map LDAP Group Memberships to Socialcast Permissions
|
22
|
+
permission_mappings:
|
23
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
24
|
+
attribute_name: isMemberOf
|
25
|
+
account_types:
|
26
|
+
external: "cn=External,dc=example,dc=com"
|
27
|
+
roles:
|
28
|
+
tenant_admin: "cn=Admins,dc=example,dc=com"
|
29
|
+
sbi_admin: "cn=SbiAdmins,dc=example,dc=com"
|
30
|
+
reach_admin: "cn=ReachAdmins,dc=example,dc=com"
|
31
|
+
town_hall_admin: "cn=TownHallAdmins,dc=example,dc=com"
|
32
|
+
|
33
|
+
|
34
|
+
# general script options
|
35
|
+
options:
|
36
|
+
# cleanup the extracted ldap data file after run is complete
|
37
|
+
delete_users_file: false
|
38
|
+
# skip sending emails to newly activated users
|
39
|
+
skip_emails: true
|
40
|
+
# do not actually provision accounts
|
41
|
+
# useful during testing
|
42
|
+
test: true
|
43
|
+
|
44
|
+
|
45
|
+
# http options for connecting to Socialcast servers
|
46
|
+
http:
|
47
|
+
timeout: 660
|
@@ -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
|
+
|
14
|
+
|
15
|
+
# LDAP attribute mappings
|
16
|
+
mappings:
|
17
|
+
first_name: givenName
|
18
|
+
last_name: sn
|
19
|
+
email: mail
|
20
|
+
# only use employee_number if the email is unknown
|
21
|
+
# employee_number: emp_id
|
22
|
+
# only use unique_identifier if you do not wish to use email as the main user identification method
|
23
|
+
# unique_identifier: samaccountname
|
24
|
+
|
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
|
@@ -0,0 +1,59 @@
|
|
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
|
+
permission_mappings:
|
12
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
13
|
+
attribute_name: memberOf
|
14
|
+
account_types:
|
15
|
+
external: "cn=Contractors,dc=example,dc=com"
|
16
|
+
roles:
|
17
|
+
tenant_admin: "cn=Admins,dc=example,dc=com"
|
18
|
+
sbi_admin: "cn=ReachAdmins,dc=example,dc=com"
|
19
|
+
reach_admin: "cn=SbiAdmins,dc=example,dc=com"
|
20
|
+
|
21
|
+
|
22
|
+
# LDAP attribute mappings
|
23
|
+
mappings:
|
24
|
+
first_name: givenName
|
25
|
+
last_name: sn
|
26
|
+
email: mail
|
27
|
+
# only use employee_number if the email is unknown
|
28
|
+
# employee_number: emp_id
|
29
|
+
# only use unique_identifier if you do not wish to use email as the main user identification method
|
30
|
+
# unique_identifier: samaccountname
|
31
|
+
|
32
|
+
|
33
|
+
# Map LDAP Group Memberships to Socialcast Permissions
|
34
|
+
permission_mappings:
|
35
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
36
|
+
attribute_name: isMemberOf
|
37
|
+
account_types:
|
38
|
+
external: "cn=External,dc=example,dc=com"
|
39
|
+
roles:
|
40
|
+
tenant_admin: "cn=Admins,dc=example,dc=com"
|
41
|
+
sbi_admin: "cn=SbiAdmins,dc=example,dc=com"
|
42
|
+
reach_admin: "cn=ReachAdmins,dc=example,dc=com"
|
43
|
+
town_hall_admin: "cn=TownHallAdmins,dc=example,dc=com"
|
44
|
+
|
45
|
+
|
46
|
+
# general script options
|
47
|
+
options:
|
48
|
+
# cleanup the extracted ldap data file after run is complete
|
49
|
+
delete_users_file: false
|
50
|
+
# skip sending emails to newly activated users
|
51
|
+
skip_emails: true
|
52
|
+
# do not actually provision accounts
|
53
|
+
# useful during testing
|
54
|
+
test: true
|
55
|
+
|
56
|
+
|
57
|
+
# http options for connecting to Socialcast servers
|
58
|
+
http:
|
59
|
+
timeout: 660
|
@@ -0,0 +1,50 @@
|
|
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
|
+
|
12
|
+
|
13
|
+
# LDAP attribute mappings
|
14
|
+
mappings:
|
15
|
+
custom_attr1: custom_ldap1
|
16
|
+
custom_attr2: custom_ldap2
|
17
|
+
email: mail
|
18
|
+
# only use employee_number if the email is unknown
|
19
|
+
# employee_number: emp_id
|
20
|
+
# only use unique_identifier if you do not wish to use email as the main user identification method
|
21
|
+
# unique_identifier: samaccountname
|
22
|
+
|
23
|
+
|
24
|
+
# Map LDAP Group Memberships to Socialcast Permissions
|
25
|
+
permission_mappings:
|
26
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
27
|
+
attribute_name: isMemberOf
|
28
|
+
account_types:
|
29
|
+
external: "cn=External,dc=example,dc=com"
|
30
|
+
roles:
|
31
|
+
tenant_admin: "cn=Admins,dc=example,dc=com"
|
32
|
+
sbi_admin: "cn=SbiAdmins,dc=example,dc=com"
|
33
|
+
reach_admin: "cn=ReachAdmins,dc=example,dc=com"
|
34
|
+
town_hall_admin: "cn=TownHallAdmins,dc=example,dc=com"
|
35
|
+
|
36
|
+
|
37
|
+
# general script options
|
38
|
+
options:
|
39
|
+
# cleanup the extracted ldap data file after run is complete
|
40
|
+
delete_users_file: false
|
41
|
+
# skip sending emails to newly activated users
|
42
|
+
skip_emails: true
|
43
|
+
# do not actually provision accounts
|
44
|
+
# useful during testing
|
45
|
+
test: true
|
46
|
+
|
47
|
+
|
48
|
+
# http options for connecting to Socialcast servers
|
49
|
+
http:
|
50
|
+
timeout: 660
|
@@ -12,10 +12,13 @@ connections:
|
|
12
12
|
|
13
13
|
# LDAP attribute mappings
|
14
14
|
mappings:
|
15
|
-
first_name: givenName
|
16
|
-
last_name: sn
|
17
15
|
email: mail
|
18
|
-
manager:
|
16
|
+
manager: ldap_manager
|
17
|
+
|
18
|
+
permission_mappings:
|
19
|
+
attribute_name: isMemberOf
|
20
|
+
roles:
|
21
|
+
tenant_admin: "cn=Admins,dc=example,dc=com"
|
19
22
|
|
20
23
|
# general script options
|
21
24
|
options:
|
@@ -0,0 +1,51 @@
|
|
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
|
+
|
14
|
+
example_connection_2:
|
15
|
+
username: "cn=Directory Manager"
|
16
|
+
password: "test"
|
17
|
+
host: localhost
|
18
|
+
port: 1389
|
19
|
+
basedn: "dc=example,dc=com"
|
20
|
+
filter: "(mail=*)"
|
21
|
+
mappings:
|
22
|
+
email: mailCon2
|
23
|
+
first_name: firstName
|
24
|
+
|
25
|
+
# Map LDAP Group Memberships to Socialcast Permissions
|
26
|
+
permission_mappings:
|
27
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
28
|
+
attribute_name: isMemberOf
|
29
|
+
account_types:
|
30
|
+
external: "cn=External,dc=example,dc=com"
|
31
|
+
roles:
|
32
|
+
tenant_admin: "cn=Admins,dc=example,dc=com"
|
33
|
+
sbi_admin: "cn=SbiAdmins,dc=example,dc=com"
|
34
|
+
reach_admin: "cn=ReachAdmins,dc=example,dc=com"
|
35
|
+
town_hall_admin: "cn=TownHallAdmins,dc=example,dc=com"
|
36
|
+
|
37
|
+
|
38
|
+
# general script options
|
39
|
+
options:
|
40
|
+
# cleanup the extracted ldap data file after run is complete
|
41
|
+
delete_users_file: false
|
42
|
+
# skip sending emails to newly activated users
|
43
|
+
skip_emails: true
|
44
|
+
# do not actually provision accounts
|
45
|
+
# useful during testing
|
46
|
+
test: true
|
47
|
+
|
48
|
+
|
49
|
+
# http options for connecting to Socialcast servers
|
50
|
+
http:
|
51
|
+
timeout: 660
|
@@ -0,0 +1,75 @@
|
|
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
|
+
permission_mappings:
|
12
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
13
|
+
attribute_name: memberOf
|
14
|
+
account_types:
|
15
|
+
external: "cn=Contractors,dc=example,dc=com"
|
16
|
+
roles:
|
17
|
+
tenant_admin: "cn=Admins,dc=example,dc=com"
|
18
|
+
sbi_admin: "cn=ReachAdmins,dc=example,dc=com"
|
19
|
+
reach_admin: "cn=SbiAdmins,dc=example,dc=com"
|
20
|
+
example_connection_2:
|
21
|
+
username: "cn=Directory Manager"
|
22
|
+
password: "test"
|
23
|
+
host: localhost
|
24
|
+
port: 1389
|
25
|
+
basedn: "dc=example,dc=com"
|
26
|
+
filter: "(mail=*)"
|
27
|
+
permission_mappings:
|
28
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
29
|
+
attribute_name: member
|
30
|
+
account_types:
|
31
|
+
external: "cn=Ext,dc=example,dc=com"
|
32
|
+
roles:
|
33
|
+
tenant_admin: "cn=ReachAdmins,dc=example,dc=com"
|
34
|
+
sbi_admin: "cn=TownHallAdmins,dc=example,dc=com"
|
35
|
+
reach_admin: "cn=FooAdmins,dc=example,dc=com"
|
36
|
+
|
37
|
+
|
38
|
+
# LDAP attribute mappings
|
39
|
+
mappings:
|
40
|
+
first_name: givenName
|
41
|
+
last_name: sn
|
42
|
+
email: mail
|
43
|
+
# only use employee_number if the email is unknown
|
44
|
+
# employee_number: emp_id
|
45
|
+
# only use unique_identifier if you do not wish to use email as the main user identification method
|
46
|
+
# unique_identifier: samaccountname
|
47
|
+
|
48
|
+
|
49
|
+
# Map LDAP Group Memberships to Socialcast Permissions
|
50
|
+
permission_mappings:
|
51
|
+
# configure LDAP field for group memberships (ex: memberof, isMemberOf, etc)
|
52
|
+
attribute_name: isMemberOf
|
53
|
+
account_types:
|
54
|
+
external: "cn=External,dc=example,dc=com"
|
55
|
+
roles:
|
56
|
+
tenant_admin: "cn=Admins,dc=example,dc=com"
|
57
|
+
sbi_admin: "cn=SbiAdmins,dc=example,dc=com"
|
58
|
+
reach_admin: "cn=ReachAdmins,dc=example,dc=com"
|
59
|
+
town_hall_admin: "cn=TownHallAdmins,dc=example,dc=com"
|
60
|
+
|
61
|
+
|
62
|
+
# general script options
|
63
|
+
options:
|
64
|
+
# cleanup the extracted ldap data file after run is complete
|
65
|
+
delete_users_file: false
|
66
|
+
# skip sending emails to newly activated users
|
67
|
+
skip_emails: true
|
68
|
+
# do not actually provision accounts
|
69
|
+
# useful during testing
|
70
|
+
test: true
|
71
|
+
|
72
|
+
|
73
|
+
# http options for connecting to Socialcast servers
|
74
|
+
http:
|
75
|
+
timeout: 660
|