Diff
Modified: branches/authorization_new/app/controllers/application.rb (2077 => 2078)
--- branches/authorization_new/app/controllers/application.rb 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/controllers/application.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -202,46 +202,11 @@
# BEGIN initialisation and validation
- case sharing_class
- when "0"
- view_public = 1
- download_public = 1
- view_protected = 1
- download_protected = 1
- when "1"
- view_public = 1
- view_protected = 1
- download_protected = 1
- when "2"
- view_public = 1
- view_protected = 1
- when "3"
- view_protected = 1
- download_protected = 1
- when "4"
- view_protected = 1
- end
-
- case updating_class
- when "0"
- edit_protected = 1 if (view_protected == 1 && download_protected == 1)
- edit_public = 1 if (view_public == 1 && download_public == 1)
- when "1"
- edit_protected = 1
- # when "5","6" -> no need for these cases, because both edit flags are false (default values) for these modes
- end
-
unless contributable.contribution.policy
last_saved_policy = Policy._default(current_user, nil) # second parameter ensures that this policy is not applied anywhere
policy = Policy.new(:name => 'auto',
:contributor_type => 'User', :contributor_id => current_user.id,
- :view_protected => view_protected,
- :view_public => view_public,
- :download_protected => download_protected,
- :download_public => download_public,
- :edit_protected => edit_protected,
- :edit_public => edit_public,
:share_mode => sharing_class,
:update_mode => updating_class)
contributable.contribution.policy = policy # by doing this the new policy object is saved implicitly too
@@ -250,12 +215,6 @@
policy = contributable.contribution.policy
last_saved_policy = policy.clone # clone required, not 'dup' (which still works through reference, so the values in both get changed anyway - which is not what's needed here)
- policy.view_protected = view_protected
- policy.view_public = view_public
- policy.download_protected = download_protected
- policy.download_public = download_public
- policy.edit_protected = edit_protected
- policy.edit_public = edit_public
policy.share_mode = sharing_class
policy.update_mode = updating_class
policy.save
@@ -349,61 +308,6 @@
return error_msg
end
- def determine_sharing_mode(contributable)
-
- # TODO: like the determine_updating_mode(..) method below, this method needs to be refactored into the Policy class.
-
- policy = contributable.contribution.policy
-
- return policy.share_mode if !policy.share_mode.nil?
-
- v_pub = policy.view_public;
- v_prot = policy.view_protected;
- d_pub = policy.download_public;
- d_prot = policy.download_protected;
- e_pub = policy.edit_public;
- e_prot = policy.edit_protected;
-
- if (policy.permissions.length == 0)
-
- if ((v_pub == true ) && (v_prot == false) && (d_pub == true ) && (d_prot == false))
- return 0
- end
-
- if ((v_pub == true ) && (v_prot == false) && (d_pub == false) && (d_prot == true ))
- return 1;
- end
-
- if ((v_pub == true ) && (v_prot == false) && (d_pub == false) && (d_prot == false))
- return 2;
- end
-
- if ((v_pub == false) && (v_prot == true ) && (d_pub == false) && (d_prot == true ))
- return 3;
- end
-
- if ((v_pub == false) && (v_prot == true ) && (d_pub == false) && (d_prot == false))
- return 4;
- end
-
- if ((v_pub == false) && (v_prot == false) && (d_pub == false) && (d_prot == false))
- return 7;
- end
-
- end
-
- return 8
-
- end
-
- def determine_updating_mode(contributable)
- if (policy = contributable.contribution.policy)
- return policy.determine_update_mode(contributable.contribution)
- else
- return 7
- end
- end
-
def update_credits(creditable, params)
# First delete old creditations:
Modified: branches/authorization_new/app/controllers/blobs_controller.rb (2077 => 2078)
--- branches/authorization_new/app/controllers/blobs_controller.rb 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/controllers/blobs_controller.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -345,8 +345,8 @@
@sharing_mode = params[:sharing][:class_id].to_i if params[:sharing]
@updating_mode = params[:updating][:class_id].to_i if params[:updating]
when "show", "edit"
- @sharing_mode = determine_sharing_mode(@blob)
- @updating_mode = determine_updating_mode(@blob)
+ @sharing_mode = @blob.contribution.policy.share_mode
+ @updating_mode = @blob.contribution.policy.update_mode
end
end
Modified: branches/authorization_new/app/controllers/blogs_controller.rb (2077 => 2078)
--- branches/authorization_new/app/controllers/blogs_controller.rb 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/controllers/blogs_controller.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -21,7 +21,7 @@
def show
@viewing = Viewing.create(:contribution => @blog.contribution, :user => (logged_in? ? current_user : nil))
- @sharing_mode = determine_sharing_mode(@blog)
+ @sharing_mode = @blog.contribution.policy.share_mode
respond_to do |format|
format.html # show.rhtml
@@ -37,7 +37,7 @@
# GET /blogs/1;edit
def edit
- @sharing_mode = determine_sharing_mode(@blog)
+ @sharing_mode = @blog.contribution.policy.share_mode
end
# POST /blogs
Modified: branches/authorization_new/app/controllers/packs_controller.rb (2077 => 2078)
--- branches/authorization_new/app/controllers/packs_controller.rb 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/controllers/packs_controller.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -461,8 +461,8 @@
@sharing_mode = params[:sharing][:class_id].to_i if params[:sharing]
@updating_mode = params[:updating][:class_id].to_i if params[:updating]
when "show", "edit"
- @sharing_mode = determine_sharing_mode(@pack)
- @updating_mode = determine_updating_mode(@pack)
+ @sharing_mode = @pack.contribution.policy.share_mode
+ @updating_mode = @pack.contribution.policy.update_mode
end
end
Deleted: branches/authorization_new/app/controllers/policy_wizard_controller.rb (2077 => 2078)
--- branches/authorization_new/app/controllers/policy_wizard_controller.rb 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/controllers/policy_wizard_controller.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -1,74 +0,0 @@
-class PolicyWizardController < ApplicationController
- before_filter :login_required
- before_filter :find_policy_auth, :except => [:show, :start, :create]
-
- def show
- redirect_to :action ="" :start
- end
-
- def start
- @policy = Policy._default(current_user)
- @policy.name = nil
- end
-
- def create
- @policy = Policy.new(params[:policy])
-
- if @policy.save
- redirect_to :action ="" :public, :id => @policy.id
- else
- render :action ="" :start
- end
- end
-
- def public
- # render public.rhtml
- end
-
- def protected
- render :action ="" :public unless @policy.update_attributes(params[:policy])
- end
-
- def private
- render :action ="" :protected unless @policy.update_attributes(params[:policy])
- end
-
- def finish
- # render finish.rhtml
- end
-
- def permission
- # hack for _javascript_ contributor selection form
- case params[:contributor_type].to_s
- when "User"
- contributor = User.find(params[:user_contributor_id])
- when "Network"
- contributor = Network.find(params[:network_contributor_id])
- else
- error("Invalid contributor type", "invalid type (must be User or Network)", :contributor_type)
- end
-
- @permission = Permission.new(:policy => @policy, :contributor => contributor, :view => params[:view], :download => params[:download], :edit => params[:edit])
-
- render :partial => "policies/permission", :object => @permission, :locals => { :read_only => true } if @permission.save
- end
-
-protected
-
- def find_policy_auth
- @policy = Policy.find(:first, :conditions => ["id = ? AND contributor_id = ? AND contributor_type = ?", params[:id], current_user.id, "User"])
-
- error("Policy not found (id not authorized)", "is invalid (not owner)") unless @policy
- end
-
-private
-
- def error(notice, message, attr=:id)
- flash[:error] = notice
- (err = Policy.new.errors).add(attr, message)
-
- respond_to do |format|
- format.html { redirect_to policies_url }
- end
- end
-end
Modified: branches/authorization_new/app/controllers/workflows_controller.rb (2077 => 2078)
--- branches/authorization_new/app/controllers/workflows_controller.rb 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/controllers/workflows_controller.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -700,8 +700,8 @@
@sharing_mode = params[:sharing][:class_id].to_i if params[:sharing]
@updating_mode = params[:updating][:class_id].to_i if params[:updating]
when "show", "edit"
- @sharing_mode = determine_sharing_mode(@workflow)
- @updating_mode = determine_updating_mode(@workflow)
+ @sharing_mode = @workflow.contribution.policy.share_mode
+ @updating_mode = @workflow.contribution.policy.update_mode
end
end
Modified: branches/authorization_new/app/models/policy.rb (2077 => 2078)
--- branches/authorization_new/app/models/policy.rb 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/models/policy.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -18,151 +18,6 @@
validates_presence_of :contributor, :name
-
- def determine_update_mode(c_ution)
-
- # return nil unless correct policy for contribution
- return nil if c_ution.nil? || !(c_ution.policy.id.to_i == id.to_i)
-
- return self.update_mode unless self.update_mode.nil?
-
- v_pub = self.view_public;
- v_prot = self.view_protected;
- d_pub = self.download_public;
- d_prot = self.download_protected;
- e_pub = self.edit_public;
- e_prot = self.edit_protected;
-
-
- # check if permissions would allow editing for anyone at all: it happens, when permissions array
- # isn't empty AND there are some permissions with 'edit' field set to true
- perms = self.permissions
- perms_exist = !perms.empty?
-
-
- # initializing; ..used for validation below
- my_networks = []
- other_networks = []
- my_friends = []
- other_users = []
-
- # group permissions are separate from the modes, so first of all;
- # so the best thing to do is to split all permissions into different groups
- # (do this just if there are any permissions at all):
- if perms_exist #, then do the splitting
- contributor = User.find(c_ution.contributor_id)
-
- contributors_friends = contributor.friends.map do |f| f.id end
- contributors_networks = (contributor.networks + contributor.networks_owned).map do |n| n.id end
-
- puts "contributors_networks = #{(contributors_networks.map do |n| n.id end).join(";")}"
-
- perms.each do |p|
- puts "contributor_id = #{p.contributor_id}; contributor_type = #{p.contributor_type}"
- case p.contributor_type
- when 'Network'
- if contributors_networks.index(p.contributor_id).nil?
- other_networks.push p
- else
- my_networks.push p
- end
-
- when 'User'
- if contributors_friends.index(p.contributor_id).nil?
- other_users.push p
- else
- my_friends.push p
- end
- end
- end
-
- end
-
- # DEBUG
- # puts "counts of permissions for:"
- # puts "all permissions= #{perms_exist ? perms.length : 'nil'}"
- # puts "my_networks = #{my_networks.length}"
- # puts "other_networks = #{other_networks.length}"
- # puts "my_friends = #{my_friends.length}"
- # puts "other_users = #{other_users.length}"
- # END OF DEBUG
-
-
- # some pre-processing - check if other_users and other_networks don't have edit permissions; check if friends can't edit
- other_users_and_networks_cant_edit = ((other_networks + other_users).select do |p| p.edit end).empty?
- my_friends_cant_edit = (my_friends.select do |p| p.edit end).empty?
-
-
- # (modes 5 & 6 give the least permissions, which is the safest - so these get checked first; then mode 1; then mode 0)
- # (this is the order from most 'narrow' update permissions to the 'widest' ones)
-
-
- # MODE 5? some of my friends (and noone else, apart from the owner & any of 'my groups' can edit)
- #
- # Conditions:
- # 1) no permissions should exist at all
- # OR
- # 2) don't care about any permissions for 'my_groups';
- # 3) no edit permissions should exist for 'other_networks', 'other_users'
- # 4) some edit permissions should exist for 'my_friends'
-
- # === AND === (mode 5 & mode 6 go together, as the checks are very similar)
-
- # MODE 6? noone else (apart from the owner & any of 'my groups' can edit)
- #
- # Conditions:
- # 1) no permissions should exist at all
- # OR
- # 2) don't care about any permissions for 'my_groups';
- # 3) no edit permissions should exist for 'other_networks', 'other_users', 'my_friends'
- if (e_pub == false && e_prot == false)
- if !perms_exist || other_users_and_networks_cant_edit
- if my_friends_cant_edit
- return 6
- else
- return 5
- end
- end
- end
-
-
- # MODE 1? only "all friends" and "network members of my groups" can edit
- #
- # Conditions:
- # 1) no permissions should exist at all
- # OR
- # 2) no edit permissions for 'other_networks' or 'other_users' should exist at all;
- # 3) all permissions for 'my_friends' should allow editing (if any denies, it's not this mode);
- # 4) don't care about any permissions for 'my_networks' at all.
- if (e_pub == false && e_prot == true)
- if !perms_exist || (other_users_and_networks_cant_edit && (my_friends.select do |p| !p.edit end).empty?)
- return 1
- end
- end
-
-
- # MODE 0? same as those that can view AND download
- #
- # Conditions:
- # for all of the three types of access (public, protected and permission-based),
- # everyone who can 'view' AND 'download' should be able to 'edit' for this type of policy
- # to classify as belonging to this mode.
- # (for permission-based access, don't take into account any of 'my group' permissions)
- if (e_pub == (v_pub && d_pub))
- if (e_prot == (v_prot && d_prot))
- # select only those elements from the arrays of permissions, for which ('view' && 'download') != 'edit'
- if ((my_friends + other_users + other_networks).select do |p| p.edit != (p.view && p.download) end).empty?
- return 0;
- end
- end
- end
-
-
- # MODE 7: couldn't determine the mode, so should have CUSTOM update mode
- return 7
- end
-
-
def authorized?(action_name, c_ution=nil, c_utor=nil)
if c_ution
@@ -267,12 +122,6 @@
def self._default(c_utor, c_ution=nil)
rtn = Policy.new(:name => "A default policy", # "anyone can view and download and no one else can edit"
:contributor => c_utor,
- :view_public => true, # anonymous can view
- :download_public => true, # anonymous can download
- :edit_public => false, # anonymous can't edit
- :view_protected => true, # friends can view
- :download_protected => true, # friends can download
- :edit_protected => false, # friends can't edit
:share_mode => 0,
:update_mode => 6)
@@ -286,12 +135,6 @@
def copy_values_from(other)
self.name = other.name
self.contributor = other.contributor
- self.view_public = other.view_public
- self.download_public = other.download_public
- self.edit_public = other.edit_public
- self.view_protected = other.view_protected
- self.download_protected = other.download_protected
- self.edit_protected = other.edit_protected
self.share_mode = other.share_mode
self.update_mode = other.update_mode
end
Modified: branches/authorization_new/app/views/policies/_breakdown.rhtml (2077 => 2078)
--- branches/authorization_new/app/views/policies/_breakdown.rhtml 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/views/policies/_breakdown.rhtml 2009-02-02 16:52:07 UTC (rev 2078)
@@ -13,9 +13,6 @@
<%= null_avatar 60 %><br />
Anonymous
</td>
- <td><%= check_box_tag "view_public", 1, checked = policy.view_public, :disabled => true %></td>
- <td><%= check_box_tag "download_public", 1, checked = policy.download_public, :disabled => true %></td>
- <td><%= check_box_tag "edit_public", 1, checked = policy.edit_public, :disabled => true %></td>
</tr>
<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
@@ -60,4 +57,4 @@
</tr>
<% end %>
-</table>
\ No newline at end of file
+</table>
Modified: branches/authorization_new/app/views/policies/_form.rhtml (2077 => 2078)
--- branches/authorization_new/app/views/policies/_form.rhtml 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/views/policies/_form.rhtml 2009-02-02 16:52:07 UTC (rev 2078)
@@ -24,25 +24,6 @@
</tr>
</table>
- <p>
- Please select the most appropriate:
- </p>
-
- <p>
- <%= form.radio_button :view_public, true %> - Anonymous users can <b>view</b> my contributions.<br/>
- <%= form.radio_button :view_public, false %> - Anonymous users can't <b>view</b> my contributions.
- </p>
-
- <p>
- <%= form.radio_button :download_public, true %> - Anonymous users can <b>download</b> my files and workflows.<br/>
- <%= form.radio_button :download_public, false %> - Anonymous users can't <b>download</b> my files and workflows.
- </p>
-
- <p>
- <%= form.radio_button :edit_public, true %> - Anonymous users can <b>edit</b> my contributions. <font color="red">*NOT RECOMMENDED*</font><br/>
- <%= form.radio_button :edit_public, false %> - Anonymous users can't <b>edit</b> my contributions. <font color="red">*RECOMMENDED*</font>
- </p>
-
<h3>Friends access</h3>
<table width="100%">
@@ -63,21 +44,3 @@
</tr>
</table>
- <p>
- Please select the most appropriate:
- </p>
-
- <p>
- <%= form.radio_button :view_protected, true %> - My friends can <b>view</b> my contributions.<br/>
- <%= form.radio_button :view_protected, false %> - My friends can't <b>view</b> my contributions.
- </p>
-
- <p>
- <%= form.radio_button :download_protected, true %> - My friends can <b>download</b> my files and workflows.<br/>
- <%= form.radio_button :download_protected, false %> - My friends can't <b>download</b> my files and workflows.
- </p>
-
- <p>
- <%= form.radio_button :edit_protected, true %> - My friends can <b>edit</b> my contributions. <font color="red">*NOT RECOMMENDED*</font><br/>
- <%= form.radio_button :edit_protected, false %> - My friends can't <b>edit</b> my contributions. <font color="red">*RECOMMENDED*</font>
- </p>
\ No newline at end of file
Modified: branches/authorization_new/app/views/policies/_listform.rhtml (2077 => 2078)
--- branches/authorization_new/app/views/policies/_listform.rhtml 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/views/policies/_listform.rhtml 2009-02-02 16:52:07 UTC (rev 2078)
@@ -12,14 +12,9 @@
</p>
<p>
- <input type="radio" name="policy_id" disabled="true"> - <%= link_to "Create new sharing permissions policy using the wizard", policy_wizard_path %>
+ <input type="radio" name="policy_id" disabled="true"> - disabled
</p>
- <p>
- The policy wizard will take you through the steps required to create a deployable sharing policy.<br/>
- When you've finished the wizard, the policy will be available the next time you access this page!
- </p>
-
<% for p in user.policies %>
<p>
<%= c_f.radio_button(:policy_id, p.id) %> - <%= link_to h(p.name), policy_path(p) %><br/>
@@ -36,4 +31,4 @@
</div>
</div>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/policies/_policy.rhtml (2077 => 2078)
--- branches/authorization_new/app/views/policies/_policy.rhtml 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/views/policies/_policy.rhtml 2009-02-02 16:52:07 UTC (rev 2078)
@@ -1,22 +1,4 @@
<% read_only ||= false -%>
<table>
- <tr>
- <th> </th>
- <th>View</th>
- <th>Download</th>
- <th>Edit</th>
- </tr>
- <tr>
- <td><b>Public</b></td>
- <td><%= check_box_tag "view_public", 1, policy.view_public, :disabled => true %></td>
- <td><%= check_box_tag "download_public", 1, policy.download_public, :disabled => true %></td>
- <td><%= check_box_tag "edit_public", 1, policy.edit_public, :disabled => true %></td>
- </tr>
- <tr>
- <td><b>Protected</b></td>
- <td><%= check_box_tag "view_protected", 1, policy.view_protected, :disabled => true %></td>
- <td><%= check_box_tag "download_protected", 1, policy.download_protected, :disabled => true %></td>
- <td><%= check_box_tag "edit_protected", 1, policy.edit_protected, :disabled => true %></td>
- </tr>
<%= render :partial => "policies/permission", :collection => policy.permissions, :locals => { :read_only => read_only } %>
-</table>
\ No newline at end of file
+</table>
Modified: branches/authorization_new/app/views/policies/index.rhtml (2077 => 2078)
--- branches/authorization_new/app/views/policies/index.rhtml 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/views/policies/index.rhtml 2009-02-02 16:52:07 UTC (rev 2078)
@@ -34,7 +34,6 @@
<center>
<%= icon "show", policy_path(policy) %>
- <%= icon('wizard', url_for(:controller => :policy_wizard, :action ="" :public, :id => policy.id)) %>
<%= icon "destroy", policy_path(policy), nil, :confirm => 'Are you sure?', :method => :delete %>
</center>
</li>
@@ -44,4 +43,4 @@
<br style="clear: both;" />
</div>
-<br />
\ No newline at end of file
+<br />
Modified: branches/authorization_new/app/views/policies/show.rhtml (2077 => 2078)
--- branches/authorization_new/app/views/policies/show.rhtml 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/app/views/policies/show.rhtml 2009-02-02 16:52:07 UTC (rev 2078)
@@ -17,7 +17,6 @@
<ul class="sectionIcons">
<li><%= icon('edit', edit_policy_path(@policy), nil, nil, 'Edit policy (1 page)') %></li>
- <li><%= icon('wizard', url_for(:controller => :policy_wizard, :action ="" :public, :id => @policy.id), nil, nil, 'Edit using wizard') %></li>
<li><%= icon('destroy', policy_path(@policy), nil, { :confirm => 'Are you sure?', :method => :delete }, 'Remove policy') %></li>
</ul>
Added: branches/authorization_new/db/migrate/072_remove_public_protected_flags.rb (0 => 2078)
--- branches/authorization_new/db/migrate/072_remove_public_protected_flags.rb (rev 0)
+++ branches/authorization_new/db/migrate/072_remove_public_protected_flags.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -0,0 +1,19 @@
+class RemovePublicProtectedFlags < ActiveRecord::Migration
+ def self.up
+ remove_column :policies, :download_public
+ remove_column :policies, :edit_public
+ remove_column :policies, :view_public
+ remove_column :policies, :download_protected
+ remove_column :policies, :edit_protected
+ remove_column :policies, :view_protected
+ end
+
+ def self.down
+ add_column :policies, :download_public, :boolean, :default => true
+ add_column :policies, :edit_public, :boolean, :default => true
+ add_column :policies, :view_public, :boolean, :default => true
+ add_column :policies, :download_protected, :boolean, :default => true
+ add_column :policies, :edit_protected, :boolean, :default => true
+ add_column :policies, :view_protected, :boolean, :default => true
+ end
+end
Modified: branches/authorization_new/test/fixtures/policies.yml (2077 => 2078)
--- branches/authorization_new/test/fixtures/policies.yml 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/test/fixtures/policies.yml 2009-02-02 16:52:07 UTC (rev 2078)
@@ -4,12 +4,6 @@
contributor_id: 1
contributor_type: User
name: Johns policy
- download_public: true
- edit_public: true
- view_public: true
- download_protected: true
- edit_protected: true
- view_protected: true
share_mode: 0
update_mode: 0
created_at: 2008-02-02 22:02:54
@@ -20,12 +14,6 @@
contributor_id: 2
contributor_type: User
name: Janes policy
- download_public: true
- edit_public: true
- view_public: true
- download_protected: true
- edit_protected: true
- view_protected: true
share_mode: 0
update_mode: 0
created_at: 2007-10-22 18:54:22
@@ -36,12 +24,6 @@
contributor_id: 1
contributor_type: User
name: All true
- download_public: true
- edit_public: true
- view_public: true
- download_protected: true
- edit_protected: true
- view_protected: true
share_mode: 0
update_mode: 0
created_at: 2007-10-22 18:54:22
@@ -52,12 +34,6 @@
contributor_id: 1
contributor_type: User
name: All false
- download_public: false
- edit_public: false
- view_public: false
- download_protected: false
- edit_protected: false
- view_protected: false
share_mode: 5
update_mode: 2
created_at: 2007-10-22 18:54:22
@@ -68,12 +44,6 @@
contributor_id: 1
contributor_type: User
name: Public false, protected true
- download_public: false
- edit_public: false
- view_public: false
- download_protected: true
- edit_protected: true
- view_protected: true
share_mode: 3
update_mode: 1
created_at: 2007-10-22 18:54:22
@@ -84,12 +54,6 @@
contributor_id: 1
contributor_type: User
name: Public true, protected false (should act as all true)
- download_public: true
- edit_public: true
- view_public: true
- download_protected: false
- edit_protected: false
- view_protected: false
share_mode: 0
update_mode: 0
created_at: 2007-10-22 18:54:22
Modified: branches/authorization_new/test/functional/policies_controller_test.rb (2077 => 2078)
--- branches/authorization_new/test/functional/policies_controller_test.rb 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/test/functional/policies_controller_test.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -38,12 +38,7 @@
post :create, :policy => { :contributor_id => users(:john).id,
:contributor_type => 'User',
:name => 'test policy',
- :view_public => true,
- :download_public => true,
- :edit_public => true,
- :view_protected => true,
- :download_protected => true,
- :edit_protected => true }
+ :share_mode => 0 }
assert_equal old_count+1, Policy.count
assert_redirected_to policy_path(assigns(:policy))
@@ -63,7 +58,7 @@
def test_should_update_policy
login_as(:john)
- put :update, :id => 1, :policy => { :download_public => false, :edit_public => false }
+ put :update, :id => 1, :policy => { :share_mode => 1 }
assert_redirected_to policy_path(assigns(:policy))
end
Deleted: branches/authorization_new/test/functional/policy_wizard_controller_test.rb (2077 => 2078)
--- branches/authorization_new/test/functional/policy_wizard_controller_test.rb 2009-01-30 15:21:50 UTC (rev 2077)
+++ branches/authorization_new/test/functional/policy_wizard_controller_test.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -1,18 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-require 'policy_wizard_controller'
-
-# Re-raise errors caught by the controller.
-class PolicyWizardController; def rescue_action(e) raise e end; end
-
-class PolicyWizardControllerTest < Test::Unit::TestCase
- def setup
- @controller = PolicyWizardController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
Added: branches/authorization_new/test/unit/authorisation_test.rb (0 => 2078)
--- branches/authorization_new/test/unit/authorisation_test.rb (rev 0)
+++ branches/authorization_new/test/unit/authorisation_test.rb 2009-02-02 16:52:07 UTC (rev 2078)
@@ -0,0 +1,14 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class AuthorisationTest < Test::Unit::TestCase
+ fixtures :workflows
+ fixtures :blobs
+ fixtures :contributions
+ fixtures :permissions
+ fixtures :policies
+
+ # Replace this with your real tests.
+ def test_truth
+ assert true
+ end
+end