usvn-crowd-sync 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +28 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/bin/usvn-crowd-sync +88 -0
- data/lib/crowd.rb +18 -0
- data/lib/crowd/crowd.rb +305 -0
- data/lib/crowd/crowd.yml +22 -0
- data/lib/crowd/crowd_authentication.rb +76 -0
- data/lib/crowd/default.rb +1298 -0
- data/lib/crowd/defaultDriver.rb +375 -0
- data/lib/crowd/defaultMappingRegistry.rb +1364 -0
- data/lib/crowd/version.rb +25 -0
- data/lib/usvn-crowd-sync.rb +4 -0
- data/lib/usvn/usvn_0_x.rb +78 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/usvn-crowd-sync_spec.rb +7 -0
- data/tools/regenerate_authz_file.php +24 -0
- data/usvn-crowd-sync.gemspec +87 -0
- data/usvn-crowd-sync.yml +15 -0
- metadata +195 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
# ===========================================================================
|
2
|
+
# Copyright (C) 2009, Progress Software Corporation and/or its
|
3
|
+
# subsidiaries or affiliates. All rights reserved.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
# ===========================================================================
|
17
|
+
module Crowd #:nodoc:
|
18
|
+
module VERSION #:nodoc:
|
19
|
+
MAJOR = 0
|
20
|
+
MINOR = 0
|
21
|
+
TINY = 11
|
22
|
+
|
23
|
+
STRING = [MAJOR, MINOR, TINY].join('.')
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
|
2
|
+
# usvn_users;
|
3
|
+
# +-----------------+--------------+------+-----+---------+----------------+
|
4
|
+
# | Field | Type | Null | Key | Default | Extra |
|
5
|
+
# +-----------------+--------------+------+-----+---------+----------------+
|
6
|
+
# | users_id | int(11) | NO | PRI | NULL | auto_increment |
|
7
|
+
# | users_login | varchar(255) | NO | UNI | NULL | |
|
8
|
+
# | users_password | varchar(64) | NO | | NULL | |
|
9
|
+
# | users_lastname | varchar(100) | YES | | NULL | |
|
10
|
+
# | users_firstname | varchar(100) | YES | | NULL | |
|
11
|
+
# | users_email | varchar(150) | YES | | NULL | |
|
12
|
+
# | users_is_admin | tinyint(1) | NO | | NULL | |
|
13
|
+
# | users_secret_id | varchar(32) | NO | | NULL | |
|
14
|
+
# +-----------------+--------------+------+-----+---------+----------------+
|
15
|
+
class User
|
16
|
+
include DataMapper::Resource
|
17
|
+
storage_names[:default] = 'usvn_users'
|
18
|
+
|
19
|
+
property :id, Serial, :field => 'users_id'
|
20
|
+
property :login, String, :field => 'users_login'
|
21
|
+
property :password, String, :field => 'users_password'
|
22
|
+
property :lastname, String, :field => 'users_lastname'
|
23
|
+
property :firstname, String, :field => 'users_firstname'
|
24
|
+
property :email, String, :field => 'users_email'
|
25
|
+
property :secret_id, String, :field => 'users_secret_id'
|
26
|
+
property :is_admin, Integer, :field => 'users_is_admin'
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
# usvn_groups
|
31
|
+
# +--------------------+---------------+------+-----+---------+----------------+
|
32
|
+
# | Field | Type | Null | Key | Default | Extra |
|
33
|
+
# +--------------------+---------------+------+-----+---------+----------------+
|
34
|
+
# | groups_id | int(11) | NO | PRI | NULL | auto_increment |
|
35
|
+
# | groups_name | varchar(150) | NO | UNI | NULL | |
|
36
|
+
# | groups_description | varchar(1000) | YES | | NULL | |
|
37
|
+
# +--------------------+---------------+------+-----+---------+----------------+
|
38
|
+
|
39
|
+
class Group
|
40
|
+
include DataMapper::Resource
|
41
|
+
storage_names[:default] = 'usvn_groups'
|
42
|
+
|
43
|
+
property :id, Serial, :field => 'groups_id'
|
44
|
+
property :name, String, :field => 'groups_name'
|
45
|
+
property :description, String, :field => 'groups_description'
|
46
|
+
|
47
|
+
def self.create_or_update(names)
|
48
|
+
groups = []
|
49
|
+
names.each do |name|
|
50
|
+
if name =~ /^[a-zA-Z0-9\-\_]+$/
|
51
|
+
g = Group.first(:name => name)
|
52
|
+
if g.nil?
|
53
|
+
g = Group.create(:name => name)
|
54
|
+
end
|
55
|
+
groups << g
|
56
|
+
end
|
57
|
+
end
|
58
|
+
groups
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
# usvn_users_to_groups
|
64
|
+
# +-----------+------------+------+-----+---------+-------+
|
65
|
+
# | Field | Type | Null | Key | Default | Extra |
|
66
|
+
# +-----------+------------+------+-----+---------+-------+
|
67
|
+
# | users_id | int(11) | NO | PRI | NULL | |
|
68
|
+
# | groups_id | int(11) | NO | PRI | NULL | |
|
69
|
+
# | is_leader | tinyint(1) | NO | | NULL | |
|
70
|
+
# +-----------+------------+------+-----+---------+-------+
|
71
|
+
class GroupUser
|
72
|
+
include DataMapper::Resource
|
73
|
+
storage_names[:default] = 'usvn_users_to_groups'
|
74
|
+
|
75
|
+
property :users_id, Integer, :key => true
|
76
|
+
property :groups_id, Integer, :key => true
|
77
|
+
property :is_leader, Integer
|
78
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'usvn-crowd-sync'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env php
|
2
|
+
<?php
|
3
|
+
require_once 'USVN/autoload.php';
|
4
|
+
|
5
|
+
$configfile = $argv[1];
|
6
|
+
|
7
|
+
try {
|
8
|
+
USVN_Translation::initTranslation('en_US', 'locale');
|
9
|
+
$config = new USVN_Config_Ini($configfile, 'general');
|
10
|
+
Zend_Db_Table::setDefaultAdapter(Zend_Db::factory($config->database->adapterName, $config->database->options->toArray()));
|
11
|
+
Zend_Db_Table::getDefaultAdapter()->getProfiler()->setEnabled(true);
|
12
|
+
USVN_Db_Table::$prefix = $config->database->prefix;
|
13
|
+
Zend_Registry::set('config', $config);
|
14
|
+
USVN_Authz::generate();
|
15
|
+
}
|
16
|
+
catch (Exception $e) {
|
17
|
+
echo $e->getMessage() . "\n";
|
18
|
+
exit(1);
|
19
|
+
}
|
20
|
+
|
21
|
+
echo "OK";
|
22
|
+
|
23
|
+
exit(0);
|
24
|
+
?>
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{usvn-crowd-sync}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["crazycode"]
|
12
|
+
s.date = %q{2011-06-02}
|
13
|
+
s.default_executable = %q{usvn-crowd-sync}
|
14
|
+
s.description = %q{Sync Atlassian crowd's user & groups to USVN.}
|
15
|
+
s.email = %q{crazycode@gmail.com}
|
16
|
+
s.executables = ["usvn-crowd-sync"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".rspec",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE.txt",
|
27
|
+
"README.rdoc",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION",
|
30
|
+
"bin/usvn-crowd-sync",
|
31
|
+
"lib/crowd.rb",
|
32
|
+
"lib/crowd/crowd.rb",
|
33
|
+
"lib/crowd/crowd.yml",
|
34
|
+
"lib/crowd/crowd_authentication.rb",
|
35
|
+
"lib/crowd/default.rb",
|
36
|
+
"lib/crowd/defaultDriver.rb",
|
37
|
+
"lib/crowd/defaultMappingRegistry.rb",
|
38
|
+
"lib/crowd/version.rb",
|
39
|
+
"lib/usvn-crowd-sync.rb",
|
40
|
+
"lib/usvn/usvn_0_x.rb",
|
41
|
+
"spec/spec_helper.rb",
|
42
|
+
"spec/usvn-crowd-sync_spec.rb",
|
43
|
+
"tools/regenerate_authz_file.php",
|
44
|
+
"usvn-crowd-sync.gemspec",
|
45
|
+
"usvn-crowd-sync.yml"
|
46
|
+
]
|
47
|
+
s.homepage = %q{http://github.com/crazycode/usvn-crowd-sync}
|
48
|
+
s.licenses = ["MIT"]
|
49
|
+
s.require_paths = ["lib"]
|
50
|
+
s.rubygems_version = %q{1.6.2}
|
51
|
+
s.summary = %q{Sync Atlassian crowd's user & groups to USVN.}
|
52
|
+
s.test_files = [
|
53
|
+
"spec/spec_helper.rb",
|
54
|
+
"spec/usvn-crowd-sync_spec.rb"
|
55
|
+
]
|
56
|
+
|
57
|
+
if s.respond_to? :specification_version then
|
58
|
+
s.specification_version = 3
|
59
|
+
|
60
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
61
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
62
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
63
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
64
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
65
|
+
s.add_runtime_dependency(%q<data_mapper>, [">= 0"])
|
66
|
+
s.add_runtime_dependency(%q<dm-mysql-adapter>, [">= 0"])
|
67
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
70
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
71
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
72
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
73
|
+
s.add_dependency(%q<data_mapper>, [">= 0"])
|
74
|
+
s.add_dependency(%q<dm-mysql-adapter>, [">= 0"])
|
75
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
76
|
+
end
|
77
|
+
else
|
78
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
79
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
80
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
81
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
82
|
+
s.add_dependency(%q<data_mapper>, [">= 0"])
|
83
|
+
s.add_dependency(%q<dm-mysql-adapter>, [">= 0"])
|
84
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
data/usvn-crowd-sync.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
usvn_db:
|
2
|
+
adapter: mysql
|
3
|
+
user: root
|
4
|
+
password: asdfasdf
|
5
|
+
host: localhost
|
6
|
+
encoding: utf-8
|
7
|
+
database: usvn
|
8
|
+
|
9
|
+
usvn_home: /var/www/usvn
|
10
|
+
|
11
|
+
application_login_url: http://10.241.12.43:7300/login
|
12
|
+
application_name: mvnconfig
|
13
|
+
application_password: 1qaz2wsx
|
14
|
+
crowd_server_url: http://10.241.14.35:8780/services/SecurityServer
|
15
|
+
|
metadata
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: usvn-crowd-sync
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- crazycode
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-02 00:00:00 +08:00
|
19
|
+
default_executable: usvn-crowd-sync
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :development
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 2
|
31
|
+
- 3
|
32
|
+
- 0
|
33
|
+
version: 2.3.0
|
34
|
+
name: rspec
|
35
|
+
version_requirements: *id001
|
36
|
+
prerelease: false
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
type: :development
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 23
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 0
|
48
|
+
- 0
|
49
|
+
version: 1.0.0
|
50
|
+
name: bundler
|
51
|
+
version_requirements: *id002
|
52
|
+
prerelease: false
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
type: :development
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 7
|
61
|
+
segments:
|
62
|
+
- 1
|
63
|
+
- 5
|
64
|
+
- 2
|
65
|
+
version: 1.5.2
|
66
|
+
name: jeweler
|
67
|
+
version_requirements: *id003
|
68
|
+
prerelease: false
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
type: :development
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
name: rcov
|
81
|
+
version_requirements: *id004
|
82
|
+
prerelease: false
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
type: :runtime
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
name: data_mapper
|
95
|
+
version_requirements: *id005
|
96
|
+
prerelease: false
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
type: :runtime
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
108
|
+
name: dm-mysql-adapter
|
109
|
+
version_requirements: *id006
|
110
|
+
prerelease: false
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
type: :development
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
version: "0"
|
122
|
+
name: rspec
|
123
|
+
version_requirements: *id007
|
124
|
+
prerelease: false
|
125
|
+
description: Sync Atlassian crowd's user & groups to USVN.
|
126
|
+
email: crazycode@gmail.com
|
127
|
+
executables:
|
128
|
+
- usvn-crowd-sync
|
129
|
+
extensions: []
|
130
|
+
|
131
|
+
extra_rdoc_files:
|
132
|
+
- LICENSE.txt
|
133
|
+
- README.rdoc
|
134
|
+
files:
|
135
|
+
- .document
|
136
|
+
- .rspec
|
137
|
+
- Gemfile
|
138
|
+
- Gemfile.lock
|
139
|
+
- LICENSE.txt
|
140
|
+
- README.rdoc
|
141
|
+
- Rakefile
|
142
|
+
- VERSION
|
143
|
+
- bin/usvn-crowd-sync
|
144
|
+
- lib/crowd.rb
|
145
|
+
- lib/crowd/crowd.rb
|
146
|
+
- lib/crowd/crowd.yml
|
147
|
+
- lib/crowd/crowd_authentication.rb
|
148
|
+
- lib/crowd/default.rb
|
149
|
+
- lib/crowd/defaultDriver.rb
|
150
|
+
- lib/crowd/defaultMappingRegistry.rb
|
151
|
+
- lib/crowd/version.rb
|
152
|
+
- lib/usvn-crowd-sync.rb
|
153
|
+
- lib/usvn/usvn_0_x.rb
|
154
|
+
- spec/spec_helper.rb
|
155
|
+
- spec/usvn-crowd-sync_spec.rb
|
156
|
+
- tools/regenerate_authz_file.php
|
157
|
+
- usvn-crowd-sync.gemspec
|
158
|
+
- usvn-crowd-sync.yml
|
159
|
+
has_rdoc: true
|
160
|
+
homepage: http://github.com/crazycode/usvn-crowd-sync
|
161
|
+
licenses:
|
162
|
+
- MIT
|
163
|
+
post_install_message:
|
164
|
+
rdoc_options: []
|
165
|
+
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
hash: 3
|
174
|
+
segments:
|
175
|
+
- 0
|
176
|
+
version: "0"
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
hash: 3
|
183
|
+
segments:
|
184
|
+
- 0
|
185
|
+
version: "0"
|
186
|
+
requirements: []
|
187
|
+
|
188
|
+
rubyforge_project:
|
189
|
+
rubygems_version: 1.6.2
|
190
|
+
signing_key:
|
191
|
+
specification_version: 3
|
192
|
+
summary: Sync Atlassian crowd's user & groups to USVN.
|
193
|
+
test_files:
|
194
|
+
- spec/spec_helper.rb
|
195
|
+
- spec/usvn-crowd-sync_spec.rb
|