Guest User

Untitled

a guest
May 8th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.06 KB | None | 0 0
  1. diff --git a/app/controllers/application.rb b/app/controllers/application.rb
  2. index fc14cae..2bee502 100644
  3. --- a/app/controllers/application.rb
  4. +++ b/app/controllers/application.rb
  5. @@ -137,7 +137,6 @@ class ApplicationController < ActionController::Base
  6.  
  7. def validate_tool(tool_id)
  8. @space_tool = _space_tool(tool_id)
  9. -
  10. if !@space_tool
  11. permission_redirect
  12. return false
  13. diff --git a/app/helpers/spaces/users_helper.rb b/app/helpers/spaces/users_helper.rb
  14. index 1973f4e..d244c9d 100644
  15. --- a/app/helpers/spaces/users_helper.rb
  16. +++ b/app/helpers/spaces/users_helper.rb
  17. @@ -9,7 +9,8 @@ module Spaces::UsersHelper
  18. if user_role.owner?
  19. links << demote_link(@space.id, user_role.id) if count_owners > 1 && user_role.user!=current_user
  20. else
  21. - links << demote_link(@space.id, user_role.id) if (@space.public? ? !user_role.watcher? : !user_role.member?)
  22. + # This will allow the demote link not to work on watcher users. ie. watchers can not be demoted at the moment.
  23. + links << demote_link(@space.id, user_role.id) if !user_role.watcher?
  24. end
  25.  
  26. links << remind_link(user_role.user) if user_role.status == UserRole::INVITED
  27. diff --git a/app/helpers/spaces_helper.rb b/app/helpers/spaces_helper.rb
  28. index 310233b..c5368ac 100644
  29. --- a/app/helpers/spaces_helper.rb
  30. +++ b/app/helpers/spaces_helper.rb
  31. @@ -111,6 +111,25 @@ module SpacesHelper
  32. end
  33. end
  34.  
  35. + # This method can be used to generate the user roles radio button.
  36. + # The parameter role can be set to any particular role vaule, and according to this parameter, the appropriate radio button gets selected.
  37. + def user_role_radio_fields(role = "")
  38. + member_checked = ""
  39. + owner_checked = ""
  40. + watcher_checked = ""
  41. + if role == UserRole::ROLE_OWNER
  42. + owner_checked = "checked"
  43. + elsif role == UserRole::ROLE_WATCHER
  44. + watcher_checked = "checked"
  45. + else
  46. + member_checked = "checked"
  47. + end
  48. + html = "<label><input type='radio' id='rowner' name='role' value='#{UserRole::ROLE_OWNER}' #{owner_checked}> #{_("Owner")}</label>"
  49. + html += "<label><input type='radio' id='rmember' name='role' value='#{UserRole::ROLE_MEMBER}' #{member_checked}> #{_("Member")}</label>"
  50. + html += "<label><input type='radio' id='rwatcher' name='role' value='#{UserRole::ROLE_WATCHER}' #{watcher_checked}> #{_("Watcher")}</label>"
  51. + html
  52. + end
  53. +
  54. def role_header
  55. perm = @space.get_permission(current_user)
  56. permdesc = "You have #{Space::PERMISSION_NAMES[perm].downcase} permission in this space"
  57. diff --git a/app/models/space.rb b/app/models/space.rb
  58. index 650a6be..d93df15 100644
  59. --- a/app/models/space.rb
  60. +++ b/app/models/space.rb
  61. @@ -165,6 +165,7 @@ class Space < ActiveRecord::Base
  62.  
  63. PERMISSION_SELECTOR_PUBLIC = Array.new(PERMISSION_SELECTOR[0..-2]).freeze
  64. PERMISSION_SELECTOR_TEAM = Array.new(PERMISSION_SELECTOR[1..-1]).freeze
  65. + PERMISSION_SELECTOR_WATCHER = Array.new(PERMISSION_SELECTOR[1..1]).freeze
  66.  
  67. # Values for the spaces_spaces relationships. This list will be added to.
  68. RELATION_NAMES = ['TRUSTS']
  69. @@ -297,8 +298,13 @@ class Space < ActiveRecord::Base
  70. rez = self.team_permissions
  71. role = UserRole::ROLE_MEMBER
  72. else
  73. - # role = UserRole::ROLE_WATCHER
  74. - rez = self.public_permissions
  75. + if user_roles.detect{|ur| ur['role'].to_i >= UserRole::ROLE_WATCHER }
  76. + # Watcher user
  77. + rez = self.watcher_permissions
  78. + role = UserRole::ROLE_WATCHER
  79. + else
  80. + rez = self.public_permissions
  81. + end
  82. end
  83. end
  84. end
  85. @@ -486,11 +492,8 @@ AND (user_roles.space_id = #{con.quote self.id}
  86. errors.add(:user_roles, _("%{fn} Cannot demote the only owner of the space"))
  87. end
  88. when UserRole::ROLE_MEMBER
  89. - if self.public_permissions == PERMISSION_NONE
  90. - errors.add(:user_roles, _("%{fn} Cannot set user role to watcher when the space is set to private"))
  91. - else
  92. - user_role.role = UserRole::ROLE_WATCHER
  93. - end
  94. + #We can change the permission level from both public and private space
  95. + user_role.role = UserRole::ROLE_WATCHER
  96. end
  97. end
  98. user_role.save if errors.empty?
  99. diff --git a/app/views/spaces/_invitationform.rhtml b/app/views/spaces/_invitationform.rhtml
  100. index b783138..6b21cb8 100644
  101. --- a/app/views/spaces/_invitationform.rhtml
  102. +++ b/app/views/spaces/_invitationform.rhtml
  103. @@ -10,10 +10,10 @@
  104.  
  105. <fieldset>
  106.  
  107. - <label><%= _("E-mail address")%></label>
  108. + <label><%= _("E-mail address")%></label>
  109. <input name="email" type="text" class="textbox" size="40" value="<%=h params[:searchfor] %>"/>
  110.  
  111. - <label><%= _("Invitation message")%></label>
  112. + <label><%= _("Invitation message")%></label>
  113. <textarea cols="40" rows="6" name="message"><%=h params[:message] %></textarea>
  114.  
  115. </fieldset>
  116. @@ -22,17 +22,9 @@
  117.  
  118. <legend><%= _("Role")%>
  119. </legend>
  120. -
  121. - <% if params[:role] == UserRole::ROLE_OWNER
  122. - memberChecked = ""
  123. - ownerChecked = "checked"
  124. - else
  125. - memberChecked = "checked"
  126. - end %>
  127. -
  128. - <label><input type="radio" id="rmember" name="role" value="<%= UserRole::ROLE_MEMBER %>" <%= memberChecked %>>&nbsp;<%= _("Member")%></label>
  129. - <label><input type="radio" id="rowner" name="role" value="<%= UserRole::ROLE_OWNER %>" <%= ownerChecked %>> <%= _("Owner")%></label>
  130. -
  131. + <%= user_role_radio_fields(params[:role]) %>
  132. +
  133. +
  134. </fieldset>
  135.  
  136. <%= submit_tag _('Invite User'), :class=>"button" %> or <%= link_to_remote(_("Cancel"), :update => "teamlist", :url => { :controller=>"spaces", :action=>"reload_teamlist", :space_id=>@space.id }) %>
  137. diff --git a/app/views/spaces/admin/index.rhtml b/app/views/spaces/admin/index.rhtml
  138. index 929c4c7..c30e2b7 100644
  139. --- a/app/views/spaces/admin/index.rhtml
  140. +++ b/app/views/spaces/admin/index.rhtml
  141. @@ -3,203 +3,205 @@
  142. <%= stylesheet_link_tag 'admin_upgrade' %>
  143. <div id="space_settings"></div>
  144. <% if is_site_admin? %>
  145. - <div style="text-align:right">
  146. - <%= link_to _("Admin Setting"), :action=>"admin" %>
  147. - </div>
  148. + <div style="text-align:right">
  149. + <%= link_to _("Admin Setting"), :action=>"admin" %>
  150. + </div>
  151. <% end %>
  152.  
  153. <% if !@space.is_commercial? && @space.is_private? %>
  154.  
  155. -<div class="summary-wrap-red">
  156. -
  157. -<div class="summary_section">
  158. - <div class="ico">
  159. - <a href="<%=url_for :action=>"security"%>" title="<%= _("Upgrade: More Details")%>">
  160. - <%= image_tag("admin/ico_admin-upgrade.gif",:border=>0) %>
  161. - </a>
  162. - </div>
  163. - <div class="more_link">
  164. - <%= link_to _("More"), :action=>"upgrade" %><span>></span>
  165. - </div>
  166. - <div class="summary_body main-features bg_red">
  167. - <h1><a href="<%=url_for :action => "upgrade"%>" title="<%= _("Uprade: More Details")%>"><%= _('Upgrade')%></a></h1>
  168. - <p>
  169. - <%= _("You are an owner of this space, which is private and free.") %>.
  170. - <strong> Assembla is no longer supporting this configuration</strong> so you need to purchase an inexpensive paid subscription, or change your permissions to make this space publicly visible.
  171. - If you do not respond, we will set your space to read-only status, and you will be able to get your private information later. Thank you for selecting one of the options below.
  172. - </p>
  173. - <p>
  174. - <div class="mf-button">
  175. - <div id="mfbutton">
  176. - <div id="mfbtn-inner" style="white-space:nowrap">
  177. - <%= link_to("<em>" + image_tag("/images/upgrade-arrow-small.gif", :alt => _("Upgrade")) + _("Pay for this space and upgrade")+"</em>", make_private_space_path(@space), :method => :put) %>
  178. - </div>
  179. - </div>
  180. - </div>
  181. - <div class="mf-or-cancel"> <%=_("or") %> <%= link_to _("Make this space public"), make_public_space_path(@space), :method => :put%></div>
  182. - </p>
  183. - </div>
  184. + <div class="summary-wrap-red">
  185.  
  186. -</div>
  187. + <div class="summary_section">
  188. + <div class="ico">
  189. + <%= link_to image_tag("admin/ico_admin-upgrade.gif"), :action=>"security", :title=>_("Upgrade: More Details")%>
  190. + </div>
  191. + <div class="more_link">
  192. + <%= link_to _("More"), :action=>"upgrade" %><span>></span>
  193. + </div>
  194. + <div class="summary_body main-features bg_red">
  195. + <h1>
  196. + <%= link_to _('Upgrade'), :action => "upgrade", :title=>_("Uprade: More Details")%>
  197. + </h1>
  198. + <p>
  199. + <%= _("You are an owner of this space, which is private and free.") %>.
  200. + <strong> Assembla is no longer supporting this configuration</strong> so you need to purchase an inexpensive paid subscription, or change your permissions to make this space publicly visible.
  201. + If you do not respond, we will set your space to read-only status, and you will be able to get your private information later. Thank you for selecting one of the options below.
  202. + </p>
  203. + <p>
  204. + <div class="mf-button">
  205. + <div id="mfbutton">
  206. + <div id="mfbtn-inner" style="white-space:nowrap">
  207. + <%= link_to("<em>" + image_tag("/images/upgrade-arrow-small.gif",
  208. + :alt => _("Upgrade")) + _("Pay for this space and upgrade")+"</em>", make_private_space_path(@space), :method => :put) %>
  209. + </div>
  210. + </div>
  211. + </div>
  212. + <div class="mf-or-cancel"> <%=_("or") %> <%= link_to _("Make this space public"), make_public_space_path(@space), :method => :put%></div>
  213. + </p>
  214. + </div>
  215.  
  216. -<div class="cut"></div>
  217. + </div>
  218.  
  219. -</div>
  220. + <div class="cut"></div>
  221. +
  222. + </div>
  223.  
  224. <%end%>
  225.  
  226. <div class="summary-wrap">
  227. -<div class="summary_section">
  228. - <div class="ico">
  229. - <a href="<%=url_for :action=>"tools"%>" title="<%= _("Tools: More Details")%>">
  230. - <%= image_tag("admin/ico_admin-tools.gif",:border=>0) %>
  231. - </a>
  232. - </div>
  233. - <div class="more_link">
  234. - <%= link_to _("More"), :action=>"tools" %><span>></span>
  235. - </div>
  236. - <div class="summary_body">
  237. - <h1><a href="<%=url_for :action=>"tools"%>" title="<%= _("Tools: More Details")%>"><%= _("Tools")%></a></h1>
  238. - <p><%= _("Configure or Install new")%> <strong><%= _("On-Demand Tools")%></strong></p>
  239. - <p style="margin-top:5px">
  240. - <strong><%= _("Installed Tools")%>:</strong>
  241. + <div class="summary_section">
  242. + <div class="ico">
  243. + <%= link_to image_tag("admin/ico_admin-tools.gif"), :action=>"tools", :title=>_("Tools: More Details")%>
  244. + </div>
  245. + <div class="more_link">
  246. + <%= link_to _("More"), :action=>"tools" %><span>></span>
  247. + </div>
  248. + <div class="summary_body">
  249. + <h1>
  250. + <%= link_to _("Tools"), :action=>"tools", :title=>_("Tools: More Details")%>
  251. + </h1>
  252. + <p><%= _("Configure or Install new")%> <strong><%= _("On-Demand Tools")%></strong></p>
  253. + <p style="margin-top:5px">
  254. + <strong><%= _("Installed Tools")%>:</strong>
  255. <%if @installed_tools.empty? %>
  256. - <em><%= _("You don't have any tools yet")%></em>
  257. - </p>
  258. - <%else%>
  259. - </p>
  260. - <ul id="tool_list">
  261. - <% @installed_tools.each do |t| %>
  262. - <li><%= tool_full_title(t) %></li>
  263. - <% end %>
  264. - </ul>
  265. - <%end%>
  266. - </div>
  267. -
  268. -</div>
  269. -
  270. -<div class="cut"></div>
  271. + <em><%= _("You don't have any tools yet")%></em>
  272. + </p>
  273. + <%else%>
  274. + </p>
  275. + <ul id="tool_list">
  276. + <% @installed_tools.each do |t| %>
  277. + <li><%= tool_full_title(t) %></li>
  278. + <% end %>
  279. + </ul>
  280. + <%end%>
  281. + </div>
  282. +
  283. + </div>
  284. +
  285. + <div class="cut"></div>
  286.  
  287. </div>
  288.  
  289. <div class="summary-wrap">
  290. -<div class="summary_section">
  291. - <div class="ico">
  292. - <a href="<%=url_for :action=>"security"%>" title="<%= _("Security: More Details")%>">
  293. - <%= image_tag("admin/ico_admin-access.gif",:border=>0) %>
  294. - </a>
  295. - </div>
  296. - <div class="more_link">
  297. - <%= link_to _("More"), :action=>"security" %><span>></span>
  298. - </div>
  299. - <div class="summary_body">
  300. -
  301. - <% form_tag space_path(@edit), :method=>:put do%>
  302. -<h1><a href="<%=url_for :action=>"security"%>" title="<%= _("Security: More Details")%>">
  303. - <%= _("Security")%>
  304. - </a></h1>
  305. -
  306. - <p>
  307. - <strong><%= _("Non-member access")%>:</strong>
  308. - <label class="inline"><%= _("Allow")%> <%= select 'space', 'public_permissions', @space.public_permission_selector(true), {}, {:style=>"width:75px",
  309. - :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
  310. - :with => 'Form.Element.serialize(this)')} %> <%= _("for public access")%>.</label>
  311. - </p>
  312. - <p>
  313. - <strong><%= _("Member access")%>:</strong>
  314. - <label class="inline"><%= _("Allow")%> <%= select 'space', 'team_permissions', Space::PERMISSION_SELECTOR_TEAM, {}, {:style=>"width:75px",
  315. - :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
  316. - :with => 'Form.Element.serialize(this)')} %> <%= _("for team member access")%>.</label>
  317. - </p>
  318. - <%if !@space.is_commercial? %>
  319. - <p style="font-size:smaller">
  320. - <%= _("You can't set the")%> <strong> <%= _("Non-member access")%></strong> <%= _("to")%> <strong> <%= _("None")%> </strong> <%= _("because your space is not Commercial")%>.
  321. - <%= _("If you want to have a private space you will need to")%> <%= link_to _("upgrade"), :action=>"upgrade"%>.
  322. - </p>
  323. - <%end%>
  324. - <%end%>
  325. - </div>
  326. + <div class="summary_section">
  327. + <div class="ico">
  328. + <%= link_to image_tag("admin/ico_admin-access.gif"), :action=>"security", :title=>_("Security: More Details")%>
  329. + </div>
  330. + <div class="more_link">
  331. + <%= link_to _("More"), :action=>"security" %><span>></span>
  332. + </div>
  333. + <div class="summary_body">
  334. +
  335. + <% form_tag space_path(@edit), :method=>:put do%>
  336. + <h1><%= link_to _("Security"), :action=>"security", :title => _("Security: More Details")%></h1>
  337. +
  338. + <p>
  339. + <strong><%= _("Non-member access")%>:</strong>
  340. + <label class="inline"><%= _("Allow")%> <%= select 'space', 'public_permissions', @space.public_permission_selector(true), {}, {:style=>"width:75px",
  341. + :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
  342. + :with => 'Form.Element.serialize(this)')} %> <%= _("for public access")%>.</label>
  343. + </p>
  344. + <p>
  345. + <strong><%= _("Watcher access:")%>:</strong>
  346. + <label class="inline"><%= _("Allow")%> <%= select 'space', 'watcher_permissions', Space::PERMISSION_SELECTOR_WATCHER, {}, {:style=>"width:75px",
  347. + :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
  348. + :with => 'Form.Element.serialize(this)')} %> <%= _("for watcher access")%>.</label>
  349. + </p>
  350. + <p>
  351. + <strong><%= _("Team Member access")%>:</strong>
  352. + <label class="inline"><%= _("Allow")%> <%= select 'space', 'team_permissions', Space::PERMISSION_SELECTOR_TEAM, {}, {:style=>"width:75px",
  353. + :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
  354. + :with => 'Form.Element.serialize(this)')} %> <%= _("for team member access")%>.</label>
  355. + </p>
  356. + <%if !@space.is_commercial? %>
  357. + <p style="font-size:smaller">
  358. + <%= _("You can't set the")%> <strong> <%= _("Non-member access")%></strong> <%= _("to")%> <strong> <%= _("None")%> </strong> <%= _("because your space is not Commercial")%>.
  359. + <%= _("If you want to have a private space you will need to")%> <%= link_to _("upgrade"), :action=>"upgrade"%>.
  360. + </p>
  361. + <%end%>
  362. + <%end%>
  363. + </div>
  364.  
  365. -</div>
  366. + </div>
  367.  
  368. -<div class="cut"></div>
  369. + <div class="cut"></div>
  370.  
  371. </div>
  372. <div class="summary-wrap">
  373. -<div class="summary_section">
  374. - <div class="ico">
  375. - <a href="<%=url_for :action=>"resources"%>" title="<%= _("Resources: More Details")%>">
  376. - <%= image_tag("admin/ico_admin-resources.gif",:border=>0) %>
  377. - </a>
  378. - </div>
  379. - <div class="more_link">
  380. - <%= link_to _("More"), :action=>"resources" %><span>></span>
  381. - </div>
  382. - <div class="summary_body">
  383. - <h1><a href="<%=url_for :action=>"resources"%>" title="<%= _("Resources: More Details")%>"><%= _("Resources")%></a></h1>
  384. -
  385. - <%if @space.is_commercial? %>
  386. - <% if @space.payer %>
  387. - <p><strong><%= _("Payer")%>:</strong> <%= @space.payer.permissioned_name(logged_user) %></p>
  388. - <%end%>
  389. - <p>
  390. - <strong><%= _("Disk Space Usage")%>:</strong> <%=number_to_human_size(@total)%>
  391.  
  392. - <span style="margin-left:50px"><strong>Team Size:</strong> <%= pluralize(@space.user_roles.count,"member","members")%></span>
  393. - </p>
  394. - <p><b><%= _("To get support")%></b>, <%= _("email")%> <a href='mailto:<%= UserSystem::CONFIG[:service_support_email] %>'><%= UserSystem::CONFIG[:service_support_email] %></a> <%= _("or call")%> <%= UserSystem::CONFIG[:service_support_phone] %></p>
  395. - <%else%>
  396. -
  397. - <% unless @no_billing %>
  398. - <p><strong><%= link_to _("Upgrade"), :action=>"upgrade"%></strong> <%= _("this space and get all the benefits of a")%> <strong> <%= _("Commercial")%> </strong> <%= _("space")%>: <%= _("Private Space, 5GB of disk space, Automatic external S3 Backup and")%> <%= link_to _("more") %>.</p>
  399. - <% end %>
  400. - <p> <strong><%= _("Disk Space Usage")%>:</strong> <%=number_to_human_size(@total)%> of <%= quota_limit_color @total, @space.max_disk_quota %> </p>
  401. - <%end%>
  402. - </div>
  403. + <div class="summary_section">
  404. + <div class="ico">
  405. + <%= link_to image_tag("admin/ico_admin-resources.gif"), :action=>"resources", :title =>_("Resources: More Details") %>
  406. + </div>
  407. + <div class="more_link">
  408. + <%= link_to _("More"), :action=>"resources" %><span>></span>
  409. + </div>
  410. + <div class="summary_body">
  411. + <h1>
  412. + <%= link_to _("Resources"), :action => "resources", :title=> _("Resources: More Details")%>
  413. + </h1>
  414. +
  415. + <%if @space.is_commercial? %>
  416. + <% if @space.payer %>
  417. + <p><strong><%= _("Payer")%>:</strong> <%= @space.payer.permissioned_name(logged_user) %></p>
  418. + <%end%>
  419. + <p>
  420. + <strong><%= _("Disk Space Usage")%>:</strong> <%=number_to_human_size(@total)%>
  421. + <span style="margin-left:50px"><strong>Team Size:</strong> <%= pluralize(@space.user_roles.count,"member","members")%></span>
  422. + </p>
  423. + <p><b><%= _("To get support")%></b>, <%= _("email")%>
  424. + <%=mail_to("#{UserSystem::CONFIG[:service_support_email]}",UserSystem::CONFIG[:service_support_email])%> <%= _("or call")%> <%= UserSystem::CONFIG[:service_support_phone] %></p>
  425. + <%else%>
  426.  
  427. + <% unless @no_billing %>
  428. + <p><strong><%= link_to _("Upgrade"), :action=>"upgrade"%></strong> <%= _("this space and get all the benefits of a")%> <strong> <%= _("Commercial")%> </strong> <%= _("space")%>: <%= _("Private Space, 5GB of disk space, Automatic external S3 Backup and")%> <%= link_to _("more") %>.</p>
  429. + <% end %>
  430. + <p> <strong><%= _("Disk Space Usage")%>:</strong> <%=number_to_human_size(@total)%> of <%= quota_limit_color @total, @space.max_disk_quota %> </p>
  431. + <%end%>
  432. + </div>
  433.  
  434. -</div>
  435.  
  436. -<div class="cut"></div>
  437. + </div>
  438. +
  439. + <div class="cut"></div>
  440.  
  441. </div>
  442.  
  443.  
  444. <div class="summary-wrap">
  445. -<div class="summary_section">
  446. - <div class="ico">
  447. - <a href="<%=url_for :action=>"general"%>" title="<%= _("General: More Details")%>">
  448. - <%= image_tag("admin/ico_admin-configure.gif",:border=>0) %>
  449. - </a>
  450. - </div>
  451. - <div class="more_link">
  452. - <%= link_to _("More"), :action=>"general" %><span>></span>
  453. - </div>
  454. - <div class="summary_body">
  455. - <h1><a href="<%=url_for :action=>"general"%>" title="<%= _("General: More Details")%>">General</a></h1>
  456. - <p><%= _("Change your space name, url or description")%>. <%= _("Configure the appearence of your site with your own stylesheet or with your company's banner") %>.</p>
  457. - </div>
  458. -
  459. -</div>
  460. -
  461. -<div class="cut"></div>
  462. + <div class="summary_section">
  463. + <div class="ico">
  464. + <%= link_to image_tag("admin/ico_admin-configure.gif"), :action=>"general", :title=>_("General: More Details")%>
  465. + </div>
  466. + <div class="more_link">
  467. + <%= link_to _("More"), :action=>"general" %><span>></span>
  468. + </div>
  469. + <div class="summary_body">
  470. + <h1><%= link_to _("General"), :action=>"general", :title=>_("General: More Details")%></h1>
  471. + <p><%= _("Change your space name, url or description")%>. <%= _("Configure the appearence of your site with your own stylesheet or with your company's banner") %>.</p>
  472. + </div>
  473. +
  474. + </div>
  475. +
  476. + <div class="cut"></div>
  477.  
  478. </div>
  479. <br />
  480. <div id="delete_page">
  481. - <div id="buttonm">
  482. - <div id="btn-inner">
  483. - <%= link_to content_tag('em', image_tag("remove.gif") + _('Delete this space')), space_path(@space.id), :method => :delete,
  484. + <div id="buttonm">
  485. + <div id="btn-inner">
  486. + <%= link_to content_tag('em', image_tag("remove.gif") + _('Delete this space')), space_path(@space.id), :method => :delete,
  487. :confirm =>_("Are you sure you want to delete this Space?") %>
  488. - </div>
  489. - </div>
  490. + </div>
  491. + </div>
  492.  
  493.  
  494. - </div>
  495. +</div>
  496.  
  497. - <span class="warning">
  498. - <strong><%= _("Warning")%>:</strong> <%= _("All your space and tools data will be lost if you remove your space")%>.
  499. +<span class="warning">
  500. + <strong><%= _("Warning")%>:</strong> <%= _("All your space and tools data will be lost if you remove your space")%>.
  501.  
  502. - </span>
  503. +</span>
  504.  
  505.  
  506.  
  507. @@ -207,6 +209,6 @@
  508.  
  509. <!--
  510. <%=link_to(_("Delete this space")+"...", space_path(@space.id),
  511. - :method => :delete, :class => 'button',
  512. - :confirm =>_("Are you sure you want to delete this Space?")) %>&nbsp;&nbsp;&nbsp;<small><strong>Warning:</strong> All your space and tools data will be lost if you remove your space.</small>
  513. - -->
  514. + :method => :delete, :class => 'button',
  515. + :confirm =>_("Are you sure you want to delete this Space?")) %>&nbsp;&nbsp;&nbsp;<small><strong>Warning:</strong> All your space and tools data will be lost if you remove your space.</small>
  516. +-->
  517. diff --git a/app/views/spaces/admin/security.rhtml b/app/views/spaces/admin/security.rhtml
  518. index d8ff070..6ebfb32 100644
  519. --- a/app/views/spaces/admin/security.rhtml
  520. +++ b/app/views/spaces/admin/security.rhtml
  521. @@ -1,3 +1,4 @@
  522. +
  523. <div class="new-form">
  524. <div class="security-page">
  525. <% space_page_title _("Security") %>
  526. @@ -24,12 +25,19 @@
  527. </fieldset>
  528.  
  529. <fieldset>
  530. - <h5><%= _("Member access")%></h5>
  531. + <h5><%= _("Team Member access")%></h5>
  532. <label><%= _("Allow")%> <%= select 'space', 'team_permissions', Space::PERMISSION_SELECTOR_TEAM, {}, {:style=>"width:75px"} %> <%= _("for team member access")%>.</label>
  533. <p class="tip"><%= _("Choose how members of your team will be able to access your space")%>.</p>
  534. </fieldset>
  535.  
  536. <fieldset>
  537. + <h5><%= _("Watcher access")%></h5>
  538. + <label><%= _("Allow")%> <%= select 'space', 'watcher_permissions', Space::PERMISSION_SELECTOR_WATCHER, {}, {:style=>"width:75px"} %> <%= _("for team member access")%>.</label>
  539. + <p class="tip"><%= _("Watchers can be customers or other observers")%>.</p>
  540. + </fieldset>
  541. +
  542. +
  543. + <fieldset>
  544. <legend><%= _("Allowed IP addresses to connect to space tools")%>.</legend>
  545. <%= text_area('space', 'allowed_ips', :rows => 4, :cols => 40)%>
  546. <p class="tip"><%= _("Enter one IP per line. (Commercial spaces only)")%></p>
  547. @@ -39,4 +47,4 @@
  548. <%end%>
  549. </div>
  550. </div>
  551. -</div>
  552. \ No newline at end of file
  553. +</div>
  554. diff --git a/test/fixtures/space_tools.yml b/test/fixtures/space_tools.yml
  555. index 4f449d6..e9eeab0 100644
  556. --- a/test/fixtures/space_tools.yml
  557. +++ b/test/fixtures/space_tools.yml
  558. @@ -153,6 +153,19 @@ gz_milestone_tool:
  559. type: MilestoneTool
  560. tool_id: <%= MilestoneTool::ID %>
  561.  
  562. +watcher_private_space_ticket_tool:
  563. + space_id: 3300
  564. + active: 1
  565. + secret_key: "watcher maiden name"
  566. + type: TicketTool
  567. + tool_id: <%= TicketTool::ID %>
  568. + settings: |
  569. + ---
  570. + :alert_strategy: "<%=TicketTool::ALERT_LIST%>"
  571. + :components:
  572. + :new_id: 0
  573. + :email2tickets: <%= Space::MESSAGES_FROM_MEMBERS %>
  574. +
  575. gz_chat_tool:
  576. space: gizmo_space
  577. active: 1
  578. diff --git a/test/fixtures/spaces.yml b/test/fixtures/spaces.yml
  579. index 14838b7..bf01ae7 100644
  580. --- a/test/fixtures/spaces.yml
  581. +++ b/test/fixtures/spaces.yml
  582. @@ -268,3 +268,12 @@ chart_space:
  583. team_permissions: <%= Space::PERMISSION_EDIT %>
  584. created_at: 2007-05-30 23:47
  585. commercial_from: 2008-10-24 00:47
  586. +
  587. +watcher_private_space:
  588. + id: '3300'
  589. + name: 'Watcher Private Space'
  590. + public_permissions: <%= Space::PERMISSION_NONE %>
  591. + wiki_name: 'privatespace'
  592. + created_at: 2006-06-24 23:47
  593. + commercial_from: 2008-10-24 00:47
  594. + watcher_permissions: <%= Space::PERMISSION_VIEW %>
  595. diff --git a/test/fixtures/user_roles.yml b/test/fixtures/user_roles.yml
  596. index 8435360..b0d2701 100644
  597. --- a/test/fixtures/user_roles.yml
  598. +++ b/test/fixtures/user_roles.yml
  599. @@ -91,13 +91,10 @@ public_none_member:
  600.  
  601. spacebob:
  602. id: 3
  603. - user_id: 1000006 # spacebob
  604. + user_id: 1000001 # bob
  605. role: <%=UserRole::ROLE_WATCHER%>
  606. - space_id: 1 # first_space
  607. + space_id: 3300
  608. status: <%= UserRole::ACCEPTED %>
  609. - alert_volume: <%= UserRole::FRQ_REALTIME %>
  610. - alert_settings: !map:UserRole::AlertSettings
  611. - team: true
  612.  
  613. two_days_ago:
  614. id: 4
  615. @@ -107,6 +104,15 @@ two_days_ago:
  616. space_id: 11
  617. invited_time: <%= 2.days.ago.to_s :db %>
  618.  
  619. +private_watcher:
  620. + user_id: 1000006 # spacebob
  621. + role: <%=UserRole::ROLE_WATCHER%>
  622. + space_id: 1 # first_space
  623. + status: <%= UserRole::ACCEPTED %>
  624. + alert_volume: <%= UserRole::FRQ_REALTIME %>
  625. + alert_settings: !map:UserRole::AlertSettings
  626. + team: true
  627. +
  628. four_days_ago:
  629. id: 5
  630. user_id: 2000002
  631. diff --git a/test/fixtures/wiki_pages.yml b/test/fixtures/wiki_pages.yml
  632. index ac0740d..a40abf4 100644
  633. --- a/test/fixtures/wiki_pages.yml
  634. +++ b/test/fixtures/wiki_pages.yml
  635. @@ -102,3 +102,11 @@ page4print:
  636. user_id: 1000001
  637. created_at: 2005-11-11 23:30
  638. updated_at: 2005-11-11 23:00
  639. +
  640. +gz_watch:
  641. + version: 1
  642. + space: watcher_private_space
  643. + page_name: FirstPage
  644. + is_visible: true
  645. + contents: Camel Case should work properly
  646. + user: gizmo
  647. diff --git a/test/functional/spaces/tickets_controller_test.rb b/test/functional/spaces/tickets_controller_test.rb
  648. index e4423d0..b521c35 100644
  649. --- a/test/functional/spaces/tickets_controller_test.rb
  650. +++ b/test/functional/spaces/tickets_controller_test.rb
  651. @@ -215,6 +215,20 @@ class Spaces::TicketsControllerTest < Test::Unit::TestCase
  652. assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<component type=\"array\">\n <component>\n <name>UI Design</name>\n <id type=\"integer\">0</id>\n </component>\n <component>\n <name>TracTool</name>\n <id type=\"integer\">1</id>\n </component>\n</component>\n", @response.body
  653.  
  654. end
  655.  
  656.  
  657.  
  658. + def test_new_watcher_deny_create
  659.  
  660. + space = spaces(:watcher_private_space)
  661.  
  662. + get :new, :id => space.id
  663.  
  664. + assert_response :redirect
  665.  
  666. + assert_redirected_to 'not_permitted'
  667.  
  668. + end
  669.  
  670. +
  671.  
  672. + def test_new_watcher_allow_access
  673.  
  674. + space = spaces(:watcher_private_space)
  675.  
  676. + get :index, :id => space.id
  677.  
  678. + assert_response :success
  679.  
  680. + assert_template 'index'
  681.  
  682. + end
  683.  
  684. +
  685.  
  686. def create_component(name)
  687.  
  688. post :create_component, :space_id => @space.id, :format => 'xml', :component_name => name
  689.  
  690. end
  691.  
  692. @@ -251,17 +265,17 @@ class Spaces::TicketsControllerTest < Test::Unit::TestCase
  693.  
  694.  
  695. assert_equal Space::MESSAGES_FROM_MEMBERS, tool.settings_hash[:email2tickets]
  696.  
  697. end
  698.  
  699. -
  700.  
  701. +
  702.  
  703. def test_export
  704.  
  705. logged_in_as_gizmo
  706.  
  707. -
  708.  
  709. +
  710.  
  711. post :export, :space_id => @space.id
  712.  
  713. assert_response :success
  714.  
  715. -
  716.  
  717. +
  718.  
  719. file = @response.body
  720.  
  721. -
  722.  
  723. +
  724.  
  725. assert_not_nil file
  726.  
  727. -
  728.  
  729. +
  730.  
  731. assert file.include?("tickets:fields")
  732.  
  733. end
  734.  
  735.  
  736.  
  737. @@ -277,7 +291,7 @@ class Spaces::TicketsControllerTest < Test::Unit::TestCase
  738.  
  739.  
  740. def test_should_clear_existing_tickets_and_import
  741.  
  742. logged_in_as_gizmo
  743.  
  744. -
  745.  
  746. +
  747.  
  748. file = fixture_file_upload("files/#{@space.wiki_name}.bak")
  749.  
  750.  
  751.  
  752. post :import, :space_id => @space.id, :tickets => "clear", :file => file
  753.  
  754. @@ -286,18 +300,18 @@ class Spaces::TicketsControllerTest < Test::Unit::TestCase
  755. end
  756.  
  757.  
  758.  
  759. def test_import
  760.  
  761. -
  762.  
  763. +
  764.  
  765. file = fixture_file_upload("files/gizmo.bak")
  766.  
  767. @space = spaces(:public_none)
  768.  
  769. post :import, :space_id => @space.id, :tickets => "add", :file => file
  770.  
  771. assert_flash :notice, "Tickets imported successfully."
  772.  
  773. - assert_response :redirect
  774.  
  775. + assert_response :redirect
  776.  
  777. end
  778.  
  779. -
  780.  
  781. +
  782.  
  783. def logged_in_as_gizmo
  784.  
  785. @request.session[:user] = nil
  786.  
  787. login_user :gizmo
  788.  
  789. @space = spaces :gizmo_space
  790.  
  791. end
  792.  
  793. -
  794.  
  795. +
  796.  
  797. end
  798.  
  799. diff --git a/test/functional/spaces_controller_test.rb b/test/functional/spaces_controller_test.rb
  800. index 65d80cb..cde5467 100644
  801. --- a/test/functional/spaces_controller_test.rb
  802. +++ b/test/functional/spaces_controller_test.rb
  803. @@ -760,6 +760,12 @@ class SpacesControllerTest < Test::Unit::TestCase
  804. get_action :my_spaces
  805. end
  806.  
  807. + def test_watcher_access
  808. + login_user :bob
  809. + space = spaces(:watcher_private_space)
  810. + get
  811. + end
  812. +
  813. def test_ssl
  814. begin
  815. UserSystem::CONFIG[:https] = true
Add Comment
Please, Sign In to add comment