openfire_admin 0.0.3 → 0.0.4

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: cc939e2a210154f50c37e6598c1ee5f1fe5898f4
4
- data.tar.gz: bc6e3246f02c30635b34f8c6d63f85fbfcab4015
3
+ metadata.gz: 70107e5d3f15abf733964103293fadface69da8e
4
+ data.tar.gz: 38d75a6823c6ce80598d7805f721ff40c5205d30
5
5
  SHA512:
6
- metadata.gz: ffd281131ccd00c1900757a10aad788c797593a26ab177b0edfa366d376e297644c5ba46f8c4089d4ad190f049cc16e3da6fc8053e893f142617a6325a0034c0
7
- data.tar.gz: 8b0901b1585e54922e446114a83299dde6a75ee90ceb5c07950f30b69ce691d4ead24a3d72d554ee1cf512c6119d73f186ae5535ec9eae3d584beb82f49c1a68
6
+ metadata.gz: 7458df9590162f46046fab12aa84bd4973fac862a6de9d21b573346a4e9a22377753e3a071143f6073d23779163411f7830eca0e736f9e3500306c999b7f37a1
7
+ data.tar.gz: 5cb111340a0b759a16745b131f085d467a4a2ad3d24c8759f76f247890df8e546f0438d190b5767716516d27dc8fc84bbbaad8fd22b45b9e6ed82df541540e4d
@@ -2,15 +2,27 @@ require 'openfire_admin/http_client'
2
2
  require 'openfire_admin/response_exception'
3
3
 
4
4
  module OpenfireAdmin
5
- # pure admin console client
5
+ # admin console client
6
6
  class AdminClient
7
+ # @param [String] loginurl admin console url. ex "http://localhost:9090/"
7
8
  def initialize(loginurl)
8
9
  @http = HttpClient.new(URI.parse(loginurl))
9
10
  end
11
+ # http post.
12
+ # @param [String] path post url path
13
+ # @param [Hash<String,String>] form_data post form data
14
+ # @yield [Net::HTTPResponse]
10
15
  def post(path, form_data, &proc); @http.post(path, form_data, &proc); end
16
+
17
+ # http get.
18
+ # @param [String] path post url path
19
+ # @param [Hash<String,String>] form_data post form data
20
+ # @yield [Net::HTTPResponse]
11
21
  def get(path, &proc); @http.get(path, &proc); end
12
22
 
13
23
  # login
24
+ # @param [String] username admin user name
25
+ # @param [String] pass admin user password
14
26
  def login(username, pass)
15
27
  post( "/login.jsp" , {
16
28
  "login"=> "true",
@@ -1,13 +1,21 @@
1
1
  require 'rexml/document'
2
2
  require 'rehtml'
3
3
  module OpenfireAdmin
4
+ # REXML Element extention. like nokogiri
4
5
  module ElementHelper
6
+ # find first element by xpath
7
+ # @param [String] xpath
8
+ # @return [REXML::Element extends ElementHelper]
5
9
  def at(xpath)
6
10
  xpath = ".#{xpath}" if !self.is_a?(REXML::Document) and xpath =~ /^\//
7
11
  elm = REXML::XPath.first(self,xpath)
8
12
  elm.extend(ElementHelper)
9
13
  elm
10
14
  end
15
+
16
+ # find elements by xpath
17
+ # @param [String] xpath
18
+ # @return [Array<REXML::Element extends ElementHelper>]
11
19
  def search(xpath)
12
20
  xpath = ".#{xpath}" if !self.is_a?(REXML::Document) and xpath =~ /^\//
13
21
  ret = REXML::XPath.match(self,xpath).map{|elm|
@@ -16,6 +24,10 @@ module OpenfireAdmin
16
24
  block_given? ? (yield elm) : elm
17
25
  }
18
26
  end
27
+
28
+ # find element attribute
29
+ # @param [Symbol] attribute name
30
+ # @return [String|nil]
19
31
  def [](arg, name=nil)
20
32
  if arg.is_a?(Symbol)
21
33
  self.attributes[arg.to_s]
@@ -26,13 +38,23 @@ module OpenfireAdmin
26
38
  end
27
39
  # html parser wrapper
28
40
  class HtmlParser
41
+ # parse html and build xml
42
+ # @param [String] html
29
43
  def initialize(html)
30
44
  @doc = REHTML.to_rexml(html)
31
45
  @doc.extend(ElementHelper)
32
46
  end
47
+
48
+ # find elements by xpath
49
+ # @param [String] xpath
50
+ # @return [Array<REXML::Element extends ElementHelper>]
33
51
  def search(xpath, &proc)
34
52
  @doc.search(xpath, &proc)
35
53
  end
54
+
55
+ # find first element by xpath
56
+ # @param [String] xpath
57
+ # @return [REXML::Element extends ElementHelper]
36
58
  def at(xpath)
37
59
  @doc.at(xpath)
38
60
  end
@@ -1,13 +1,16 @@
1
1
  require 'net/http'
2
2
  module OpenfireAdmin
3
- # http client ( cookie support )
3
+ # simple http client ( cookie support )
4
4
  class HttpClient
5
+ # @param [URI] url admin console uri. HttpClient use its host , port and scheme
5
6
  def initialize(url)
6
7
  @cookies = {}
7
8
  @url = url
8
9
  requrie 'net/https' if @url.scheme == 'https'
9
10
  end
10
11
 
12
+ # @param [Net::HTTPRequest] request
13
+ # @yield [Net::HTTPResponse]
11
14
  def request(req)
12
15
  Net::HTTP.start(@url.host, @url.port) do |http|
13
16
  http.use_ssl = true if @url.scheme == 'https'
@@ -33,6 +36,9 @@ module OpenfireAdmin
33
36
  end
34
37
 
35
38
  # post with form data
39
+ # @param [String] request path
40
+ # @param [Hash<String,String>] form data
41
+ # @yield [Net::HTTPResponse]
36
42
  def post(path, form_data)
37
43
  req = Net::HTTP::Post.new(path)
38
44
  req.set_form_data(form_data)
@@ -40,6 +46,8 @@ module OpenfireAdmin
40
46
  end
41
47
 
42
48
  # get path
49
+ # @param [String] request path
50
+ # @yield [Net::HTTPResponse]
43
51
  def get(path)
44
52
  request(Net::HTTP::Get.new(path)){|res| yield res }
45
53
  end
@@ -1,5 +1,6 @@
1
1
  require 'openfire_admin/html_parser'
2
2
  require 'openfire_admin/admin_client'
3
+ require 'openfire_admin/version_string'
3
4
 
4
5
  module OpenfireAdmin
5
6
  class AdminClient
@@ -25,6 +26,16 @@ module OpenfireAdmin
25
26
  get("/server-properties.jsp") do |res|
26
27
  raise ResponceException.new("can't read",res) unless res.code== "200"
27
28
  doc = HtmlParser.new(res.body)
29
+ version = VersionString.new(/Openfire ([0-9.]*)/.match(doc.at("//div[@id='jive-userstatus']").text.to_s)[1])
30
+ if version >= "3.9.2"
31
+ def ret.strong_hidden?
32
+ true
33
+ end
34
+ else
35
+ def ret.strong_hidden?
36
+ false
37
+ end
38
+ end
28
39
  doc.search('//h1/parent::node()//table/tbody/tr[@class=""]').each do |tr|
29
40
  v = tr.at('//td[2]//span')[:title]
30
41
  v = "" if v == NBSP
@@ -45,11 +56,22 @@ module OpenfireAdmin
45
56
  @cache.inspect
46
57
  end
47
58
 
59
+ def strong_hidden?
60
+ @cache.strong_hidden?
61
+ end
62
+
48
63
  # get system property
49
64
  def []( name )
50
65
  v = @cache[name]
51
- v = @client.get_property(name) if v.nil? and @cache.has_key?(name)
52
- v
66
+ if v.nil? and @cache.has_key?(name)
67
+ if strong_hidden?
68
+ :hide
69
+ else
70
+ @client.get_property(name)
71
+ end
72
+ else
73
+ v
74
+ end
53
75
  end
54
76
 
55
77
  # reload cache
@@ -1,3 +1,3 @@
1
1
  module OpenfireAdmin
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,51 @@
1
+ module OpenfireAdmin
2
+ class VersionString
3
+ def initialize(version)
4
+ @version = version.to_s.strip.split(/\./)
5
+ end
6
+ def <=>(othre)
7
+ compare(@version.dup, othre.kind_of?(VersionString) ? othre.to_a.dup : othre.to_s.strip.split(/\./))
8
+ end
9
+ def > other
10
+ (self <=> other) == 1
11
+ end
12
+ def < other
13
+ (self <=> other) == -1
14
+ end
15
+ def >= other
16
+ (self <=> other) >= 0
17
+ end
18
+ def <= other
19
+ (self <=> other) <= 0
20
+ end
21
+ def == other
22
+ (self <=> other) == 0
23
+ end
24
+ def to_s
25
+ "VersionString(#{@version.join(".")})"
26
+ end
27
+ def to_a
28
+ @version
29
+ end
30
+ private
31
+ def compare(me,othre)
32
+ m = me.shift
33
+ o = othre.shift
34
+ if m.nil?
35
+ return o.nil? ? 0 : -1
36
+ elsif o.nil?
37
+ return 1
38
+ end
39
+ md = m.to_i
40
+ od = o.to_i
41
+ rd = md <=> od
42
+ if rd == 0
43
+ m.sub!(/^\d*/,'')
44
+ o.sub!(/^\d*/,'')
45
+ rd = m <=> o
46
+ rd = compare(me,othre) if rd == 0
47
+ end
48
+ rd
49
+ end
50
+ end
51
+ end
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_dependency "rehtml"
19
19
 
20
- gem.add_development_dependency "rspec"
20
+ gem.add_development_dependency "rspec", "= 2.14.1"
21
21
  gem.add_development_dependency "fakeweb"
22
22
  end
@@ -0,0 +1,534 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
21
+
22
+
23
+ <html>
24
+ <head>
25
+ <title>Openfire Admin Console: System Properties</title>
26
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
27
+ <link rel="stylesheet" type="text/css" href="/style/global.css">
28
+ <script language="JavaScript" type="text/javascript" src="/js/prototype.js"></script>
29
+ <script language="JavaScript" type="text/javascript" src="/js/scriptaculous.js"></script>
30
+ <script language="JavaScript" type="text/javascript" src="/js/cookies.js"></script>
31
+ <script language="JavaScript" type="text/javascript">
32
+
33
+ </script>
34
+ <script type="text/javascript" src="/js/behaviour.js"></script>
35
+ <script type="text/javascript">
36
+ // Add a nice little rollover effect to any row in a jive-table object. This will help
37
+ // visually link left and right columns.
38
+ /*
39
+ var myrules = {
40
+ '.jive-table TBODY TR' : function(el) {
41
+ el.onmouseover = function() {
42
+ this.style.backgroundColor = '#ffffee';
43
+ }
44
+ el.onmouseout = function() {
45
+ this.style.backgroundColor = '#ffffff';
46
+ }
47
+ }
48
+ };
49
+ Behaviour.register(myrules);
50
+ */
51
+ </script>
52
+ <meta name="pageID" content="server-props"/>
53
+ <meta name="helpPage" content="manage_system_properties.html"/>
54
+ </head>
55
+
56
+ <body id="jive-body">
57
+
58
+ <!-- BEGIN main -->
59
+ <div id="main">
60
+
61
+ <div id="jive-header">
62
+ <div id="jive-logo">
63
+ <a href="/index.jsp"><img src="/images/login_logo.gif" alt="Openfire" width="179" height="53" /></a>
64
+ </div>
65
+ <div id="jive-userstatus">
66
+ Openfire 3.9.3<br/>
67
+ Logged in as <strong>nazoking</strong> - <a href="/index.jsp?logout=true">Logout</a>
68
+ </div>
69
+ <div id="jive-nav">
70
+ <div id="jive-nav-left"></div>
71
+ <ul><li class="currentlink">
72
+ <a href="/index.jsp" title="Click to manage server settings" onmouseover="self.status='Click to manage server settings';return true;" onmouseout="self.status='';return true;">Server</a>
73
+ </li><li class="">
74
+ <a href="/user-summary.jsp" title="Click to manage users and groups" onmouseover="self.status='Click to manage users and groups';return true;" onmouseout="self.status='';return true;">Users/Groups</a>
75
+ </li><li class="">
76
+ <a href="/session-summary.jsp" title="Click to manage connected sessions" onmouseover="self.status='Click to manage connected sessions';return true;" onmouseout="self.status='';return true;">Sessions</a>
77
+ </li><li class="">
78
+ <a href="/muc-room-summary.jsp" title="Click to manage group chat settings" onmouseover="self.status='Click to manage group chat settings';return true;" onmouseout="self.status='';return true;">Group Chat</a>
79
+ </li><li class="">
80
+ <a href="/plugin-admin.jsp" title="Click to manage all plugins" onmouseover="self.status='Click to manage all plugins';return true;" onmouseout="self.status='';return true;">Plugins</a>
81
+ </li></ul>
82
+ <div id="jive-nav-right"></div>
83
+ </div>
84
+ <div id="jive-subnav">
85
+ <ul><li class="current">
86
+ <a href="/index.jsp" title=""
87
+ onmouseover="self.status='';return true;" onmouseout="self.status='';return true;"
88
+ >Server Manager</a>
89
+ </li><li class="">
90
+ <a href="/profile-settings.jsp" title=""
91
+ onmouseover="self.status='';return true;" onmouseout="self.status='';return true;"
92
+ >Server Settings</a>
93
+ </li><li class="">
94
+ <a href="/media-proxy.jsp" title=""
95
+ onmouseover="self.status='';return true;" onmouseout="self.status='';return true;"
96
+ >Media Services</a>
97
+ </li></ul>
98
+ </div>
99
+ </div>
100
+
101
+ <div id="jive-main">
102
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
103
+ <tbody>
104
+ <tr valign="top">
105
+ <td width="1%">
106
+ <div id="jive-sidebar-container">
107
+ <div id="jive-sidebar-box">
108
+ <div id="jive-sidebar">
109
+ <ul><li class="">
110
+ <a href="/index.jsp" title="Click to view system information"
111
+ onmouseover="self.status='Click to view system information';return true;" onmouseout="self.status='';return true;"
112
+ >Server Information</a>
113
+
114
+ </li><li class="currentlink">
115
+ <a href="/server-properties.jsp" title="Click to manage server properties"
116
+ onmouseover="self.status='Click to manage server properties';return true;" onmouseout="self.status='';return true;"
117
+ >System Properties</a>
118
+
119
+ </li><li class="">
120
+ <a href="/server-locale.jsp" title="Click to set the language and time zone"
121
+ onmouseover="self.status='Click to set the language and time zone';return true;" onmouseout="self.status='';return true;"
122
+ >Language and Time</a>
123
+
124
+ </li><li class="">
125
+ <a href="/system-clustering.jsp" title="Click to manage clustering settings"
126
+ onmouseover="self.status='Click to manage clustering settings';return true;" onmouseout="self.status='';return true;"
127
+ >Clustering</a>
128
+
129
+ </li><li class="">
130
+ <a href="/system-cache.jsp" title="Click to manage data caches"
131
+ onmouseover="self.status='Click to manage data caches';return true;" onmouseout="self.status='';return true;"
132
+ >Cache Summary</a>
133
+
134
+ </li><li class="">
135
+ <a href="/server-db.jsp" title="Click to view database connection information"
136
+ onmouseover="self.status='Click to view database connection information';return true;" onmouseout="self.status='';return true;"
137
+ >Database</a>
138
+
139
+ </li><li class="">
140
+ <a href="/logviewer.jsp" title="Click to view server logs"
141
+ onmouseover="self.status='Click to view server logs';return true;" onmouseout="self.status='';return true;"
142
+ >Logs</a>
143
+
144
+ </li><li class="">
145
+ <a href="/system-email.jsp" title="Click to configure email settings"
146
+ onmouseover="self.status='Click to configure email settings';return true;" onmouseout="self.status='';return true;"
147
+ >Email Settings</a>
148
+
149
+ </li><li class="">
150
+ <a href="/security-audit-viewer.jsp" title="Click to view the security audit logs"
151
+ onmouseover="self.status='Click to view the security audit logs';return true;" onmouseout="self.status='';return true;"
152
+ >Security Audit Viewer</a>
153
+
154
+ </li></ul>
155
+ <br>
156
+ <img src="/images/blank.gif" width="150" height="1" border="0" alt="">
157
+ </div>
158
+ </div>
159
+ </div>
160
+ </td>
161
+ <td width="99%" id="jive-content">
162
+
163
+
164
+
165
+
166
+ <h1>
167
+ System Properties
168
+ </h1>
169
+
170
+ <div id="jive-main-content">
171
+ <p>
172
+ Below is a list of the system properties. Values for encrypted and sensitive fields are hidden. Long property names and values are clipped. Hold your mouse over the property name to see the full value or to see both the full name and value, click the edit icon next to the property.
173
+ </p>
174
+
175
+ <p><b>System Properties</b></p>
176
+
177
+
178
+
179
+
180
+
181
+ <div class="jive-info">
182
+ <table cellpadding="0" cellspacing="0" border="0">
183
+ <tbody>
184
+ <tr><td class="jive-icon"><img src="images/info-16x16.gif" width="16" height="16" border="0" alt=""></td>
185
+ <td class="jive-icon-label">
186
+ Use the form below this table to edit the property value.
187
+ </td></tr>
188
+ </tbody>
189
+ </table>
190
+ </div><br>
191
+
192
+
193
+
194
+
195
+
196
+ <script language="JavaScript" type="text/javascript">
197
+ function doedit(propName) {
198
+ document.propform.propName.value = propName;
199
+ document.propform.edit.value = 'true';
200
+ document.propform.action = document.propform.action + '#edit';
201
+ document.propform.submit();
202
+ }
203
+ function doencrypt(propName) {
204
+ var doencrypt = confirm('Are you sure you want to encrypt this property?');
205
+ if (doencrypt) {
206
+ document.propform.propName.value = propName;
207
+ document.propform.encrypt.value = 'true';
208
+ document.propform.action = document.propform.action + '#encrypt';
209
+ document.propform.submit();
210
+ }
211
+ }
212
+ function dodelete(propName) {
213
+ var dodelete = confirm('Are you sure you want to delete this property?');
214
+ if (dodelete) {
215
+ document.propform.propName.value = propName;
216
+ document.propform.del.value = 'true';
217
+ document.propform.submit();
218
+ return true;
219
+ }
220
+ else {
221
+ return false;
222
+ }
223
+ }
224
+ </script>
225
+
226
+ <form action="server-properties.jsp" method="post" name="propform">
227
+ <input type="hidden" name="edit" value="">
228
+ <input type="hidden" name="encrypt" value="">
229
+ <input type="hidden" name="del" value="">
230
+ <input type="hidden" name="propName" value="">
231
+
232
+ <style type="text/css">
233
+ .hidebox {
234
+ text-overflow : ellipsis;
235
+ overflow : hidden;
236
+ white-space : nowrap;
237
+ }
238
+ </style>
239
+
240
+ <div class="jive-table">
241
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
242
+ <thead>
243
+ <tr>
244
+ <th nowrap>Property Name</th>
245
+ <th nowrap>Property Value</th>
246
+ <th style="text-align:center;">Edit</th>
247
+ <th style="text-align:center;">Encrypt</th>
248
+ <th style="text-align:center;">Delete</th>
249
+ </tr>
250
+ </thead>
251
+ <tbody>
252
+
253
+
254
+
255
+
256
+ <tr class="">
257
+
258
+ <td>
259
+ <div class="hidebox" style="width:200px;">
260
+ <span title="clustering.enabled">
261
+ clustering.enabled
262
+ </span>
263
+ </div>
264
+ </td>
265
+ <td>
266
+ <div class="hidebox" style="width:300px;">
267
+
268
+ <span title="10">10</span>
269
+
270
+ </div>
271
+ </td>
272
+ <td align="center"><a href="#" onclick="doedit('clustering.enabled');"
273
+ ><img src="images/edit-16x16.gif" width="16" height="16"
274
+ alt="Click to edit this property" border="0"></a
275
+ >
276
+ </td>
277
+ <td align="center">
278
+ <a href="#" onclick="doencrypt('clustering.enabled');" >
279
+ <img src="images/add-16x16.gif" width="16" height="16" alt="Click to encrypt this property" border="0"></a>
280
+
281
+ </td>
282
+ <td align="center"><a href="#" onclick="return dodelete('clustering.enabled');"
283
+ ><img src="images/delete-16x16.gif" width="16" height="16"
284
+ alt="Click to delete this property" border="0"></a
285
+ >
286
+ </td>
287
+ </tr>
288
+
289
+
290
+ <tr class="">
291
+
292
+ <td>
293
+ <div class="hidebox" style="width:200px;">
294
+ <span title="conversation.idleTime">
295
+ conversation.idleTime
296
+ </span>
297
+ </div>
298
+ </td>
299
+ <td>
300
+ <div class="hidebox" style="width:300px;">
301
+
302
+ <span title="10">10</span>
303
+
304
+ </div>
305
+ </td>
306
+ <td align="center"><a href="#" onclick="doedit('conversation.idleTime');"
307
+ ><img src="images/edit-16x16.gif" width="16" height="16"
308
+ alt="Click to edit this property" border="0"></a
309
+ >
310
+ </td>
311
+ <td align="center">
312
+ <a href="#" onclick="doencrypt('conversation.idleTime');" >
313
+ <img src="images/add-16x16.gif" width="16" height="16" alt="Click to encrypt this property" border="0"></a>
314
+
315
+ </td>
316
+ <td align="center"><a href="#" onclick="return dodelete('conversation.idleTime');"
317
+ ><img src="images/delete-16x16.gif" width="16" height="16"
318
+ alt="Click to delete this property" border="0"></a
319
+ >
320
+ </td>
321
+ </tr>
322
+
323
+
324
+ <tr class="">
325
+
326
+ <td>
327
+ <div class="hidebox" style="width:200px;">
328
+ <span title="jdbcAuthProvider.passwordSQL">
329
+ jdbcAuthProvider.passwordSQL
330
+ </span>
331
+ </div>
332
+ </td>
333
+ <td>
334
+ <div class="hidebox" style="width:300px;">
335
+
336
+ <span style="color:#999;"><i>hidden</i></span>
337
+
338
+ </div>
339
+ </td>
340
+ <td align="center"><a href="#" onclick="doedit('jdbcAuthProvider.passwordSQL');"
341
+ ><img src="images/edit-16x16.gif" width="16" height="16"
342
+ alt="Click to edit this property" border="0"></a
343
+ >
344
+ </td>
345
+ <td align="center">
346
+ <a href="#" onclick="doencrypt('jdbcAuthProvider.passwordSQL');" >
347
+ <img src="images/add-16x16.gif" width="16" height="16" alt="Click to encrypt this property" border="0"></a>
348
+
349
+ </td>
350
+ <td align="center"><a href="#" onclick="return dodelete('jdbcAuthProvider.passwordSQL');"
351
+ ><img src="images/delete-16x16.gif" width="16" height="16"
352
+ alt="Click to delete this property" border="0"></a
353
+ >
354
+ </td>
355
+ </tr>
356
+
357
+
358
+
359
+ <tr class="">
360
+
361
+ <td>
362
+ <div class="hidebox" style="width:200px;">
363
+ <span title="xmpp.session.conflict-limit">
364
+ xmpp.session.conflict-limit
365
+ </span>
366
+ </div>
367
+ </td>
368
+ <td>
369
+ <div class="hidebox" style="width:300px;">
370
+
371
+ <span title="0">0</span>
372
+
373
+ </div>
374
+ </td>
375
+ <td align="center"><a href="#" onclick="doedit('xmpp.session.conflict-limit');"
376
+ ><img src="images/edit-16x16.gif" width="16" height="16"
377
+ alt="Click to edit this property" border="0"></a
378
+ >
379
+ </td>
380
+ <td align="center">
381
+ <a href="#" onclick="doencrypt('xmpp.session.conflict-limit');" >
382
+ <img src="images/add-16x16.gif" width="16" height="16" alt="Click to encrypt this property" border="0"></a>
383
+
384
+ </td>
385
+ <td align="center"><a href="#" onclick="return dodelete('xmpp.session.conflict-limit');"
386
+ ><img src="images/delete-16x16.gif" width="16" height="16"
387
+ alt="Click to delete this property" border="0"></a
388
+ >
389
+ </td>
390
+ </tr>
391
+
392
+
393
+ <tr class="">
394
+
395
+ <td>
396
+ <div class="hidebox" style="width:200px;">
397
+ <span title="xmpp.socket.ssl.active">
398
+ xmpp.socket.ssl.active
399
+ </span>
400
+ </div>
401
+ </td>
402
+ <td>
403
+ <div class="hidebox" style="width:300px;">
404
+
405
+ <span title="true">true</span>
406
+
407
+ </div>
408
+ </td>
409
+ <td align="center"><a href="#" onclick="doedit('xmpp.socket.ssl.active');"
410
+ ><img src="images/edit-16x16.gif" width="16" height="16"
411
+ alt="Click to edit this property" border="0"></a
412
+ >
413
+ </td>
414
+ <td align="center">
415
+ <a href="#" onclick="doencrypt('xmpp.socket.ssl.active');" >
416
+ <img src="images/add-16x16.gif" width="16" height="16" alt="Click to encrypt this property" border="0"></a>
417
+
418
+ </td>
419
+ <td align="center"><a href="#" onclick="return dodelete('xmpp.socket.ssl.active');"
420
+ ><img src="images/delete-16x16.gif" width="16" height="16"
421
+ alt="Click to delete this property" border="0"></a
422
+ >
423
+ </td>
424
+ </tr>
425
+
426
+
427
+
428
+ </tbody>
429
+ </table>
430
+ </div>
431
+
432
+ </form>
433
+
434
+ <br><br>
435
+
436
+ <a name="edit"></a>
437
+ <form action="server-properties.jsp" method="post" name="editform">
438
+
439
+ <div class="jive-table">
440
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
441
+ <thead>
442
+ <tr>
443
+ <th colspan="2">
444
+
445
+ Edit property
446
+
447
+ </th>
448
+ </tr>
449
+ </thead>
450
+ <tbody>
451
+ <tr valign="top">
452
+ <td>
453
+ Property Name:
454
+ </td>
455
+ <td>
456
+
457
+
458
+ <input type="hidden" name="propName" value="jdbcAuthProvider.passwordSQL">
459
+ jdbcAuthProvider.passwordSQL
460
+
461
+
462
+ </td>
463
+ </tr>
464
+ <tr valign="top">
465
+ <td>
466
+ Property Value:
467
+ </td>
468
+ <td>
469
+
470
+ <textarea cols="45" rows="5" name="propValue" wrap="virtual"></textarea>
471
+
472
+
473
+ </td>
474
+ </tr>
475
+ <tr valign="top">
476
+ <td>
477
+ Property Encryption:
478
+ </td>
479
+ <td>
480
+ <input type="radio" name="encrypt" value="true" />Encrypt this property value<br/>
481
+ <input type="radio" name="encrypt" value="false" checked/>Do not encrypt this property value
482
+ </td>
483
+ </tr>
484
+ </tbody>
485
+ <tfoot>
486
+ <tr>
487
+ <td colspan="2">
488
+ <input type="submit" name="save" value="Save Property">
489
+ <input type="submit" name="cancel" value="Cancel">
490
+ </td>
491
+ </tr>
492
+ </tfoot>
493
+ </table>
494
+ </div>
495
+
496
+ </form>
497
+
498
+ <br><br><br><br><br><br>
499
+ <br><br><br><br><br><br>
500
+ <br><br><br><br><br><br>
501
+ <br><br><br><br><br><br>
502
+ </div>
503
+ </td>
504
+ </tr>
505
+ </tbody>
506
+ </table>
507
+ </div>
508
+
509
+ </div>
510
+ <!-- END main -->
511
+
512
+ <!-- BEGIN footer -->
513
+ <div id="jive-footer">
514
+ <div class="jive-footer-nav">
515
+
516
+ <a href="/index.jsp" title="Click to manage server settings" onmouseover="self.status='Click to manage server settings';return true;" onmouseout="self.status='';return true;">Server</a>
517
+ |
518
+ <a href="/user-summary.jsp" title="Click to manage users and groups" onmouseover="self.status='Click to manage users and groups';return true;" onmouseout="self.status='';return true;">Users/Groups</a>
519
+ |
520
+ <a href="/session-summary.jsp" title="Click to manage connected sessions" onmouseover="self.status='Click to manage connected sessions';return true;" onmouseout="self.status='';return true;">Sessions</a>
521
+ |
522
+ <a href="/muc-room-summary.jsp" title="Click to manage group chat settings" onmouseover="self.status='Click to manage group chat settings';return true;" onmouseout="self.status='';return true;">Group Chat</a>
523
+ |
524
+ <a href="/plugin-admin.jsp" title="Click to manage all plugins" onmouseover="self.status='Click to manage all plugins';return true;" onmouseout="self.status='';return true;">Plugins</a>
525
+
526
+ </div>
527
+ <div class="jive-footer-copyright">
528
+ Built by <a href="http://www.jivesoftware.com">Jive Software</a> and the <a href="http://www.igniterealtime.org">IgniteRealtime.org</a> community
529
+ </div>
530
+ </div>
531
+ <!-- END footer -->
532
+
533
+ </body>
534
+ </html>
@@ -152,6 +152,7 @@ describe OpenfireAdmin::Client do
152
152
  s["jdbcAuthProvider.passwordSQL"].should == "SELECT psw as password FROM users WHERE jid = ?"
153
153
  }
154
154
 
155
+ s.strong_hidden?.should be_false
155
156
  expect_post("/server-properties.jsp",{
156
157
  "save"=>"Save Property",
157
158
  "propName"=>"jdbcAuthProvider.passwordSQL",
@@ -168,6 +169,18 @@ describe OpenfireAdmin::Client do
168
169
  }
169
170
 
170
171
  end
172
+ it "can't read hidden operate system properties version 3.9.3" do
173
+ client = OpenfireAdmin.new
174
+ s = nil
175
+ expect_get("/server-properties.jsp","/server-properties.3.9.3.jsp"){
176
+ s = client.system_properties
177
+ s.should be_a_kind_of(OpenfireAdmin::PropertyMap)
178
+ s["xmpp.socket.ssl.active"].should == "true"
179
+ s["not.exists.key"].should be_nil
180
+ }
181
+ s.strong_hidden?.should be_true
182
+ s["jdbcAuthProvider.passwordSQL"].should == :hide
183
+ end
171
184
  it "can operate system cache" do
172
185
  client = OpenfireAdmin.new
173
186
  pi = nil
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require 'openfire_admin'
3
+ require 'openfire_admin/version_string'
4
+
5
+ describe OpenfireAdmin::VersionString do
6
+ describe "2.4.8" do
7
+ subject{ OpenfireAdmin::VersionString.new("2.4.8") }
8
+ it{ should < "2.4.9" }
9
+ it{ should == "2.4.8" }
10
+ it{ should < "2.4.81" }
11
+ it{ should < "2.4.8.0" }
12
+ it{ should < "2.4.8.1" }
13
+ it{ should < "2.4.8a" }
14
+ it{ should > "2.4" }
15
+ it{ should > "2.4.7" }
16
+ it{ should > "2.4.a" }
17
+ it{ should > nil }
18
+ it{ should == OpenfireAdmin::VersionString.new("2.4.8") }
19
+ end
20
+ describe "2.4.8a" do
21
+ subject{ OpenfireAdmin::VersionString.new("2.4.8a").should }
22
+ it{ should < "2.4.8b" }
23
+ it{ should < "2.4.8aa" }
24
+ it{ should > "2.4.8" }
25
+ it{ should == "2.4.8a" }
26
+ end
27
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openfire_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - nazoking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-28 00:00:00.000000000 Z
11
+ date: 2014-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rehtml
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 2.14.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 2.14.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: fakeweb
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -77,9 +77,11 @@ files:
77
77
  - lib/openfire_admin/system_cache.rb
78
78
  - lib/openfire_admin/user_admin.rb
79
79
  - lib/openfire_admin/version.rb
80
+ - lib/openfire_admin/version_string.rb
80
81
  - openfire_admin.gemspec
81
82
  - spec/fixtures/login-fail.jsp
82
83
  - spec/fixtures/plugin-admin.jsp
84
+ - spec/fixtures/server-properties.3.9.3.jsp
83
85
  - spec/fixtures/server-properties.jsp
84
86
  - spec/fixtures/server-properties_password.jsp
85
87
  - spec/fixtures/system-cache.jsp
@@ -88,6 +90,7 @@ files:
88
90
  - spec/openfire_admin_spec.rb
89
91
  - spec/spec_helper.rb
90
92
  - spec/uri_backport.rb
93
+ - spec/version_string_spec.rb
91
94
  homepage: https://github.com/nazoking/openfire_admin
92
95
  licenses: []
93
96
  metadata: {}
@@ -114,6 +117,7 @@ summary: Control for Openfire admin console
114
117
  test_files:
115
118
  - spec/fixtures/login-fail.jsp
116
119
  - spec/fixtures/plugin-admin.jsp
120
+ - spec/fixtures/server-properties.3.9.3.jsp
117
121
  - spec/fixtures/server-properties.jsp
118
122
  - spec/fixtures/server-properties_password.jsp
119
123
  - spec/fixtures/system-cache.jsp
@@ -122,3 +126,4 @@ test_files:
122
126
  - spec/openfire_admin_spec.rb
123
127
  - spec/spec_helper.rb
124
128
  - spec/uri_backport.rb
129
+ - spec/version_string_spec.rb