plesk_kit 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- metadata +4 -265
- data/app/assets/javascripts/plesk_kit/application.js +0 -15
- data/app/assets/javascripts/plesk_kit/customer_accounts.js +0 -2
- data/app/assets/javascripts/plesk_kit/customers.js +0 -2
- data/app/assets/javascripts/plesk_kit/reseller_accounts.js +0 -2
- data/app/assets/javascripts/plesk_kit/servers.js +0 -2
- data/app/assets/javascripts/plesk_kit/subscriptions.js +0 -2
- data/app/assets/stylesheets/plesk_kit/application.css +0 -13
- data/app/assets/stylesheets/plesk_kit/customer_accounts.css +0 -4
- data/app/assets/stylesheets/plesk_kit/customers.css +0 -4
- data/app/assets/stylesheets/plesk_kit/reseller_accounts.css +0 -4
- data/app/assets/stylesheets/plesk_kit/servers.css +0 -4
- data/app/assets/stylesheets/plesk_kit/subscriptions.css +0 -4
- data/app/assets/stylesheets/scaffold.css +0 -56
- data/app/controllers/plesk_kit/application_controller.rb +0 -4
- data/app/controllers/plesk_kit/customer_accounts_controller.rb +0 -87
- data/app/controllers/plesk_kit/reseller_accounts_controller.rb +0 -87
- data/app/controllers/plesk_kit/servers_controller.rb +0 -87
- data/app/controllers/plesk_kit/subscriptions_controller.rb +0 -87
- data/app/helpers/plesk_kit/application_helper.rb +0 -4
- data/app/helpers/plesk_kit/customer_accounts_helper.rb +0 -4
- data/app/helpers/plesk_kit/reseller_accounts_helper.rb +0 -4
- data/app/helpers/plesk_kit/servers_helper.rb +0 -4
- data/app/helpers/plesk_kit/subscriptions_helper.rb +0 -4
- data/app/models/plesk_kit/client.rb +0 -25
- data/app/models/plesk_kit/communicator.rb +0 -60
- data/app/models/plesk_kit/customer_account.rb +0 -69
- data/app/models/plesk_kit/reseller_account.rb +0 -72
- data/app/models/plesk_kit/server.rb +0 -30
- data/app/models/plesk_kit/service_plan.rb +0 -359
- data/app/models/plesk_kit/subscription.rb +0 -95
- data/app/views/layouts/plesk_kit/application.html.erb +0 -14
- data/app/views/plesk_kit/customer_accounts/_form.html.erb +0 -33
- data/app/views/plesk_kit/customer_accounts/edit.html.erb +0 -6
- data/app/views/plesk_kit/customer_accounts/index.html.erb +0 -29
- data/app/views/plesk_kit/customer_accounts/new.html.erb +0 -5
- data/app/views/plesk_kit/customer_accounts/show.html.erb +0 -25
- data/app/views/plesk_kit/reseller_accounts/_form.html.erb +0 -33
- data/app/views/plesk_kit/reseller_accounts/edit.html.erb +0 -6
- data/app/views/plesk_kit/reseller_accounts/index.html.erb +0 -29
- data/app/views/plesk_kit/reseller_accounts/new.html.erb +0 -5
- data/app/views/plesk_kit/reseller_accounts/show.html.erb +0 -25
- data/app/views/plesk_kit/servers/_form.html.erb +0 -37
- data/app/views/plesk_kit/servers/edit.html.erb +0 -6
- data/app/views/plesk_kit/servers/index.html.erb +0 -31
- data/app/views/plesk_kit/servers/new.html.erb +0 -5
- data/app/views/plesk_kit/servers/show.html.erb +0 -30
- data/app/views/plesk_kit/subscriptions/_form.html.erb +0 -49
- data/app/views/plesk_kit/subscriptions/edit.html.erb +0 -6
- data/app/views/plesk_kit/subscriptions/index.html.erb +0 -33
- data/app/views/plesk_kit/subscriptions/new.html.erb +0 -5
- data/app/views/plesk_kit/subscriptions/show.html.erb +0 -35
- data/config/routes.rb +0 -8
- data/db/migrate/20130906033658_create_plesk_kit_customer_accounts.rb +0 -14
- data/db/migrate/20130906033745_create_plesk_kit_reseller_accounts.rb +0 -15
- data/db/migrate/20130906034225_create_plesk_kit_subscriptions.rb +0 -16
- data/db/migrate/20130906040817_create_plesk_kit_servers.rb +0 -13
- data/db/migrate/20130917012645_create_plesk_kit_service_plans.rb +0 -13
- data/lib/plesk_kit/engine.rb +0 -23
- data/lib/plesk_kit/version.rb +0 -3
- data/lib/plesk_kit.rb +0 -4
- data/lib/tasks/plesk_kit_tasks.rake +0 -4
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config/application.rb +0 -59
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/config.ru +0 -4
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130906035255_create_plesk_kit_customer_accounts.plesk_kit.rb +0 -13
- data/test/dummy/db/migrate/20130906035256_create_plesk_kit_reseller_accounts.plesk_kit.rb +0 -13
- data/test/dummy/db/migrate/20130906035257_create_plesk_kit_subscriptions.plesk_kit.rb +0 -17
- data/test/dummy/db/migrate/20130906040830_create_plesk_kit_servers.plesk_kit.rb +0 -14
- data/test/dummy/db/migrate/20130917020158_create_plesk_kit_service_plans.plesk_kit.rb +0 -14
- data/test/dummy/db/schema.rb +0 -82
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -9415
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/tmp/cache/assets/C5D/AF0/sprockets%2Faa100860897bd469c74972020e9d6966 +0 -0
- data/test/dummy/tmp/cache/assets/C83/800/sprockets%2F0892f1bdb69d260331b7b414298969c1 +0 -0
- data/test/dummy/tmp/cache/assets/C8A/850/sprockets%2F8729404d8f18dcc24e0523d37801589e +0 -0
- data/test/dummy/tmp/cache/assets/CC2/EF0/sprockets%2F756af5df20241589c464741d971fd7d8 +0 -0
- data/test/dummy/tmp/cache/assets/CC4/B50/sprockets%2F34e848818d05961fdc8c6c275e16629b +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CE0/340/sprockets%2F4b6f8f760b2a1789f60289271d20c0be +0 -0
- data/test/dummy/tmp/cache/assets/CED/DE0/sprockets%2F18595c4734c4d7582dee3ae35b079a49 +0 -0
- data/test/dummy/tmp/cache/assets/CEE/F00/sprockets%2F891ac2c44b3be23865e990924a995fe2 +0 -0
- data/test/dummy/tmp/cache/assets/D10/EC0/sprockets%2F73e40114523e8419fcd0efa71d597c5d +0 -0
- data/test/dummy/tmp/cache/assets/D11/AE0/sprockets%2Fa1a95d724723a8f11e9037e8d2b28a8f +0 -0
- data/test/dummy/tmp/cache/assets/D13/380/sprockets%2F354af7b9709615f6f10e77d7e1b2da15 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D33/4D0/sprockets%2F14f2359cdf393c5e0b6401e233bb2ef5 +0 -0
- data/test/dummy/tmp/cache/assets/D3B/BF0/sprockets%2F3b7fb545a51edee1b772b818b2424d56 +0 -0
- data/test/dummy/tmp/cache/assets/D3C/B20/sprockets%2F1927fcaeaf1d200dab53e55b86526939 +0 -0
- data/test/dummy/tmp/cache/assets/D3F/2C0/sprockets%2F1ada6cc19aa84bf00164875127ef689e +0 -0
- data/test/dummy/tmp/cache/assets/D44/140/sprockets%2F341e589bb22dea2848665b989b2ba3ea +0 -0
- data/test/dummy/tmp/cache/assets/D4A/700/sprockets%2Fd56d83b8bbc98f0ce23f6263ff796020 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D51/190/sprockets%2F2a28b96857a9e16a74ee9dde52903dc7 +0 -0
- data/test/dummy/tmp/cache/assets/D51/610/sprockets%2F34de6f511191ffa00431d50cb5b31eac +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D62/7B0/sprockets%2F39cdc1f2f8021136f2034ac5a9dab7f6 +0 -0
- data/test/dummy/tmp/cache/assets/D78/5D0/sprockets%2Feb7a1f999039a6136d9cfe25222fdcd5 +0 -0
- data/test/dummy/tmp/cache/assets/D7A/A30/sprockets%2F7e54a37cfb268f56b4c49b9f02029bff +0 -0
- data/test/dummy/tmp/cache/assets/D98/A30/sprockets%2Fd3cd57a8fade5aef376036123c5e11d6 +0 -0
- data/test/dummy/tmp/cache/assets/DA6/B80/sprockets%2F3fea63c0c7e19aae37d6037cd9d987e0 +0 -0
- data/test/dummy/tmp/cache/assets/DBA/730/sprockets%2F182cd97bf96da9ad7f037dcda77e8965 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DF9/B80/sprockets%2Fe87d27fca0c65097c5b652becc1eec0b +0 -0
- data/test/dummy/tmp/cache/assets/DFA/E90/sprockets%2F1fc47d21f6a426ae1e5d7b1dc9b39dbf +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E28/3B0/sprockets%2Fce7fac4e9b4c46afa942e091b54c6aab +0 -0
- data/test/dummy/tmp/cache/assets/E3D/360/sprockets%2F19c6fbcf6aaed23dce100b1c1b2b0b8c +0 -0
- data/test/dummy/tmp/cache/assets/E89/270/sprockets%2F1bf1ee2ecfe1c679faf4002f4ea8bece +0 -0
- data/test/fixtures/plesk_kit/customer_accounts.yml +0 -13
- data/test/fixtures/plesk_kit/customers.yml +0 -7
- data/test/fixtures/plesk_kit/reseller_accounts.yml +0 -13
- data/test/fixtures/plesk_kit/servers.yml +0 -15
- data/test/fixtures/plesk_kit/service_plans.yml +0 -13
- data/test/fixtures/plesk_kit/subscriptions.yml +0 -17
- data/test/fixtures/plesk_kit/webspaces.yml +0 -11
- data/test/functional/plesk_kit/customer_accounts_controller_test.rb +0 -51
- data/test/functional/plesk_kit/customers_controller_test.rb +0 -51
- data/test/functional/plesk_kit/reseller_accounts_controller_test.rb +0 -51
- data/test/functional/plesk_kit/servers_controller_test.rb +0 -51
- data/test/functional/plesk_kit/subscriptions_controller_test.rb +0 -51
- data/test/integration/navigation_test.rb +0 -10
- data/test/plesk_kit_test.rb +0 -7
- data/test/test_helper.rb +0 -15
- data/test/unit/helpers/plesk_kit/customer_accounts_helper_test.rb +0 -6
- data/test/unit/helpers/plesk_kit/customers_helper_test.rb +0 -6
- data/test/unit/helpers/plesk_kit/reseller_accounts_helper_test.rb +0 -6
- data/test/unit/helpers/plesk_kit/servers_helper_test.rb +0 -6
- data/test/unit/helpers/plesk_kit/subscriptions_helper_test.rb +0 -6
- data/test/unit/plesk_kit/customer_account_test.rb +0 -9
- data/test/unit/plesk_kit/customer_test.rb +0 -9
- data/test/unit/plesk_kit/reseller_account_test.rb +0 -9
- data/test/unit/plesk_kit/server_test.rb +0 -9
- data/test/unit/plesk_kit/service_plan_test.rb +0 -9
- data/test/unit/plesk_kit/subscription_test.rb +0 -9
- data/test/unit/plesk_kit/webspace_test.rb +0 -9
@@ -1,359 +0,0 @@
|
|
1
|
-
module PleskKit
|
2
|
-
class ServicePlan < ActiveRecord::Base
|
3
|
-
attr_accessible :mailboxes, :domains, :name, :traffic, :storage
|
4
|
-
validates_presence_of :mailboxes, :domains, :name, :traffic, :storage
|
5
|
-
has_many :subscriptions
|
6
|
-
|
7
|
-
def find_or_push server
|
8
|
-
PleskKit::Communicator.get_service_plan self, server
|
9
|
-
end
|
10
|
-
|
11
|
-
def analyse response_string, server
|
12
|
-
xml = REXML::Document.new(response_string)
|
13
|
-
status = xml.root.elements['//status'].text if xml.root.elements['//status'].present?
|
14
|
-
puts response_string
|
15
|
-
if xml.root.elements['//get'].present?
|
16
|
-
if status == 'error'
|
17
|
-
PleskKit::Communicator.push_service_plan self, server
|
18
|
-
elsif status == 'ok'
|
19
|
-
return true
|
20
|
-
end
|
21
|
-
|
22
|
-
elsif xml.root.elements['//add'].present?
|
23
|
-
if status == "error"
|
24
|
-
code = xml.root.elements['//errcode'].text
|
25
|
-
message = xml.root.elements['//errtext'].text
|
26
|
-
raise "#{code}: #{message}"
|
27
|
-
elsif status == 'ok'
|
28
|
-
return true
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def build_xml_for_get shell
|
34
|
-
xml = shell
|
35
|
-
xml.instruct!
|
36
|
-
xml.packet(:version => '1.6.3.0') {
|
37
|
-
xml.tag!("service-plan") {
|
38
|
-
xml.get{
|
39
|
-
xml.filter{
|
40
|
-
xml.name("#{self.name}")
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
puts xml.target!
|
46
|
-
return xml.target!
|
47
|
-
end
|
48
|
-
|
49
|
-
def build_xml_for_add shell
|
50
|
-
xml = shell
|
51
|
-
xml.instruct!
|
52
|
-
xml.packet(:version => '1.6.3.0') {
|
53
|
-
xml.send(:"service-plan") {
|
54
|
-
xml.add{
|
55
|
-
xml.name("#{self.name.to_s}")
|
56
|
-
xml.mail{
|
57
|
-
xml.webmail('horde')
|
58
|
-
}
|
59
|
-
xml.limits{
|
60
|
-
xml.overuse('block')
|
61
|
-
|
62
|
-
xml.limit{
|
63
|
-
xml.name('max_site')
|
64
|
-
xml.value("#{self.domains.to_s}")
|
65
|
-
}
|
66
|
-
xml.limit{
|
67
|
-
xml.name('max_subdom')
|
68
|
-
xml.value('-1')
|
69
|
-
}
|
70
|
-
xml.limit{
|
71
|
-
xml.name('max_dom_aliases')
|
72
|
-
xml.value('-1')
|
73
|
-
}
|
74
|
-
xml.limit{
|
75
|
-
xml.name('disk_space')
|
76
|
-
xml.value("#{self.storage}") #10gb
|
77
|
-
}
|
78
|
-
xml.limit{
|
79
|
-
xml.name('disk_space_soft')
|
80
|
-
xml.value('0')
|
81
|
-
}
|
82
|
-
xml.limit{
|
83
|
-
xml.name('max_traffic')
|
84
|
-
xml.value("#{self.traffic.to_s}") # unlimited
|
85
|
-
}
|
86
|
-
xml.limit{
|
87
|
-
xml.name('max_traffic_soft')
|
88
|
-
xml.value('0')
|
89
|
-
}
|
90
|
-
xml.limit{
|
91
|
-
xml.name('max_wu')
|
92
|
-
xml.value('-1')
|
93
|
-
}
|
94
|
-
xml.limit{
|
95
|
-
xml.name('max_subftp_users')
|
96
|
-
xml.value('-1')
|
97
|
-
}
|
98
|
-
xml.limit{
|
99
|
-
xml.name('max_db')
|
100
|
-
xml.value('10')
|
101
|
-
}
|
102
|
-
xml.limit{
|
103
|
-
xml.name('max_box')
|
104
|
-
xml.value("#{self.mailboxes.to_s}") # mailboxes
|
105
|
-
}
|
106
|
-
xml.limit{
|
107
|
-
xml.name('mbox_quota')
|
108
|
-
xml.value('1073741824')
|
109
|
-
}
|
110
|
-
xml.limit{
|
111
|
-
xml.name('max_maillists')
|
112
|
-
xml.value('100')
|
113
|
-
}
|
114
|
-
xml.limit{
|
115
|
-
xml.name('max_webapps')
|
116
|
-
xml.value('0')
|
117
|
-
}
|
118
|
-
xml.limit{
|
119
|
-
xml.name('max_site_builder')
|
120
|
-
xml.value('1')
|
121
|
-
}
|
122
|
-
xml.limit{
|
123
|
-
xml.name('max_unity_mobile_sites')
|
124
|
-
xml.value('0')
|
125
|
-
}
|
126
|
-
xml.limit{
|
127
|
-
xml.name('expiration')
|
128
|
-
xml.value('-1')
|
129
|
-
}
|
130
|
-
xml.limit{
|
131
|
-
xml.name('upsell_site_builder')
|
132
|
-
xml.value('0')
|
133
|
-
}
|
134
|
-
|
135
|
-
}
|
136
|
-
xml.send(:"log-rotation"){
|
137
|
-
xml.on{
|
138
|
-
xml.send(:"log-condition"){
|
139
|
-
xml.tag!("log-bysize", "10485760")
|
140
|
-
}
|
141
|
-
xml.tag!("log-max-num-files", "10")
|
142
|
-
xml.tag!("log-compress", "true")
|
143
|
-
}
|
144
|
-
}
|
145
|
-
xml.preferences{
|
146
|
-
xml.stat('3')
|
147
|
-
xml.maillists('false')
|
148
|
-
xml.dns_zone_type('master')
|
149
|
-
}
|
150
|
-
xml.hosting{
|
151
|
-
xml.property{
|
152
|
-
xml.name('ssl')
|
153
|
-
xml.value('false')
|
154
|
-
}
|
155
|
-
xml.property{
|
156
|
-
xml.name('fp')
|
157
|
-
xml.value('false')
|
158
|
-
}
|
159
|
-
xml.property{
|
160
|
-
xml.name('fp_ssl')
|
161
|
-
xml.value('false')
|
162
|
-
}
|
163
|
-
xml.property{
|
164
|
-
xml.name('fp_auth')
|
165
|
-
xml.value('false')
|
166
|
-
}
|
167
|
-
xml.property{
|
168
|
-
xml.name('webstat')
|
169
|
-
xml.value('awstats')
|
170
|
-
}
|
171
|
-
xml.property{
|
172
|
-
xml.name('webstat_protected')
|
173
|
-
xml.value('true')
|
174
|
-
}
|
175
|
-
xml.property{
|
176
|
-
xml.name('wu_script')
|
177
|
-
xml.value('true')
|
178
|
-
}
|
179
|
-
xml.property{
|
180
|
-
xml.name('shell')
|
181
|
-
xml.value('/bin/false')
|
182
|
-
}
|
183
|
-
xml.property{
|
184
|
-
xml.name('ftp_quota')
|
185
|
-
xml.value('-1')
|
186
|
-
}
|
187
|
-
xml.property{
|
188
|
-
xml.name('php_handler_type')
|
189
|
-
xml.value('fastcgi')
|
190
|
-
}
|
191
|
-
xml.property{
|
192
|
-
xml.name('asp')
|
193
|
-
xml.value('false')
|
194
|
-
}
|
195
|
-
xml.property{
|
196
|
-
xml.name('ssi')
|
197
|
-
xml.value('false')
|
198
|
-
}
|
199
|
-
xml.property{
|
200
|
-
xml.name('php')
|
201
|
-
xml.value('true')
|
202
|
-
}
|
203
|
-
xml.property{
|
204
|
-
xml.name('cgi')
|
205
|
-
xml.value('true')
|
206
|
-
}
|
207
|
-
xml.property{
|
208
|
-
xml.name('perl')
|
209
|
-
xml.value('true')
|
210
|
-
}
|
211
|
-
xml.property{
|
212
|
-
xml.name('python')
|
213
|
-
xml.value('true')
|
214
|
-
}
|
215
|
-
xml.property{
|
216
|
-
xml.name('fastcgi')
|
217
|
-
xml.value('true')
|
218
|
-
}
|
219
|
-
xml.property{
|
220
|
-
xml.name('miva')
|
221
|
-
xml.value('false')
|
222
|
-
}
|
223
|
-
xml.property{
|
224
|
-
xml.name('coldfusion')
|
225
|
-
xml.value('false')
|
226
|
-
}
|
227
|
-
}
|
228
|
-
xml.performance{
|
229
|
-
xml.bandwidth('-1')
|
230
|
-
xml.max_connections('-1')
|
231
|
-
}
|
232
|
-
xml.permissions{
|
233
|
-
xml.permission{
|
234
|
-
xml.name('create_domains')
|
235
|
-
xml.value('true')
|
236
|
-
}
|
237
|
-
xml.permission{
|
238
|
-
xml.name('manage_phosting')
|
239
|
-
xml.value('false')
|
240
|
-
}
|
241
|
-
xml.permission{
|
242
|
-
xml.name('manage_php_settings')
|
243
|
-
xml.value('false')
|
244
|
-
}
|
245
|
-
xml.permission{
|
246
|
-
xml.name('manage_sh_access')
|
247
|
-
xml.value('false')
|
248
|
-
}
|
249
|
-
xml.permission{
|
250
|
-
xml.name('manage_not_chroot_shell')
|
251
|
-
xml.value('false')
|
252
|
-
}
|
253
|
-
xml.permission{
|
254
|
-
xml.name('manage_quota')
|
255
|
-
xml.value('false')
|
256
|
-
}
|
257
|
-
xml.permission{
|
258
|
-
xml.name('manage_subdomains')
|
259
|
-
xml.value('true')
|
260
|
-
}
|
261
|
-
xml.permission{
|
262
|
-
xml.name('manage_domain_aliases')
|
263
|
-
xml.value('false')
|
264
|
-
}
|
265
|
-
xml.permission{
|
266
|
-
xml.name('manage_log')
|
267
|
-
xml.value('true')
|
268
|
-
}
|
269
|
-
xml.permission{
|
270
|
-
xml.name('manage_anonftp')
|
271
|
-
xml.value('false')
|
272
|
-
}
|
273
|
-
xml.permission{
|
274
|
-
xml.name('manage_subftp')
|
275
|
-
xml.value('true')
|
276
|
-
}
|
277
|
-
xml.permission{
|
278
|
-
xml.name('manage_crontab')
|
279
|
-
xml.value('false')
|
280
|
-
}
|
281
|
-
xml.permission{
|
282
|
-
xml.name('manage_dns')
|
283
|
-
xml.value('true')
|
284
|
-
}
|
285
|
-
xml.permission{
|
286
|
-
xml.name('manage_webapps')
|
287
|
-
xml.value('false')
|
288
|
-
}
|
289
|
-
xml.permission{
|
290
|
-
xml.name('manage_webstat')
|
291
|
-
xml.value('true')
|
292
|
-
}
|
293
|
-
xml.permission{
|
294
|
-
xml.name('manage_mail_settings')
|
295
|
-
xml.value('true')
|
296
|
-
}
|
297
|
-
xml.permission{
|
298
|
-
xml.name('manage_maillists')
|
299
|
-
xml.value('true')
|
300
|
-
}
|
301
|
-
xml.permission{
|
302
|
-
xml.name('manage_spamfilter')
|
303
|
-
xml.value('true')
|
304
|
-
}
|
305
|
-
xml.permission{
|
306
|
-
xml.name('manage_virusfilter')
|
307
|
-
xml.value('true')
|
308
|
-
}
|
309
|
-
xml.permission{
|
310
|
-
xml.name('allow_local_backups')
|
311
|
-
xml.value('true')
|
312
|
-
}
|
313
|
-
xml.permission{
|
314
|
-
xml.name('allow_ftp_backups')
|
315
|
-
xml.value('true')
|
316
|
-
}
|
317
|
-
xml.permission{
|
318
|
-
xml.name('manage_performance')
|
319
|
-
xml.value('false')
|
320
|
-
}
|
321
|
-
xml.permission{
|
322
|
-
xml.name('select_db_server')
|
323
|
-
xml.value('false')
|
324
|
-
}
|
325
|
-
xml.permission{
|
326
|
-
xml.name('access_appcatalog')
|
327
|
-
xml.value('true')
|
328
|
-
}
|
329
|
-
xml.permission{
|
330
|
-
xml.name('allow_insecure_sites')
|
331
|
-
xml.value('true')
|
332
|
-
}
|
333
|
-
xml.permission{
|
334
|
-
xml.name('manage_website_maintenance')
|
335
|
-
xml.value('true')
|
336
|
-
}
|
337
|
-
xml.permission{
|
338
|
-
xml.name('manage_protected_dirs')
|
339
|
-
xml.value('true')
|
340
|
-
}
|
341
|
-
xml.permission{
|
342
|
-
xml.name('access_service_users')
|
343
|
-
xml.value('true')
|
344
|
-
}
|
345
|
-
xml.permission{
|
346
|
-
xml.name('allow_license_stubs')
|
347
|
-
xml.value('false')
|
348
|
-
}
|
349
|
-
}
|
350
|
-
}
|
351
|
-
}
|
352
|
-
}
|
353
|
-
puts xml.target!
|
354
|
-
return xml.target!
|
355
|
-
end
|
356
|
-
|
357
|
-
|
358
|
-
end
|
359
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
module PleskKit
|
2
|
-
class Subscription < ActiveRecord::Base
|
3
|
-
attr_accessible :ip_address, :name, :owner_id, :owner_login, :plan_name, :service_plan_id, :customer_account_id, :reseller_account_id
|
4
|
-
|
5
|
-
belongs_to :customer_account
|
6
|
-
belongs_to :reseller_account
|
7
|
-
belongs_to :service_plan
|
8
|
-
before_create :provision_in_plesk
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def provision_in_plesk
|
13
|
-
|
14
|
-
account = (customer_account_id.present? ? customer_account : (reseller_account_id.present? ? reseller_account : raise(msg="no accounts?")))
|
15
|
-
plan = PleskKit::ServicePlan.find_by_name self.plan_name
|
16
|
-
self.service_plan_id = plan.id
|
17
|
-
if plan.find_or_push(account.server) == true
|
18
|
-
self.plan_name = self.plan_name
|
19
|
-
self.ip_address = '117.55.235.27'
|
20
|
-
self.owner_login = account.login
|
21
|
-
self.name = self.name
|
22
|
-
if account.class.to_s == 'PleskKit::ResellerAccount'
|
23
|
-
self.reseller_account_id = account.id
|
24
|
-
elsif account.class.to_s == 'PleskKit::CustomerAccount'
|
25
|
-
self.customer_account_id = account.id
|
26
|
-
end
|
27
|
-
guid = PleskKit::Communicator.pack_and_play_with self, account
|
28
|
-
PleskKit::Communicator.sync_subscription self, guid
|
29
|
-
self.id
|
30
|
-
else
|
31
|
-
return false
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def pack_this shell, customer
|
36
|
-
xml = shell
|
37
|
-
xml.instruct!
|
38
|
-
xml.packet(:version => '1.6.3.5') {
|
39
|
-
xml.webspace {
|
40
|
-
xml.add{
|
41
|
-
xml.gen_setup{
|
42
|
-
xml.name(self.name)
|
43
|
-
xml.tag! 'owner-login', self.owner_login
|
44
|
-
xml.ip_address(self.ip_address)
|
45
|
-
}
|
46
|
-
xml.hosting{
|
47
|
-
xml.vrt_hst{
|
48
|
-
xml.property{
|
49
|
-
xml.name('ftp_login')
|
50
|
-
xml.value("#{customer.login}#{rand(99).to_s}") #rand(36**8).to_s(36)
|
51
|
-
}
|
52
|
-
xml.property{
|
53
|
-
xml.name('ftp_password')
|
54
|
-
xml.value(customer.passwd)
|
55
|
-
}
|
56
|
-
xml.ip_address(self.ip_address)
|
57
|
-
}
|
58
|
-
}
|
59
|
-
xml.tag! 'plan-name', self.plan_name
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
puts xml.target!
|
64
|
-
return xml.target!
|
65
|
-
end
|
66
|
-
|
67
|
-
def sync_pack shell, sub_guid
|
68
|
-
xml = shell
|
69
|
-
xml.instruct!
|
70
|
-
xml.packet(:version => '1.6.3.5') {
|
71
|
-
xml.webspace{
|
72
|
-
xml.send(:"sync-subscription") {
|
73
|
-
xml.filter{
|
74
|
-
xml.guid(sub_guid)
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
end
|
80
|
-
|
81
|
-
def analyse response_string, customer = nil
|
82
|
-
xml = REXML::Document.new(response_string)
|
83
|
-
status = xml.root.elements['//status'].text if xml.root.elements['//status'].present?
|
84
|
-
if status == "error"
|
85
|
-
code = xml.root.elements['//errcode'].text
|
86
|
-
message = xml.root.elements['//errtext'].text
|
87
|
-
raise "#{code}: #{message}"
|
88
|
-
else
|
89
|
-
sub_guid = xml.root.elements['//guid'].text if xml.root.elements['//guid'].present?
|
90
|
-
end
|
91
|
-
return sub_guid || true # TODO save plesk_id? Probably not necessary as we have the customer login
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>PleskKit</title>
|
5
|
-
<%= stylesheet_link_tag "plesk_kit/application", :media => "all" %>
|
6
|
-
<%= javascript_include_tag "plesk_kit/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<%= form_for(@customer_account) do |f| %>
|
2
|
-
<% if @customer_account.errors.any? %>
|
3
|
-
<div id="error_explanation">
|
4
|
-
<h2><%= pluralize(@customer_account.errors.count, "error") %> prohibited this customer_account from being saved:</h2>
|
5
|
-
|
6
|
-
<ul>
|
7
|
-
<% @customer_account.errors.full_messages.each do |msg| %>
|
8
|
-
<li><%= msg %></li>
|
9
|
-
<% end %>
|
10
|
-
</ul>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
<div class="field">
|
15
|
-
<%= f.label :cname %><br />
|
16
|
-
<%= f.text_field :cname %>
|
17
|
-
</div>
|
18
|
-
<div class="field">
|
19
|
-
<%= f.label :pname %><br />
|
20
|
-
<%= f.text_field :pname %>
|
21
|
-
</div>
|
22
|
-
<div class="field">
|
23
|
-
<%= f.label :login %><br />
|
24
|
-
<%= f.text_field :login %>
|
25
|
-
</div>
|
26
|
-
<div class="field">
|
27
|
-
<%= f.label :passwd %><br />
|
28
|
-
<%= f.text_field :passwd %>
|
29
|
-
</div>
|
30
|
-
<div class="actions">
|
31
|
-
<%= f.submit %>
|
32
|
-
</div>
|
33
|
-
<% end %>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
<h1>Listing customer_accounts</h1>
|
2
|
-
|
3
|
-
<table>
|
4
|
-
<tr>
|
5
|
-
<th>Cname</th>
|
6
|
-
<th>Pname</th>
|
7
|
-
<th>Login</th>
|
8
|
-
<th>Passwd</th>
|
9
|
-
<th></th>
|
10
|
-
<th></th>
|
11
|
-
<th></th>
|
12
|
-
</tr>
|
13
|
-
|
14
|
-
<% @customer_accounts.each do |customer_account| %>
|
15
|
-
<tr>
|
16
|
-
<td><%= customer_account.cname %></td>
|
17
|
-
<td><%= customer_account.pname %></td>
|
18
|
-
<td><%= customer_account.login %></td>
|
19
|
-
<td><%= customer_account.passwd %></td>
|
20
|
-
<td><%= link_to 'Show', customer_account %></td>
|
21
|
-
<td><%= link_to 'Edit', edit_customer_account_path(customer_account) %></td>
|
22
|
-
<td><%= link_to 'Destroy', customer_account, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
23
|
-
</tr>
|
24
|
-
<% end %>
|
25
|
-
</table>
|
26
|
-
|
27
|
-
<br />
|
28
|
-
|
29
|
-
<%= link_to 'New Customer account', new_customer_account_path %>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<p id="notice"><%= notice %></p>
|
2
|
-
|
3
|
-
<p>
|
4
|
-
<b>Cname:</b>
|
5
|
-
<%= @customer_account.cname %>
|
6
|
-
</p>
|
7
|
-
|
8
|
-
<p>
|
9
|
-
<b>Pname:</b>
|
10
|
-
<%= @customer_account.pname %>
|
11
|
-
</p>
|
12
|
-
|
13
|
-
<p>
|
14
|
-
<b>Login:</b>
|
15
|
-
<%= @customer_account.login %>
|
16
|
-
</p>
|
17
|
-
|
18
|
-
<p>
|
19
|
-
<b>Passwd:</b>
|
20
|
-
<%= @customer_account.passwd %>
|
21
|
-
</p>
|
22
|
-
|
23
|
-
|
24
|
-
<%= link_to 'Edit', edit_customer_account_path(@customer_account) %> |
|
25
|
-
<%= link_to 'Back', customer_accounts_path %>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<%= form_for(@reseller_account) do |f| %>
|
2
|
-
<% if @reseller_account.errors.any? %>
|
3
|
-
<div id="error_explanation">
|
4
|
-
<h2><%= pluralize(@reseller_account.errors.count, "error") %> prohibited this reseller_account from being saved:</h2>
|
5
|
-
|
6
|
-
<ul>
|
7
|
-
<% @reseller_account.errors.full_messages.each do |msg| %>
|
8
|
-
<li><%= msg %></li>
|
9
|
-
<% end %>
|
10
|
-
</ul>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
<div class="field">
|
15
|
-
<%= f.label :cname %><br />
|
16
|
-
<%= f.text_field :cname %>
|
17
|
-
</div>
|
18
|
-
<div class="field">
|
19
|
-
<%= f.label :pname %><br />
|
20
|
-
<%= f.text_field :pname %>
|
21
|
-
</div>
|
22
|
-
<div class="field">
|
23
|
-
<%= f.label :login %><br />
|
24
|
-
<%= f.text_field :login %>
|
25
|
-
</div>
|
26
|
-
<div class="field">
|
27
|
-
<%= f.label :passwd %><br />
|
28
|
-
<%= f.text_field :passwd %>
|
29
|
-
</div>
|
30
|
-
<div class="actions">
|
31
|
-
<%= f.submit %>
|
32
|
-
</div>
|
33
|
-
<% end %>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
<h1>Listing reseller_accounts</h1>
|
2
|
-
|
3
|
-
<table>
|
4
|
-
<tr>
|
5
|
-
<th>Cname</th>
|
6
|
-
<th>Pname</th>
|
7
|
-
<th>Login</th>
|
8
|
-
<th>Passwd</th>
|
9
|
-
<th></th>
|
10
|
-
<th></th>
|
11
|
-
<th></th>
|
12
|
-
</tr>
|
13
|
-
|
14
|
-
<% @reseller_accounts.each do |reseller_account| %>
|
15
|
-
<tr>
|
16
|
-
<td><%= reseller_account.cname %></td>
|
17
|
-
<td><%= reseller_account.pname %></td>
|
18
|
-
<td><%= reseller_account.login %></td>
|
19
|
-
<td><%= reseller_account.passwd %></td>
|
20
|
-
<td><%= link_to 'Show', reseller_account %></td>
|
21
|
-
<td><%= link_to 'Edit', edit_reseller_account_path(reseller_account) %></td>
|
22
|
-
<td><%= link_to 'Destroy', reseller_account, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
23
|
-
</tr>
|
24
|
-
<% end %>
|
25
|
-
</table>
|
26
|
-
|
27
|
-
<br />
|
28
|
-
|
29
|
-
<%= link_to 'New Reseller account', new_reseller_account_path %>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<p id="notice"><%= notice %></p>
|
2
|
-
|
3
|
-
<p>
|
4
|
-
<b>Cname:</b>
|
5
|
-
<%= @reseller_account.cname %>
|
6
|
-
</p>
|
7
|
-
|
8
|
-
<p>
|
9
|
-
<b>Pname:</b>
|
10
|
-
<%= @reseller_account.pname %>
|
11
|
-
</p>
|
12
|
-
|
13
|
-
<p>
|
14
|
-
<b>Login:</b>
|
15
|
-
<%= @reseller_account.login %>
|
16
|
-
</p>
|
17
|
-
|
18
|
-
<p>
|
19
|
-
<b>Passwd:</b>
|
20
|
-
<%= @reseller_account.passwd %>
|
21
|
-
</p>
|
22
|
-
|
23
|
-
|
24
|
-
<%= link_to 'Edit', edit_reseller_account_path(@reseller_account) %> |
|
25
|
-
<%= link_to 'Back', reseller_accounts_path %>
|