Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/app/controllers/application.rb b/app/controllers/application.rb
- index fc14cae..2bee502 100644
- --- a/app/controllers/application.rb
- +++ b/app/controllers/application.rb
- @@ -137,7 +137,6 @@ class ApplicationController < ActionController::Base
- def validate_tool(tool_id)
- @space_tool = _space_tool(tool_id)
- -
- if !@space_tool
- permission_redirect
- return false
- diff --git a/app/helpers/spaces/users_helper.rb b/app/helpers/spaces/users_helper.rb
- index 1973f4e..d244c9d 100644
- --- a/app/helpers/spaces/users_helper.rb
- +++ b/app/helpers/spaces/users_helper.rb
- @@ -9,7 +9,8 @@ module Spaces::UsersHelper
- if user_role.owner?
- links << demote_link(@space.id, user_role.id) if count_owners > 1 && user_role.user!=current_user
- else
- - links << demote_link(@space.id, user_role.id) if (@space.public? ? !user_role.watcher? : !user_role.member?)
- + # This will allow the demote link not to work on watcher users. ie. watchers can not be demoted at the moment.
- + links << demote_link(@space.id, user_role.id) if !user_role.watcher?
- end
- links << remind_link(user_role.user) if user_role.status == UserRole::INVITED
- diff --git a/app/helpers/spaces_helper.rb b/app/helpers/spaces_helper.rb
- index 310233b..c5368ac 100644
- --- a/app/helpers/spaces_helper.rb
- +++ b/app/helpers/spaces_helper.rb
- @@ -111,6 +111,25 @@ module SpacesHelper
- end
- end
- + # This method can be used to generate the user roles radio button.
- + # The parameter role can be set to any particular role vaule, and according to this parameter, the appropriate radio button gets selected.
- + def user_role_radio_fields(role = "")
- + member_checked = ""
- + owner_checked = ""
- + watcher_checked = ""
- + if role == UserRole::ROLE_OWNER
- + owner_checked = "checked"
- + elsif role == UserRole::ROLE_WATCHER
- + watcher_checked = "checked"
- + else
- + member_checked = "checked"
- + end
- + html = "<label><input type='radio' id='rowner' name='role' value='#{UserRole::ROLE_OWNER}' #{owner_checked}> #{_("Owner")}</label>"
- + html += "<label><input type='radio' id='rmember' name='role' value='#{UserRole::ROLE_MEMBER}' #{member_checked}> #{_("Member")}</label>"
- + html += "<label><input type='radio' id='rwatcher' name='role' value='#{UserRole::ROLE_WATCHER}' #{watcher_checked}> #{_("Watcher")}</label>"
- + html
- + end
- +
- def role_header
- perm = @space.get_permission(current_user)
- permdesc = "You have #{Space::PERMISSION_NAMES[perm].downcase} permission in this space"
- diff --git a/app/models/space.rb b/app/models/space.rb
- index 650a6be..d93df15 100644
- --- a/app/models/space.rb
- +++ b/app/models/space.rb
- @@ -165,6 +165,7 @@ class Space < ActiveRecord::Base
- PERMISSION_SELECTOR_PUBLIC = Array.new(PERMISSION_SELECTOR[0..-2]).freeze
- PERMISSION_SELECTOR_TEAM = Array.new(PERMISSION_SELECTOR[1..-1]).freeze
- + PERMISSION_SELECTOR_WATCHER = Array.new(PERMISSION_SELECTOR[1..1]).freeze
- # Values for the spaces_spaces relationships. This list will be added to.
- RELATION_NAMES = ['TRUSTS']
- @@ -297,8 +298,13 @@ class Space < ActiveRecord::Base
- rez = self.team_permissions
- role = UserRole::ROLE_MEMBER
- else
- - # role = UserRole::ROLE_WATCHER
- - rez = self.public_permissions
- + if user_roles.detect{|ur| ur['role'].to_i >= UserRole::ROLE_WATCHER }
- + # Watcher user
- + rez = self.watcher_permissions
- + role = UserRole::ROLE_WATCHER
- + else
- + rez = self.public_permissions
- + end
- end
- end
- end
- @@ -486,11 +492,8 @@ AND (user_roles.space_id = #{con.quote self.id}
- errors.add(:user_roles, _("%{fn} Cannot demote the only owner of the space"))
- end
- when UserRole::ROLE_MEMBER
- - if self.public_permissions == PERMISSION_NONE
- - errors.add(:user_roles, _("%{fn} Cannot set user role to watcher when the space is set to private"))
- - else
- - user_role.role = UserRole::ROLE_WATCHER
- - end
- + #We can change the permission level from both public and private space
- + user_role.role = UserRole::ROLE_WATCHER
- end
- end
- user_role.save if errors.empty?
- diff --git a/app/views/spaces/_invitationform.rhtml b/app/views/spaces/_invitationform.rhtml
- index b783138..6b21cb8 100644
- --- a/app/views/spaces/_invitationform.rhtml
- +++ b/app/views/spaces/_invitationform.rhtml
- @@ -10,10 +10,10 @@
- <fieldset>
- - <label><%= _("E-mail address")%></label>
- + <label><%= _("E-mail address")%></label>
- <input name="email" type="text" class="textbox" size="40" value="<%=h params[:searchfor] %>"/>
- - <label><%= _("Invitation message")%></label>
- + <label><%= _("Invitation message")%></label>
- <textarea cols="40" rows="6" name="message"><%=h params[:message] %></textarea>
- </fieldset>
- @@ -22,17 +22,9 @@
- <legend><%= _("Role")%>
- </legend>
- -
- - <% if params[:role] == UserRole::ROLE_OWNER
- - memberChecked = ""
- - ownerChecked = "checked"
- - else
- - memberChecked = "checked"
- - end %>
- -
- - <label><input type="radio" id="rmember" name="role" value="<%= UserRole::ROLE_MEMBER %>" <%= memberChecked %>> <%= _("Member")%></label>
- - <label><input type="radio" id="rowner" name="role" value="<%= UserRole::ROLE_OWNER %>" <%= ownerChecked %>> <%= _("Owner")%></label>
- -
- + <%= user_role_radio_fields(params[:role]) %>
- +
- +
- </fieldset>
- <%= submit_tag _('Invite User'), :class=>"button" %> or <%= link_to_remote(_("Cancel"), :update => "teamlist", :url => { :controller=>"spaces", :action=>"reload_teamlist", :space_id=>@space.id }) %>
- diff --git a/app/views/spaces/admin/index.rhtml b/app/views/spaces/admin/index.rhtml
- index 929c4c7..c30e2b7 100644
- --- a/app/views/spaces/admin/index.rhtml
- +++ b/app/views/spaces/admin/index.rhtml
- @@ -3,203 +3,205 @@
- <%= stylesheet_link_tag 'admin_upgrade' %>
- <div id="space_settings"></div>
- <% if is_site_admin? %>
- - <div style="text-align:right">
- - <%= link_to _("Admin Setting"), :action=>"admin" %>
- - </div>
- + <div style="text-align:right">
- + <%= link_to _("Admin Setting"), :action=>"admin" %>
- + </div>
- <% end %>
- <% if !@space.is_commercial? && @space.is_private? %>
- -<div class="summary-wrap-red">
- -
- -<div class="summary_section">
- - <div class="ico">
- - <a href="<%=url_for :action=>"security"%>" title="<%= _("Upgrade: More Details")%>">
- - <%= image_tag("admin/ico_admin-upgrade.gif",:border=>0) %>
- - </a>
- - </div>
- - <div class="more_link">
- - <%= link_to _("More"), :action=>"upgrade" %><span>></span>
- - </div>
- - <div class="summary_body main-features bg_red">
- - <h1><a href="<%=url_for :action => "upgrade"%>" title="<%= _("Uprade: More Details")%>"><%= _('Upgrade')%></a></h1>
- - <p>
- - <%= _("You are an owner of this space, which is private and free.") %>.
- - <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.
- - 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.
- - </p>
- - <p>
- - <div class="mf-button">
- - <div id="mfbutton">
- - <div id="mfbtn-inner" style="white-space:nowrap">
- - <%= 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) %>
- - </div>
- - </div>
- - </div>
- - <div class="mf-or-cancel"> <%=_("or") %> <%= link_to _("Make this space public"), make_public_space_path(@space), :method => :put%></div>
- - </p>
- - </div>
- + <div class="summary-wrap-red">
- -</div>
- + <div class="summary_section">
- + <div class="ico">
- + <%= link_to image_tag("admin/ico_admin-upgrade.gif"), :action=>"security", :title=>_("Upgrade: More Details")%>
- + </div>
- + <div class="more_link">
- + <%= link_to _("More"), :action=>"upgrade" %><span>></span>
- + </div>
- + <div class="summary_body main-features bg_red">
- + <h1>
- + <%= link_to _('Upgrade'), :action => "upgrade", :title=>_("Uprade: More Details")%>
- + </h1>
- + <p>
- + <%= _("You are an owner of this space, which is private and free.") %>.
- + <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.
- + 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.
- + </p>
- + <p>
- + <div class="mf-button">
- + <div id="mfbutton">
- + <div id="mfbtn-inner" style="white-space:nowrap">
- + <%= 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) %>
- + </div>
- + </div>
- + </div>
- + <div class="mf-or-cancel"> <%=_("or") %> <%= link_to _("Make this space public"), make_public_space_path(@space), :method => :put%></div>
- + </p>
- + </div>
- -<div class="cut"></div>
- + </div>
- -</div>
- + <div class="cut"></div>
- +
- + </div>
- <%end%>
- <div class="summary-wrap">
- -<div class="summary_section">
- - <div class="ico">
- - <a href="<%=url_for :action=>"tools"%>" title="<%= _("Tools: More Details")%>">
- - <%= image_tag("admin/ico_admin-tools.gif",:border=>0) %>
- - </a>
- - </div>
- - <div class="more_link">
- - <%= link_to _("More"), :action=>"tools" %><span>></span>
- - </div>
- - <div class="summary_body">
- - <h1><a href="<%=url_for :action=>"tools"%>" title="<%= _("Tools: More Details")%>"><%= _("Tools")%></a></h1>
- - <p><%= _("Configure or Install new")%> <strong><%= _("On-Demand Tools")%></strong></p>
- - <p style="margin-top:5px">
- - <strong><%= _("Installed Tools")%>:</strong>
- + <div class="summary_section">
- + <div class="ico">
- + <%= link_to image_tag("admin/ico_admin-tools.gif"), :action=>"tools", :title=>_("Tools: More Details")%>
- + </div>
- + <div class="more_link">
- + <%= link_to _("More"), :action=>"tools" %><span>></span>
- + </div>
- + <div class="summary_body">
- + <h1>
- + <%= link_to _("Tools"), :action=>"tools", :title=>_("Tools: More Details")%>
- + </h1>
- + <p><%= _("Configure or Install new")%> <strong><%= _("On-Demand Tools")%></strong></p>
- + <p style="margin-top:5px">
- + <strong><%= _("Installed Tools")%>:</strong>
- <%if @installed_tools.empty? %>
- - <em><%= _("You don't have any tools yet")%></em>
- - </p>
- - <%else%>
- - </p>
- - <ul id="tool_list">
- - <% @installed_tools.each do |t| %>
- - <li><%= tool_full_title(t) %></li>
- - <% end %>
- - </ul>
- - <%end%>
- - </div>
- -
- -</div>
- -
- -<div class="cut"></div>
- + <em><%= _("You don't have any tools yet")%></em>
- + </p>
- + <%else%>
- + </p>
- + <ul id="tool_list">
- + <% @installed_tools.each do |t| %>
- + <li><%= tool_full_title(t) %></li>
- + <% end %>
- + </ul>
- + <%end%>
- + </div>
- +
- + </div>
- +
- + <div class="cut"></div>
- </div>
- <div class="summary-wrap">
- -<div class="summary_section">
- - <div class="ico">
- - <a href="<%=url_for :action=>"security"%>" title="<%= _("Security: More Details")%>">
- - <%= image_tag("admin/ico_admin-access.gif",:border=>0) %>
- - </a>
- - </div>
- - <div class="more_link">
- - <%= link_to _("More"), :action=>"security" %><span>></span>
- - </div>
- - <div class="summary_body">
- -
- - <% form_tag space_path(@edit), :method=>:put do%>
- -<h1><a href="<%=url_for :action=>"security"%>" title="<%= _("Security: More Details")%>">
- - <%= _("Security")%>
- - </a></h1>
- -
- - <p>
- - <strong><%= _("Non-member access")%>:</strong>
- - <label class="inline"><%= _("Allow")%> <%= select 'space', 'public_permissions', @space.public_permission_selector(true), {}, {:style=>"width:75px",
- - :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
- - :with => 'Form.Element.serialize(this)')} %> <%= _("for public access")%>.</label>
- - </p>
- - <p>
- - <strong><%= _("Member access")%>:</strong>
- - <label class="inline"><%= _("Allow")%> <%= select 'space', 'team_permissions', Space::PERMISSION_SELECTOR_TEAM, {}, {:style=>"width:75px",
- - :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
- - :with => 'Form.Element.serialize(this)')} %> <%= _("for team member access")%>.</label>
- - </p>
- - <%if !@space.is_commercial? %>
- - <p style="font-size:smaller">
- - <%= _("You can't set the")%> <strong> <%= _("Non-member access")%></strong> <%= _("to")%> <strong> <%= _("None")%> </strong> <%= _("because your space is not Commercial")%>.
- - <%= _("If you want to have a private space you will need to")%> <%= link_to _("upgrade"), :action=>"upgrade"%>.
- - </p>
- - <%end%>
- - <%end%>
- - </div>
- + <div class="summary_section">
- + <div class="ico">
- + <%= link_to image_tag("admin/ico_admin-access.gif"), :action=>"security", :title=>_("Security: More Details")%>
- + </div>
- + <div class="more_link">
- + <%= link_to _("More"), :action=>"security" %><span>></span>
- + </div>
- + <div class="summary_body">
- +
- + <% form_tag space_path(@edit), :method=>:put do%>
- + <h1><%= link_to _("Security"), :action=>"security", :title => _("Security: More Details")%></h1>
- +
- + <p>
- + <strong><%= _("Non-member access")%>:</strong>
- + <label class="inline"><%= _("Allow")%> <%= select 'space', 'public_permissions', @space.public_permission_selector(true), {}, {:style=>"width:75px",
- + :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
- + :with => 'Form.Element.serialize(this)')} %> <%= _("for public access")%>.</label>
- + </p>
- + <p>
- + <strong><%= _("Watcher access:")%>:</strong>
- + <label class="inline"><%= _("Allow")%> <%= select 'space', 'watcher_permissions', Space::PERMISSION_SELECTOR_WATCHER, {}, {:style=>"width:75px",
- + :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
- + :with => 'Form.Element.serialize(this)')} %> <%= _("for watcher access")%>.</label>
- + </p>
- + <p>
- + <strong><%= _("Team Member access")%>:</strong>
- + <label class="inline"><%= _("Allow")%> <%= select 'space', 'team_permissions', Space::PERMISSION_SELECTOR_TEAM, {}, {:style=>"width:75px",
- + :onchange=> "javascript:"+remote_function(:url => space_path(@space), :method=>:put,
- + :with => 'Form.Element.serialize(this)')} %> <%= _("for team member access")%>.</label>
- + </p>
- + <%if !@space.is_commercial? %>
- + <p style="font-size:smaller">
- + <%= _("You can't set the")%> <strong> <%= _("Non-member access")%></strong> <%= _("to")%> <strong> <%= _("None")%> </strong> <%= _("because your space is not Commercial")%>.
- + <%= _("If you want to have a private space you will need to")%> <%= link_to _("upgrade"), :action=>"upgrade"%>.
- + </p>
- + <%end%>
- + <%end%>
- + </div>
- -</div>
- + </div>
- -<div class="cut"></div>
- + <div class="cut"></div>
- </div>
- <div class="summary-wrap">
- -<div class="summary_section">
- - <div class="ico">
- - <a href="<%=url_for :action=>"resources"%>" title="<%= _("Resources: More Details")%>">
- - <%= image_tag("admin/ico_admin-resources.gif",:border=>0) %>
- - </a>
- - </div>
- - <div class="more_link">
- - <%= link_to _("More"), :action=>"resources" %><span>></span>
- - </div>
- - <div class="summary_body">
- - <h1><a href="<%=url_for :action=>"resources"%>" title="<%= _("Resources: More Details")%>"><%= _("Resources")%></a></h1>
- -
- - <%if @space.is_commercial? %>
- - <% if @space.payer %>
- - <p><strong><%= _("Payer")%>:</strong> <%= @space.payer.permissioned_name(logged_user) %></p>
- - <%end%>
- - <p>
- - <strong><%= _("Disk Space Usage")%>:</strong> <%=number_to_human_size(@total)%>
- - <span style="margin-left:50px"><strong>Team Size:</strong> <%= pluralize(@space.user_roles.count,"member","members")%></span>
- - </p>
- - <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>
- - <%else%>
- -
- - <% unless @no_billing %>
- - <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>
- - <% end %>
- - <p> <strong><%= _("Disk Space Usage")%>:</strong> <%=number_to_human_size(@total)%> of <%= quota_limit_color @total, @space.max_disk_quota %> </p>
- - <%end%>
- - </div>
- + <div class="summary_section">
- + <div class="ico">
- + <%= link_to image_tag("admin/ico_admin-resources.gif"), :action=>"resources", :title =>_("Resources: More Details") %>
- + </div>
- + <div class="more_link">
- + <%= link_to _("More"), :action=>"resources" %><span>></span>
- + </div>
- + <div class="summary_body">
- + <h1>
- + <%= link_to _("Resources"), :action => "resources", :title=> _("Resources: More Details")%>
- + </h1>
- +
- + <%if @space.is_commercial? %>
- + <% if @space.payer %>
- + <p><strong><%= _("Payer")%>:</strong> <%= @space.payer.permissioned_name(logged_user) %></p>
- + <%end%>
- + <p>
- + <strong><%= _("Disk Space Usage")%>:</strong> <%=number_to_human_size(@total)%>
- + <span style="margin-left:50px"><strong>Team Size:</strong> <%= pluralize(@space.user_roles.count,"member","members")%></span>
- + </p>
- + <p><b><%= _("To get support")%></b>, <%= _("email")%>
- + <%=mail_to("#{UserSystem::CONFIG[:service_support_email]}",UserSystem::CONFIG[:service_support_email])%> <%= _("or call")%> <%= UserSystem::CONFIG[:service_support_phone] %></p>
- + <%else%>
- + <% unless @no_billing %>
- + <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>
- + <% end %>
- + <p> <strong><%= _("Disk Space Usage")%>:</strong> <%=number_to_human_size(@total)%> of <%= quota_limit_color @total, @space.max_disk_quota %> </p>
- + <%end%>
- + </div>
- -</div>
- -<div class="cut"></div>
- + </div>
- +
- + <div class="cut"></div>
- </div>
- <div class="summary-wrap">
- -<div class="summary_section">
- - <div class="ico">
- - <a href="<%=url_for :action=>"general"%>" title="<%= _("General: More Details")%>">
- - <%= image_tag("admin/ico_admin-configure.gif",:border=>0) %>
- - </a>
- - </div>
- - <div class="more_link">
- - <%= link_to _("More"), :action=>"general" %><span>></span>
- - </div>
- - <div class="summary_body">
- - <h1><a href="<%=url_for :action=>"general"%>" title="<%= _("General: More Details")%>">General</a></h1>
- - <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>
- - </div>
- -
- -</div>
- -
- -<div class="cut"></div>
- + <div class="summary_section">
- + <div class="ico">
- + <%= link_to image_tag("admin/ico_admin-configure.gif"), :action=>"general", :title=>_("General: More Details")%>
- + </div>
- + <div class="more_link">
- + <%= link_to _("More"), :action=>"general" %><span>></span>
- + </div>
- + <div class="summary_body">
- + <h1><%= link_to _("General"), :action=>"general", :title=>_("General: More Details")%></h1>
- + <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>
- + </div>
- +
- + </div>
- +
- + <div class="cut"></div>
- </div>
- <br />
- <div id="delete_page">
- - <div id="buttonm">
- - <div id="btn-inner">
- - <%= link_to content_tag('em', image_tag("remove.gif") + _('Delete this space')), space_path(@space.id), :method => :delete,
- + <div id="buttonm">
- + <div id="btn-inner">
- + <%= link_to content_tag('em', image_tag("remove.gif") + _('Delete this space')), space_path(@space.id), :method => :delete,
- :confirm =>_("Are you sure you want to delete this Space?") %>
- - </div>
- - </div>
- + </div>
- + </div>
- - </div>
- +</div>
- - <span class="warning">
- - <strong><%= _("Warning")%>:</strong> <%= _("All your space and tools data will be lost if you remove your space")%>.
- +<span class="warning">
- + <strong><%= _("Warning")%>:</strong> <%= _("All your space and tools data will be lost if you remove your space")%>.
- - </span>
- +</span>
- @@ -207,6 +209,6 @@
- <!--
- <%=link_to(_("Delete this space")+"...", space_path(@space.id),
- - :method => :delete, :class => 'button',
- - :confirm =>_("Are you sure you want to delete this Space?")) %> <small><strong>Warning:</strong> All your space and tools data will be lost if you remove your space.</small>
- - -->
- + :method => :delete, :class => 'button',
- + :confirm =>_("Are you sure you want to delete this Space?")) %> <small><strong>Warning:</strong> All your space and tools data will be lost if you remove your space.</small>
- +-->
- diff --git a/app/views/spaces/admin/security.rhtml b/app/views/spaces/admin/security.rhtml
- index d8ff070..6ebfb32 100644
- --- a/app/views/spaces/admin/security.rhtml
- +++ b/app/views/spaces/admin/security.rhtml
- @@ -1,3 +1,4 @@
- +
- <div class="new-form">
- <div class="security-page">
- <% space_page_title _("Security") %>
- @@ -24,12 +25,19 @@
- </fieldset>
- <fieldset>
- - <h5><%= _("Member access")%></h5>
- + <h5><%= _("Team Member access")%></h5>
- <label><%= _("Allow")%> <%= select 'space', 'team_permissions', Space::PERMISSION_SELECTOR_TEAM, {}, {:style=>"width:75px"} %> <%= _("for team member access")%>.</label>
- <p class="tip"><%= _("Choose how members of your team will be able to access your space")%>.</p>
- </fieldset>
- <fieldset>
- + <h5><%= _("Watcher access")%></h5>
- + <label><%= _("Allow")%> <%= select 'space', 'watcher_permissions', Space::PERMISSION_SELECTOR_WATCHER, {}, {:style=>"width:75px"} %> <%= _("for team member access")%>.</label>
- + <p class="tip"><%= _("Watchers can be customers or other observers")%>.</p>
- + </fieldset>
- +
- +
- + <fieldset>
- <legend><%= _("Allowed IP addresses to connect to space tools")%>.</legend>
- <%= text_area('space', 'allowed_ips', :rows => 4, :cols => 40)%>
- <p class="tip"><%= _("Enter one IP per line. (Commercial spaces only)")%></p>
- @@ -39,4 +47,4 @@
- <%end%>
- </div>
- </div>
- -</div>
- \ No newline at end of file
- +</div>
- diff --git a/test/fixtures/space_tools.yml b/test/fixtures/space_tools.yml
- index 4f449d6..e9eeab0 100644
- --- a/test/fixtures/space_tools.yml
- +++ b/test/fixtures/space_tools.yml
- @@ -153,6 +153,19 @@ gz_milestone_tool:
- type: MilestoneTool
- tool_id: <%= MilestoneTool::ID %>
- +watcher_private_space_ticket_tool:
- + space_id: 3300
- + active: 1
- + secret_key: "watcher maiden name"
- + type: TicketTool
- + tool_id: <%= TicketTool::ID %>
- + settings: |
- + ---
- + :alert_strategy: "<%=TicketTool::ALERT_LIST%>"
- + :components:
- + :new_id: 0
- + :email2tickets: <%= Space::MESSAGES_FROM_MEMBERS %>
- +
- gz_chat_tool:
- space: gizmo_space
- active: 1
- diff --git a/test/fixtures/spaces.yml b/test/fixtures/spaces.yml
- index 14838b7..bf01ae7 100644
- --- a/test/fixtures/spaces.yml
- +++ b/test/fixtures/spaces.yml
- @@ -268,3 +268,12 @@ chart_space:
- team_permissions: <%= Space::PERMISSION_EDIT %>
- created_at: 2007-05-30 23:47
- commercial_from: 2008-10-24 00:47
- +
- +watcher_private_space:
- + id: '3300'
- + name: 'Watcher Private Space'
- + public_permissions: <%= Space::PERMISSION_NONE %>
- + wiki_name: 'privatespace'
- + created_at: 2006-06-24 23:47
- + commercial_from: 2008-10-24 00:47
- + watcher_permissions: <%= Space::PERMISSION_VIEW %>
- diff --git a/test/fixtures/user_roles.yml b/test/fixtures/user_roles.yml
- index 8435360..b0d2701 100644
- --- a/test/fixtures/user_roles.yml
- +++ b/test/fixtures/user_roles.yml
- @@ -91,13 +91,10 @@ public_none_member:
- spacebob:
- id: 3
- - user_id: 1000006 # spacebob
- + user_id: 1000001 # bob
- role: <%=UserRole::ROLE_WATCHER%>
- - space_id: 1 # first_space
- + space_id: 3300
- status: <%= UserRole::ACCEPTED %>
- - alert_volume: <%= UserRole::FRQ_REALTIME %>
- - alert_settings: !map:UserRole::AlertSettings
- - team: true
- two_days_ago:
- id: 4
- @@ -107,6 +104,15 @@ two_days_ago:
- space_id: 11
- invited_time: <%= 2.days.ago.to_s :db %>
- +private_watcher:
- + user_id: 1000006 # spacebob
- + role: <%=UserRole::ROLE_WATCHER%>
- + space_id: 1 # first_space
- + status: <%= UserRole::ACCEPTED %>
- + alert_volume: <%= UserRole::FRQ_REALTIME %>
- + alert_settings: !map:UserRole::AlertSettings
- + team: true
- +
- four_days_ago:
- id: 5
- user_id: 2000002
- diff --git a/test/fixtures/wiki_pages.yml b/test/fixtures/wiki_pages.yml
- index ac0740d..a40abf4 100644
- --- a/test/fixtures/wiki_pages.yml
- +++ b/test/fixtures/wiki_pages.yml
- @@ -102,3 +102,11 @@ page4print:
- user_id: 1000001
- created_at: 2005-11-11 23:30
- updated_at: 2005-11-11 23:00
- +
- +gz_watch:
- + version: 1
- + space: watcher_private_space
- + page_name: FirstPage
- + is_visible: true
- + contents: Camel Case should work properly
- + user: gizmo
- diff --git a/test/functional/spaces/tickets_controller_test.rb b/test/functional/spaces/tickets_controller_test.rb
- index e4423d0..b521c35 100644
- --- a/test/functional/spaces/tickets_controller_test.rb
- +++ b/test/functional/spaces/tickets_controller_test.rb
- @@ -215,6 +215,20 @@ class Spaces::TicketsControllerTest < Test::Unit::TestCase
- 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
- end
- + def test_new_watcher_deny_create
- + space = spaces(:watcher_private_space)
- + get :new, :id => space.id
- + assert_response :redirect
- + assert_redirected_to 'not_permitted'
- + end
- +
- + def test_new_watcher_allow_access
- + space = spaces(:watcher_private_space)
- + get :index, :id => space.id
- + assert_response :success
- + assert_template 'index'
- + end
- +
- def create_component(name)
- post :create_component, :space_id => @space.id, :format => 'xml', :component_name => name
- end
- @@ -251,17 +265,17 @@ class Spaces::TicketsControllerTest < Test::Unit::TestCase
- assert_equal Space::MESSAGES_FROM_MEMBERS, tool.settings_hash[:email2tickets]
- end
- -
- +
- def test_export
- logged_in_as_gizmo
- -
- +
- post :export, :space_id => @space.id
- assert_response :success
- -
- +
- file = @response.body
- -
- +
- assert_not_nil file
- -
- +
- assert file.include?("tickets:fields")
- end
- @@ -277,7 +291,7 @@ class Spaces::TicketsControllerTest < Test::Unit::TestCase
- def test_should_clear_existing_tickets_and_import
- logged_in_as_gizmo
- -
- +
- file = fixture_file_upload("files/#{@space.wiki_name}.bak")
- post :import, :space_id => @space.id, :tickets => "clear", :file => file
- @@ -286,18 +300,18 @@ class Spaces::TicketsControllerTest < Test::Unit::TestCase
- end
- def test_import
- -
- +
- file = fixture_file_upload("files/gizmo.bak")
- @space = spaces(:public_none)
- post :import, :space_id => @space.id, :tickets => "add", :file => file
- assert_flash :notice, "Tickets imported successfully."
- - assert_response :redirect
- + assert_response :redirect
- end
- -
- +
- def logged_in_as_gizmo
- @request.session[:user] = nil
- login_user :gizmo
- @space = spaces :gizmo_space
- end
- -
- +
- end
- diff --git a/test/functional/spaces_controller_test.rb b/test/functional/spaces_controller_test.rb
- index 65d80cb..cde5467 100644
- --- a/test/functional/spaces_controller_test.rb
- +++ b/test/functional/spaces_controller_test.rb
- @@ -760,6 +760,12 @@ class SpacesControllerTest < Test::Unit::TestCase
- get_action :my_spaces
- end
- + def test_watcher_access
- + login_user :bob
- + space = spaces(:watcher_private_space)
- + get
- + end
- +
- def test_ssl
- begin
- UserSystem::CONFIG[:https] = true
Add Comment
Please, Sign In to add comment