plesk_lib 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +89 -0
  7. data/Rakefile +1 -0
  8. data/lib/plesk_lib.rb +29 -0
  9. data/lib/plesk_lib/account.rb +14 -0
  10. data/lib/plesk_lib/actions/base.rb +61 -0
  11. data/lib/plesk_lib/actions/change_customer_password.rb +27 -0
  12. data/lib/plesk_lib/actions/create_account.rb +23 -0
  13. data/lib/plesk_lib/actions/create_customer.rb +21 -0
  14. data/lib/plesk_lib/actions/create_reseller.rb +22 -0
  15. data/lib/plesk_lib/actions/create_service_plan.rb +327 -0
  16. data/lib/plesk_lib/actions/create_subscription.rb +55 -0
  17. data/lib/plesk_lib/actions/get_statistics.rb +61 -0
  18. data/lib/plesk_lib/actions/list_customers.rb +51 -0
  19. data/lib/plesk_lib/actions/list_service_plans.rb +60 -0
  20. data/lib/plesk_lib/actions/list_subscriptions.rb +42 -0
  21. data/lib/plesk_lib/customer.rb +4 -0
  22. data/lib/plesk_lib/reseller.rb +5 -0
  23. data/lib/plesk_lib/server.rb +23 -0
  24. data/lib/plesk_lib/service_plan.rb +17 -0
  25. data/lib/plesk_lib/subscription.rb +14 -0
  26. data/lib/plesk_lib/version.rb +3 -0
  27. data/plesk_lib.gemspec +30 -0
  28. data/spec/actions/change_customer_password_spec.rb +29 -0
  29. data/spec/actions/create_customer_spec.rb +50 -0
  30. data/spec/actions/create_reseller_spec.rb +35 -0
  31. data/spec/actions/create_service_plan_spec.rb +33 -0
  32. data/spec/actions/create_subscription_spec.rb +21 -0
  33. data/spec/actions/get_statistics_spec.rb +15 -0
  34. data/spec/actions/list_customers_spec.rb +31 -0
  35. data/spec/actions/list_service_plans_spec.rb +31 -0
  36. data/spec/actions/list_subscriptions.rb +31 -0
  37. data/spec/customer_spec.rb +21 -0
  38. data/spec/reseller_spec.rb +22 -0
  39. data/spec/server_spec.rb +48 -0
  40. data/spec/spec_helper.rb +28 -0
  41. data/spec/vcr/customer/change_password_existing_user.yml +57 -0
  42. data/spec/vcr/customer/change_password_missing_user.yml +57 -0
  43. data/spec/vcr/customer/list_customers.yml +57 -0
  44. data/spec/vcr/customer/list_customers_filtered.yml +57 -0
  45. data/spec/vcr/customer/minimal.yml +112 -0
  46. data/spec/vcr/customer/minimal_exists.yml +112 -0
  47. data/spec/vcr/customer/minimal_with_owner.yml +58 -0
  48. data/spec/vcr/reseller/minimal.yml +58 -0
  49. data/spec/vcr/reseller/minimal_exists.yml +58 -0
  50. data/spec/vcr/server/get_statistics.yml +57 -0
  51. data/spec/vcr/service_plan/create_minimal.yml +58 -0
  52. data/spec/vcr/service_plan/create_minimal_with_owner.yml +58 -0
  53. data/spec/vcr/service_plan/list_admin.yml +57 -0
  54. data/spec/vcr/service_plan/list_all.yml +57 -0
  55. data/spec/vcr/subscription/create.yml +57 -0
  56. data/spec/vcr/subscription/list_subscriptions.yml +57 -0
  57. data/spec/vcr/subscription/list_subscriptions_filtered.yml +57 -0
  58. metadata +257 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9a0e0b6ced984f3e95d746d026204ecf9872a4c7
4
+ data.tar.gz: 474bde6cfbd52d9a6dffabec99fa99e4df4f5dca
5
+ SHA512:
6
+ metadata.gz: 395d8768bc0427db578f00e57a41f5310e454e338addbf33ecd8154b67d1c3b89f748d68d86cb4b502c0a3eda9f3f9dd714b05d33124950579065ae77e9be1e5
7
+ data.tar.gz: f78dd5be4f9dbeab6943d38b2fa7d9125965ab3ce64b24b1ee62d2e99de607ed1c632d855da3edcefd49b281c22efd18e6e660039c60194656dff3ce38f85083
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in plesk_lib.gemspec
4
+ gemspec
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,89 @@
1
+ # PleskLib [![Gem Version](https://badge.fury.io/rb/plesk_lib.png)](http://badge.fury.io/rb/plesk_lib)
2
+
3
+ Under heavy development, but usable. Tested against Plesk for Linux 11.5
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'plesk_lib'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+
16
+ ## Usage
17
+
18
+ Everything can be done through the server object:
19
+
20
+ ```
21
+ server = PleskLib::Server.new('192.168.0.1', 'admin', 'yourPleskPassword')
22
+ response = server.get_statistics
23
+ response.statistics
24
+ ```
25
+
26
+ ### Customers:
27
+
28
+ ```
29
+
30
+ # Create customer accounts (add it to a reseller by adding owner_id: [x] to the options hash):
31
+ customer = PleskLib::Customer.new('user92', {password: 'foobar', person_name: 'foo'})
32
+ response = server.create_customer(customer)
33
+ puts 'Plesk id: ' + response.plesk_id
34
+ puts 'Plesk GUID: ' + response.guid
35
+
36
+ # List all customer accounts:
37
+ response = server.list_customers
38
+ response.customers.each { |customer| puts customer.company_name, customer.login }
39
+
40
+ # or just the customers of an owner by id:
41
+ response = server.list_customers(3)
42
+ ```
43
+
44
+ ### Resellers:
45
+
46
+ ```
47
+ reseller_account = PleskLib::Reseller.new('reseller01', {password: 'foobar', person_name: 'foo'})
48
+ server.create_reseller(reseller)
49
+ ```
50
+
51
+ ### Service Plans:
52
+
53
+ ```
54
+ # Create a service plan:
55
+
56
+ service_plan = PleskLib::ServicePlan.new("My Plan", {mailboxes: 10, storage: 2.gigabytes, domains: 1, traffic: 30.gigabytes})
57
+ server.create_service_plan(service_plan)
58
+ ```
59
+
60
+ ### Subscriptions:
61
+
62
+ To create a new subscription for a customer in Plesk:
63
+
64
+ ```
65
+ subscription_settings = { name: 'foo-domain.de', ip_address: '10.0.0.158',
66
+ owner_id: 3, service_plan_id: 10, ftp_login: 'ftp01',
67
+ ftp_password: 'ftpPass01' }
68
+ subscription = PleskLib::Subscription.new(subscription_settings)
69
+ server.create_subscription(subscription)
70
+ ```
71
+
72
+ ## How it works:
73
+
74
+ Every operation on the server is implemented in an action class inside `lib/plesk_lib/actions`. Please refer to the action class for usage and/or inner workings and add or modify actions as you like.
75
+
76
+ ## Contributing
77
+
78
+ 1. Fork it
79
+ 2. Please test what you do:
80
+ - Create your feature branch (`git checkout -b my-new-feature`)
81
+ - **Test your changes and record a test with VCR**
82
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
83
+ 4. Push to the branch (`git push origin my-new-feature`)
84
+ 5. Create new Pull Request
85
+
86
+
87
+ ## Thanks
88
+
89
+ Special thanks to the `plesk_kit` gem by tresacton.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,29 @@
1
+ require 'active_support/core_ext/object/blank'
2
+ require 'active_support/core_ext/string/inflections'
3
+ require 'active_support/core_ext/numeric/bytes'
4
+ require 'builder'
5
+ require 'bigdecimal'
6
+ require 'ox'
7
+ require 'plesk_lib/version'
8
+ require 'plesk_lib/account'
9
+ require 'plesk_lib/customer'
10
+ require 'plesk_lib/reseller'
11
+ require 'plesk_lib/server'
12
+ require 'plesk_lib/service_plan'
13
+ require 'plesk_lib/subscription'
14
+ require 'plesk_lib/actions/base'
15
+ require 'plesk_lib/actions/create_account'
16
+ require 'plesk_lib/actions/create_customer'
17
+ require 'plesk_lib/actions/create_reseller'
18
+ require 'plesk_lib/actions/create_service_plan'
19
+ require 'plesk_lib/actions/create_subscription'
20
+ require 'plesk_lib/actions/change_customer_password'
21
+ require 'plesk_lib/actions/list_customers'
22
+ require 'plesk_lib/actions/list_service_plans'
23
+ require 'plesk_lib/actions/list_subscriptions'
24
+ require 'plesk_lib/actions/get_statistics'
25
+
26
+ module PleskLib
27
+ class LoginAlreadyTaken < RuntimeError ; end
28
+ class AccountNotFound < RuntimeError ; end
29
+ end
@@ -0,0 +1,14 @@
1
+ module PleskLib
2
+ class Account
3
+ attr_accessor :company_name, :login, :password, :person_name, :status,
4
+ :phone, :fax, :address, :city, :state, :email, :country,
5
+ :postal_code, :external_id, :owner_id
6
+
7
+ def initialize(login, other_attributes = {})
8
+ @login = login
9
+ other_attributes.each_pair do |key, value|
10
+ send("#{key}=", value)
11
+ end if other_attributes.present?
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,61 @@
1
+ require 'net/http'
2
+ require 'openssl'
3
+
4
+ module PleskLib::Actions
5
+ class Base
6
+ # executes the current method on a server
7
+ def execute_on(server)
8
+ request_xml = build_xml
9
+ response_xml = send_xml_to_server(server, request_xml)
10
+ response_document = Ox.parse(response_xml)
11
+ parse_errors(response_document)
12
+ analyse(response_document)
13
+ return true
14
+ end
15
+
16
+ protected
17
+
18
+ def parse_errors(xml_document)
19
+ status = xml_document.root.locate('*/status').first.text
20
+ return unless status == "error"
21
+ code = xml_document.root.locate('*/errcode').first.text.to_i
22
+ message = xml_document.root.locate('*/errtext').first.text
23
+
24
+ # this catches the duplicate account error for resellers
25
+ if code == 1019 and message.include?('already exists')
26
+ raise PleskLib::LoginAlreadyTaken, message
27
+ end
28
+
29
+ case code
30
+ when 1007 then
31
+ raise PleskLib::LoginAlreadyTaken, message
32
+ when 1013 then
33
+ raise PleskLib::AccountNotFound, message
34
+ else
35
+ raise "#{code}: #{message}"
36
+ end
37
+ end
38
+
39
+ def analyse(xml_document)
40
+ return true
41
+ end
42
+
43
+ # Sends packet to plesk
44
+ def send_xml_to_server(server, xml)
45
+ http = Net::HTTP.new(server.host, 8443)
46
+ http.use_ssl = true
47
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
48
+
49
+ headers = {
50
+ 'HTTP_AUTH_LOGIN' => server.username,
51
+ 'HTTP_AUTH_PASSWD' => server.password,
52
+ 'Content-Type' => 'text/xml',
53
+ }
54
+
55
+ path = "/enterprise/control/agent.php"
56
+ res, data = http.post2(path, xml, headers)
57
+ return res.body
58
+ end
59
+ end
60
+ end
61
+
@@ -0,0 +1,27 @@
1
+ class PleskLib::Actions::ChangeCustomerPassword < PleskLib::Actions::Base
2
+ attr_reader :customer, :new_password
3
+
4
+ def initialize(customer, new_password)
5
+ @customer = customer
6
+ @new_password = new_password
7
+ end
8
+
9
+ def build_xml
10
+ xml = Builder::XmlMarkup.new
11
+ xml.instruct!
12
+ xml.packet(:version => '1.6.3.5') {
13
+ xml.customer {
14
+ xml.set{
15
+ xml.filter{
16
+ xml.login(@customer.login)
17
+ }
18
+ xml.values{
19
+ xml.gen_info{
20
+ xml.passwd(@new_password)
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ end
27
+ end
@@ -0,0 +1,23 @@
1
+ class PleskLib::Actions::CreateAccount < PleskLib::Actions::Base
2
+ def build_gen_info(xml, account, tag_name = 'gen_info')
3
+ xml.tag!(tag_name) {
4
+ xml.cname(account.company_name)
5
+ xml.pname(account.person_name)
6
+ xml.login(account.login) if account.login.present?
7
+ xml.passwd(account.password) if account.password.present?
8
+ xml.pcode(account.pcode) if account.postal_code.present?
9
+ %w(status phone fax address city state email country).each do |attribute|
10
+ value = account.send(attribute)
11
+ xml.tag!(attribute, value) if value.present?
12
+ end
13
+ xml.tag!('owner-id', account.owner_id) if account.owner_id.present?
14
+ }
15
+ return xml.target!
16
+ end
17
+
18
+ def analyse(xml_document)
19
+ add_node = xml_document.root.locate('*/result').first
20
+ @plesk_id = add_node.id.text.to_i
21
+ @guid = add_node.guid.text
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ class PleskLib::Actions::CreateCustomer < PleskLib::Actions::CreateAccount
2
+ attr_reader :customer, :plesk_id
3
+
4
+ def initialize(customer)
5
+ @customer = customer
6
+ end
7
+
8
+ # Creates Object & Packet
9
+ def build_xml
10
+ xml = Builder::XmlMarkup.new
11
+ xml.instruct!
12
+ xml.packet(:version => '1.6.3.5') {
13
+ xml.customer {
14
+ xml.add{
15
+ build_gen_info(xml, @customer)
16
+ }
17
+ }
18
+ }
19
+ return xml.target!
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ class PleskLib::Actions::CreateReseller < PleskLib::Actions::CreateAccount
2
+ attr_reader :reseller, :plesk_id
3
+
4
+ def initialize(reseller)
5
+ @reseller = reseller
6
+ end
7
+
8
+ # Creates Object & Packet
9
+ def build_xml
10
+ xml = Builder::XmlMarkup.new
11
+ xml.instruct!
12
+ xml.packet(:version => '1.6.3.5') {
13
+ xml.reseller {
14
+ xml.add{
15
+ build_gen_info(xml, @reseller, 'gen-info')
16
+ xml.tag!('plan-id', @reseller.service_plan_id)
17
+ }
18
+ }
19
+ }
20
+ return xml.target!
21
+ end
22
+ end
@@ -0,0 +1,327 @@
1
+ class PleskLib::Actions::CreateServicePlan < PleskLib::Actions::Base
2
+ attr_reader :service_plan, :guid, :plesk_id
3
+
4
+ def initialize(service_plan)
5
+ @service_plan = service_plan
6
+ end
7
+
8
+ def build_xml
9
+ xml = Builder::XmlMarkup.new
10
+ xml.instruct!
11
+ xml.packet(:version => '1.6.3.0') {
12
+ xml.tag!("service-plan") {
13
+ xml.add {
14
+ xml.name("#{service_plan.name}")
15
+ if service_plan.owner_id.present?
16
+ xml.tag!('owner-id', service_plan.owner_id)
17
+ end
18
+ xml.mail{
19
+ xml.webmail('horde')
20
+ }
21
+ xml.limits{
22
+ xml.overuse('block')
23
+
24
+ xml.limit{
25
+ xml.name('max_site')
26
+ xml.value("#{service_plan.domains.to_s}")
27
+ }
28
+ xml.limit{
29
+ xml.name('max_subdom')
30
+ xml.value('-1')
31
+ }
32
+ xml.limit{
33
+ xml.name('max_dom_aliases')
34
+ xml.value('-1')
35
+ }
36
+ xml.limit{
37
+ xml.name('disk_space')
38
+ xml.value("#{service_plan.storage.to_s}") #10gb
39
+ }
40
+ xml.limit{
41
+ xml.name('disk_space_soft')
42
+ xml.value('0')
43
+ }
44
+ xml.limit{
45
+ xml.name('max_traffic')
46
+ xml.value("#{service_plan.traffic.to_s}") # unlimited
47
+ }
48
+ xml.limit{
49
+ xml.name('max_traffic_soft')
50
+ xml.value('0')
51
+ }
52
+ xml.limit{
53
+ xml.name('max_wu')
54
+ xml.value('-1')
55
+ }
56
+ xml.limit{
57
+ xml.name('max_subftp_users')
58
+ xml.value('-1')
59
+ }
60
+ xml.limit{
61
+ xml.name('max_db')
62
+ xml.value('-1')
63
+ }
64
+ xml.limit{
65
+ xml.name('max_box')
66
+ xml.value("#{service_plan.mailboxes.to_s}") # mailboxes
67
+ }
68
+ xml.limit{
69
+ xml.name('mbox_quota')
70
+ xml.value('1073741824')
71
+ }
72
+ xml.limit{
73
+ xml.name('max_maillists')
74
+ xml.value('100')
75
+ }
76
+ xml.limit{
77
+ xml.name('max_webapps')
78
+ xml.value('0')
79
+ }
80
+ xml.limit{
81
+ xml.name('max_site_builder')
82
+ xml.value('1')
83
+ }
84
+ xml.limit{
85
+ xml.name('max_unity_mobile_sites')
86
+ xml.value('0')
87
+ }
88
+ xml.limit{
89
+ xml.name('expiration')
90
+ xml.value('-1')
91
+ }
92
+ # xml.limit{
93
+ # xml.name('upsell_site_builder')
94
+ # xml.value('0')
95
+ # }
96
+
97
+ }
98
+ xml.tag!("log-rotation"){
99
+ xml.on{
100
+ xml.tag!("log-condition"){
101
+ xml.tag!("log-bysize", "10485760")
102
+ }
103
+ xml.tag!("log-max-num-files", "10")
104
+ xml.tag!("log-compress", "true")
105
+ }
106
+ }
107
+ xml.preferences{
108
+ xml.stat('3')
109
+ xml.maillists('false')
110
+ xml.dns_zone_type('master')
111
+ }
112
+ xml.hosting{
113
+ xml.property{
114
+ xml.name('ssl')
115
+ xml.value('false')
116
+ }
117
+ xml.property{
118
+ xml.name('fp')
119
+ xml.value('false')
120
+ }
121
+ xml.property{
122
+ xml.name('fp_ssl')
123
+ xml.value('false')
124
+ }
125
+ xml.property{
126
+ xml.name('fp_auth')
127
+ xml.value('false')
128
+ }
129
+ xml.property{
130
+ xml.name('webstat')
131
+ xml.value('awstats')
132
+ }
133
+ xml.property{
134
+ xml.name('webstat_protected')
135
+ xml.value('true')
136
+ }
137
+ xml.property{
138
+ xml.name('wu_script')
139
+ xml.value('true')
140
+ }
141
+ xml.property{
142
+ xml.name('shell')
143
+ xml.value('/bin/false')
144
+ }
145
+ xml.property{
146
+ xml.name('ftp_quota')
147
+ xml.value('-1')
148
+ }
149
+ xml.property{
150
+ xml.name('php_handler_type')
151
+ xml.value('fastcgi')
152
+ }
153
+ xml.property{
154
+ xml.name('asp')
155
+ xml.value('false')
156
+ }
157
+ xml.property{
158
+ xml.name('ssi')
159
+ xml.value('false')
160
+ }
161
+ xml.property{
162
+ xml.name('php')
163
+ xml.value('true')
164
+ }
165
+ xml.property{
166
+ xml.name('cgi')
167
+ xml.value('true')
168
+ }
169
+ xml.property{
170
+ xml.name('perl')
171
+ xml.value('true')
172
+ }
173
+ xml.property{
174
+ xml.name('python')
175
+ xml.value('true')
176
+ }
177
+ xml.property{
178
+ xml.name('fastcgi')
179
+ xml.value('true')
180
+ }
181
+ xml.property{
182
+ xml.name('miva')
183
+ xml.value('false')
184
+ }
185
+ xml.property{
186
+ xml.name('coldfusion')
187
+ xml.value('false')
188
+ }
189
+ }
190
+ xml.performance{
191
+ xml.bandwidth('-1')
192
+ xml.max_connections('-1')
193
+ }
194
+ xml.permissions{
195
+ xml.permission{
196
+ xml.name('create_domains')
197
+ xml.value('true')
198
+ }
199
+ xml.permission{
200
+ xml.name('manage_phosting')
201
+ xml.value('false')
202
+ }
203
+ xml.permission{
204
+ xml.name('manage_php_settings')
205
+ xml.value('false')
206
+ }
207
+ xml.permission{
208
+ xml.name('manage_sh_access')
209
+ xml.value('false')
210
+ }
211
+ xml.permission{
212
+ xml.name('manage_not_chroot_shell')
213
+ xml.value('false')
214
+ }
215
+ xml.permission{
216
+ xml.name('manage_quota')
217
+ xml.value('false')
218
+ }
219
+ xml.permission{
220
+ xml.name('manage_subdomains')
221
+ xml.value('true')
222
+ }
223
+ xml.permission{
224
+ xml.name('manage_domain_aliases')
225
+ xml.value('false')
226
+ }
227
+ xml.permission{
228
+ xml.name('manage_log')
229
+ xml.value('true')
230
+ }
231
+ xml.permission{
232
+ xml.name('manage_anonftp')
233
+ xml.value('false')
234
+ }
235
+ xml.permission{
236
+ xml.name('manage_subftp')
237
+ xml.value('true')
238
+ }
239
+ xml.permission{
240
+ xml.name('manage_crontab')
241
+ xml.value('false')
242
+ }
243
+ xml.permission{
244
+ xml.name('manage_dns')
245
+ xml.value('true')
246
+ }
247
+ xml.permission{
248
+ xml.name('manage_webapps')
249
+ xml.value('false')
250
+ }
251
+ xml.permission{
252
+ xml.name('manage_webstat')
253
+ xml.value('true')
254
+ }
255
+ xml.permission{
256
+ xml.name('manage_mail_settings')
257
+ xml.value('true')
258
+ }
259
+ xml.permission{
260
+ xml.name('manage_maillists')
261
+ xml.value('true')
262
+ }
263
+ xml.permission{
264
+ xml.name('manage_spamfilter')
265
+ xml.value('true')
266
+ }
267
+ xml.permission{
268
+ xml.name('manage_virusfilter')
269
+ xml.value('true')
270
+ }
271
+ xml.permission{
272
+ xml.name('allow_local_backups')
273
+ xml.value('true')
274
+ }
275
+ xml.permission{
276
+ xml.name('allow_ftp_backups')
277
+ xml.value('true')
278
+ }
279
+ xml.permission{
280
+ xml.name('manage_performance')
281
+ xml.value('false')
282
+ }
283
+ xml.permission{
284
+ xml.name('select_db_server')
285
+ xml.value('false')
286
+ }
287
+ xml.permission{
288
+ xml.name('access_appcatalog')
289
+ xml.value('true')
290
+ }
291
+ xml.permission{
292
+ xml.name('allow_insecure_sites')
293
+ xml.value('true')
294
+ }
295
+ xml.permission{
296
+ xml.name('manage_website_maintenance')
297
+ xml.value('true')
298
+ }
299
+ xml.permission{
300
+ xml.name('manage_protected_dirs')
301
+ xml.value('true')
302
+ }
303
+ xml.permission{
304
+ xml.name('access_service_users')
305
+ xml.value('true')
306
+ }
307
+ xml.permission{
308
+ xml.name('allow_license_stubs')
309
+ xml.value('false')
310
+ }
311
+ }
312
+
313
+ if service_plan.external_id.present?
314
+ xml.tag!('external-id', service_plan.external_id)
315
+ end
316
+ }
317
+ }
318
+ }
319
+ return xml.target!
320
+ end
321
+
322
+ def analyse(xml_document)
323
+ add_node = xml_document.root.locate('*/result').first
324
+ @plesk_id = add_node.id.text.to_i
325
+ @guid = add_node.guid.text
326
+ end
327
+ end