Diff
Modified: branches/authorization_new/app/views/blobs/_blob.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/blobs/_blob.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/blobs/_blob.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -23,9 +23,9 @@
</tr>
<tr>
<td colspan="2">
- <% if blob.authorized?("download", (logged_in? ? current_user : nil)) %><%= icon "download", download_file_path(blob) %> <% end %>
- <% if blob.authorized?("show", (logged_in? ? current_user : nil)) %><%= icon "show", file_path(blob), nil, nil, "View" %> <% end %>
- <% if logged_in? and blob.authorized?("edit", current_user) %><%= icon "edit", edit_file_path(blob) %> <% end %>
+ <% if Authorization.is_authorized?('download', nil, blob, current_user) %><%= icon "download", download_file_path(blob) %> <% end %>
+ <% if Authorization.is_authorized?('show', nil, blob, current_user) %><%= icon "show", file_path(blob), nil, nil, "View" %> <% end %>
+ <% if logged_in? and Authorization.is_authorized?('edit', nil, blob, current_user) %><%= icon "edit", edit_file_path(blob) %> <% end %>
<% if logged_in? and blob.owner?(current_user) %><%= icon "destroy", file_path(blob), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
</td>
</tr>
Modified: branches/authorization_new/app/views/blobs/_table.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/blobs/_table.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/blobs/_table.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -6,9 +6,9 @@
<% for blob in collection %>
<% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
<% if collection.size == 1 -%>
- <% show ||= blob.authorized?("show", current_user) -%>
+ <% show ||= Authorization.is_authorized?('show', nil, blob, current_user) -%>
<% else -%>
- <% show = blob.authorized?("show", current_user) -%>
+ <% show = Authorization.is_authorized?('show', nil, blob, current_user) -%>
<% end -%>
<% if show -%>
<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
@@ -92,7 +92,7 @@
<td class="actions" style="width: 80px;">
<%= icon "show", file_path(blob), nil, nil, "View" %>
- <% if blob.authorized?("download", current_user) %><%= icon "download", download_file_path(blob) %><% end %>
+ <% if Authorization.is_authorized?("download", nil, blob, current_user) %><%= icon "download", download_file_path(blob) %><% end %>
<% if mine?(blob) %><%= icon "manage", edit_file_path(blob), nil, nil, "Manage" %><% end %>
</td>
</tr>
Modified: branches/authorization_new/app/views/blobs/show.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/blobs/show.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/blobs/show.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -4,7 +4,7 @@
<% if mine?(@blob) -%>
<li><%= icon('manage', edit_file_path(@blob), nil, nil, 'Manage File Entry')%></li>
<% end -%>
- <% if @blob.authorized?("destroy", current_user) %>
+ <% if Authorization.is_authorized?('destroy', nil, @blob, current_user) %>
<li><%= icon('destroy', file_path(@blob), nil, { :confirm => 'This deletes the File and all metadata such as tags, comments and ratings. Are you sure?', :method => :delete }, 'Delete File Entry') %></li>
<% end %>
</ul>
@@ -84,7 +84,7 @@
Download
</h3>
- <% if @blob.authorized?("download", (logged_in? ? current_user : nil)) %>
+ <% if Authorization.is_authorized?('download', nil, @blob, current_user) %>
<ul class="sectionIcons">
<li><%= icon('blob', @named_download_url, "Download File", nil, "Download File") %></li>
</ul>
@@ -110,7 +110,7 @@
:owner_id => ((@blob.contributor_type == 'User') ? @blob.contributor_id : nil),
:add_path => tag_file_path(@blob),
:edit_path => edit_file_path(@blob),
- :allow_edit => @blob.authorized?("edit", logged_in? ? current_user : nil ) } %>
+ :allow_edit => Authorization.is_authorized?('edit', nil, @blob, current_user) } %>
<%= render :partial => "contributions/shared_with_groups_box", :locals => { :contributable => @blob } %>
@@ -145,7 +145,7 @@
<%= render :partial => "contributions/sharing_summary", :locals => { :contributable => @blob } %>
<%= render :partial => "contributions/updating_summary", :locals => { :contributable => @blob } %>
- <% if @blob.authorized?("edit", current_user) %>
+ <% if Authorization.is_authorized?('edit', nil, @blob, current_user) %>
<ul class="sectionIcons">
<li><%= icon('edit', edit_file_path(@blob), nil, nil, 'Edit')%></li>
</ul>
Modified: branches/authorization_new/app/views/blog_posts/_subnav.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/blog_posts/_subnav.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/blog_posts/_subnav.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -1,6 +1,6 @@
<% case controller.action_name.to_s; when "show" %>
- <% if logged_in? and @blog_post.blog.authorized?("edit", current_user) %>
+ <% if logged_in? && Authorization.is_authorized?("edit", nil, @blog_post.blog, current_user) %>
<ul class="sectionIcons">
<li><%= link_to 'Edit Blog Post', edit_blog_post_path(@blog_post.blog, @blog_post) %></li>
</ul>
Modified: branches/authorization_new/app/views/blogs/_blog.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/blogs/_blog.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/blogs/_blog.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -23,9 +23,9 @@
<tr>
<td colspan="2">
<center>
- <% if blog.authorized?("show", (logged_in? ? current_user : nil)) %><%= icon "show", blog_path(blog), nil, nil, "View" %> <% end %>
- <% if logged_in? and blog.authorized?("edit", current_user) %><%= icon "edit", edit_blog_path(blog) %> <% end %>
- <% if logged_in? and blog.authorized?("destroy", current_user) %><%= icon "destroy", blog_path(blog), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
+ <% if Authorization.is_authorized?("show", nil, blog, current_user) %><%= icon "show", blog_path(blog), nil, nil, "View" %> <% end %>
+ <% if logged_in? && Authorization.is_authorized?("edit", nil, blog, current_user) %><%= icon "edit", edit_blog_path(blog) %> <% end %>
+ <% if logged_in? && Authorization.is_authorized?("destroy", nil, blog, current_user) %><%= icon "destroy", blog_path(blog), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
</center>
</td>
</tr>
Modified: branches/authorization_new/app/views/blogs/_table.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/blogs/_table.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/blogs/_table.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -19,9 +19,9 @@
<td><%=h blog.posts.length %></td>
<td><%=datetime(blog.posts[-1].created_at, false) unless blog.posts.empty? %></td>
<td class="actions">
- <% if blog.authorized?("show", (logged_in? ? current_user : nil)) %><%= icon "show", blog_path(blog), nil, nil, "View" %> <% end %>
- <% if logged_in? and blog.authorized?("edit", current_user) %><%= icon "edit", edit_blog_path(blog) %> <% end %>
- <% if logged_in? and blog.owner?(current_user) %><%= icon "destroy", blog_path(blog), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
+ <% if Authorization.is_authorized?("show", nil, blog, current_user) %><%= icon "show", blog_path(blog), nil, nil, "View" %> <% end %>
+ <% if logged_in? && Authorization.is_authorized?("edit", nil, blog, current_user) %><%= icon "edit", edit_blog_path(blog) %> <% end %>
+ <% if logged_in? && blog.owner?(current_user) %><%= icon "destroy", blog_path(blog), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
</td>
</tr>
<% end %>
Modified: branches/authorization_new/app/views/blogs/show.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/blogs/show.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/blogs/show.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -6,12 +6,12 @@
<% if logged_in? %>
<ul class="sectionIcons">
- <% if @blog.authorized?("edit", current_user) %>
+ <% if Authorization.is_authorized?("edit", nil, @blog, current_user) %>
<li><%= icon('new', new_blog_post_path(@blog), nil, nil, "New post") %></li>
<li><%= icon('edit', edit_blog_path(@blog), nil, nil, 'Edit ' + truncate(@blog.title, 10)) %></li>
<% end %>
- <% if @blog.authorized?("destroy", current_user) %>
+ <% if Authorization.is_authorized?("destroy", nil, @blog, current_user) %>
<li><%= icon('destroy', blog_path(@blog), nil, { :confirm => 'Are you sure?', :method => :delete }, 'Remove ' + truncate(@blog.title, 10)) %></li>
<% end %>
</ul>
@@ -23,7 +23,7 @@
<%= render :partial => "blog_posts/post", :collection => @blog.posts %>
<% end %>
-<% if logged_in? and @blog.authorized?("destroy", current_user) %>
+<% if logged_in? and Authorization.is_authorized?("destroy", nil, @blog, current_user) %>
<h2>History</h2>
<%= render :partial => "contributions/history", :object => @blog.contribution %>
Modified: branches/authorization_new/app/views/citations/_citation.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/citations/_citation.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/citations/_citation.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -12,7 +12,7 @@
<%= arr[i] %><%= "," unless i.to_i == arr.length.to_i - 1 %>
<% end %>
-<% if actions and item.authorized?("edit", (logged_in? ? current_user : nil)) %>
+<% if actions and Authorization.is_authorized?("edit", nil, item, current_user) %>
<small>[<%= link_to "view", citation_path(item, citation) %>]</small>
<small>[<%= link_to "edit", edit_citation_path(item, citation) %>]</small>
<% end %>
\ No newline at end of file
Modified: branches/authorization_new/app/views/citations/_table.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/citations/_table.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/citations/_table.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -27,8 +27,8 @@
<% end %>
<td class="actions">
<%= icon "show", citation_path(workflow, citation), nil, nil, "View" %>
- <% if logged_in? and @workflow.authorized?("edit", current_user) %><%= icon "edit", edit_citation_path(workflow, citation) %> <% end %>
- <% if logged_in? and @workflow.authorized?("destroy", current_user) %><%= icon "destroy", citation_path(workflow, citation), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
+ <% if logged_in? && Authorization.is_authorized?("edit", nil, @workflow, current_user) %><%= icon "edit", edit_citation_path(workflow, citation) %> <% end %>
+ <% if logged_in? && Authorization.is_authorized?("destroy", nil, @workflow, current_user) %><%= icon "destroy", citation_path(workflow, citation), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
</td>
</tr>
<% end %>
Modified: branches/authorization_new/app/views/citations/index.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/citations/index.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/citations/index.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -1,6 +1,6 @@
<h1>Citations for Workflow: <%= contributable(@workflow.id, 'Workflow') -%></h1>
-<% if @workflow.authorized?("edit", (logged_in? ? current_user : nil)) %>
+<% if Authorization.is_authorized?("edit", nil, @workflow, current_user) %>
<ul class="sectionIcons">
<li><%= icon('new', new_citation_path(@workflow), nil, nil, 'New Citation', nil) %></li>
</ul>
Modified: branches/authorization_new/app/views/citations/show.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/citations/show.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/citations/show.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -2,11 +2,11 @@
<ul class="sectionIcons">
<% if logged_in? %>
- <% if @workflow.authorized?("edit", current_user) %>
+ <% if Authorization.is_authorized?("edit", nil, @workflow, current_user) %>
<li><%= icon('edit', edit_citation_path(@workflow, @citation), nil, nil, 'Edit Citation') %></li>
<% end %>
- <% if @workflow.authorized?("destroy", current_user) %>
+ <% if Authorization.is_authorized?("destroy", nil, @workflow, current_user) %>
<li><%= icon('destroy', citation_path(@workflow, @citation), nil, { :confirm => 'Are you sure?', :method => :delete }, 'Delete Citation') %></li>
<% end %>
<% end %>
Modified: branches/authorization_new/app/views/contributions/_citations_tab.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/contributions/_citations_tab.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/contributions/_citations_tab.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -14,7 +14,7 @@
<br/>
- <% if item.authorized?("edit", (logged_in? ? current_user : nil)) %>
+ <% if Authorization.is_authorized?("edit", nil, item, current_user) %>
<ul class="sectionIcons">
<li><%= icon('new', new_citation_path(item), nil, nil, 'New Citation', nil) %></li>
<li><%= icon('edit', citations_path(item), nil, nil, 'Edit Citations', nil) %></li>
Modified: branches/authorization_new/app/views/contributions/_credits_attributions_box.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/contributions/_credits_attributions_box.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/contributions/_credits_attributions_box.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -65,7 +65,7 @@
<p class="none_text">None</p>
<% end %>
- <% if contributable.authorized?("edit", current_user) %>
+ <% if Authorization.is_authorized?("edit", nil, contributable, current_user) %>
<p style="text-align: right;"><small>[ <%= link_to "edit", edit_path %> ]</small></p>
<% end %>
Modified: branches/authorization_new/app/views/contributions/_table.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/contributions/_table.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/contributions/_table.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -1,7 +1,7 @@
<% unless collection.empty? %>
<% for contribution in collection %>
- <% if (show = contribution.authorized?("show", current_user)) %>
+ <% if (show = Authorization.is_authorized?("show", nil, contribution, current_user)) %>
<% unless params[:contributable_type] %>
<p style="margin-top: 0.5em;"><b><%= visible_name(contribution.contributable_type) %></b></p>
<% end %>
Modified: branches/authorization_new/app/views/contributions/show.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/contributions/show.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/contributions/show.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -34,7 +34,7 @@
<% end %>
-<% if logged_in? and @contribution.authorized?("destroy", current_user) %>
+<% if logged_in? && Authorization.is_authorized?("destroy", nil, @contribution, current_user) %>
<div class="tabContainer">
<div class="tabTitle">Policy</div>
<div class="tabContent">
@@ -53,7 +53,7 @@
</div>
</div>
-<% if logged_in? and @contribution.authorized?("destroy", current_user) %>
+<% if logged_in? && Authorization.is_authorized?("destroy", nil, @contribution, current_user) %>
<div class="tabContainer">
<div class="tabTitle">History</div>
<div class="tabContent">
Modified: branches/authorization_new/app/views/experiments/_table.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/experiments/_table.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/experiments/_table.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -33,6 +33,7 @@
</td>
<td class="actions" style="width: 80px;">
<%= icon "show", experiment_path(experiment), nil, nil, "View" %>
+ <% # experiments use non policy-based authorization mechanism, so it's better to leave the experiment-specific authorization mechanism -%>
<% if experiment.authorized?("edit", logged_in? ? current_user : nil) %>
<%= icon('edit', edit_experiment_path(experiment), nil, nil, 'Edit') %>
<% end %>
Modified: branches/authorization_new/app/views/experiments/show.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/experiments/show.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/experiments/show.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -1,5 +1,6 @@
<% t "#{h @experiment.title}" -%>
+<% # experiments don't use policy-based authorization mechanism, so it's better to keep the experiment-specific authorization -%>
<% if @experiment.authorized?('edit', current_user) -%>
<ul class="sectionIcons">
<li><%= icon('edit', edit_experiment_path(@experiment), nil, nil, 'Edit Experiment') %></li>
Modified: branches/authorization_new/app/views/jobs/_table.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/jobs/_table.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/jobs/_table.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -45,6 +45,7 @@
<td class="actions" style="width: 80px;">
<%= icon "show", job_url(job.experiment, job), nil, nil, "View" %>
<% if false -%>
+ <% # jobs don't use policy-based authorization mechanism, so it's better to keep job-specific authorization -%>
<% if job.authorized?("edit", logged_in? ? current_user : nil) -%>
<%= icon('edit', edit_job_path(job.experiment, job), nil, nil, 'Edit') %>
<% end -%>
Modified: branches/authorization_new/app/views/packs/_entry_item.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/packs/_entry_item.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/packs/_entry_item.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -2,7 +2,7 @@
<% if type and item_entry -%>
<% if type == 'contributable' -%>
<% if item_entry.contributable -%>
- <% if item_entry.contributable.authorized?('show', current_user) -%>
+ <% if Authorization.is_authorized?("show", nil, item_entry.contributable, current_user) -%>
<p style="text-align: center;">
<b>
<%= visible_name(item_entry.contributable_type) -%>:
Modified: branches/authorization_new/app/views/packs/_table.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/packs/_table.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/packs/_table.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -6,9 +6,9 @@
<% for pack in collection %>
<% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
<% if collection.size == 1 -%>
- <% show ||= pack.authorized?("show", current_user) -%>
+ <% show ||= Authorization.is_authorized?("show", nil, pack, current_user) -%>
<% else -%>
- <% show = pack.authorized?("show", current_user) -%>
+ <% show = Authorization.is_authorized?("show", nil, pack, current_user) -%>
<% end -%>
<% if show -%>
<% cache(:controller => 'packs_cache', :action ="" 'listing', :id => pack.id) do -%>
@@ -61,9 +61,9 @@
<td class="actions" style="width: 80px;">
<%= icon "show", pack_path(pack), nil, nil, "View" %>
- <% if pack.authorized?('download', current_user) -%><%= icon('download', download_pack_path(pack), nil, nil, 'Download') -%><% end -%>
+ <% if Authorization.is_authorized?("download", nil, pack, current_user) -%><%= icon('download', download_pack_path(pack), nil, nil, 'Download') -%><% end -%>
<% if mine?(pack) %><%= icon "manage", edit_pack_path(pack), nil, nil, "Manage" %><% end %>
- <% if pack.authorized?('edit', current_user) -%><%= icon('new', new_item_pack_path(pack), nil, nil, 'Add New Item') -%><% end -%>
+ <% if Authorization.is_authorized?("edit", nil, pack, current_user) -%><%= icon('new', new_item_pack_path(pack), nil, nil, 'Add New Item') -%><% end -%>
</td>
</tr>
<% end %>
Modified: branches/authorization_new/app/views/packs/show.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/packs/show.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/packs/show.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -5,7 +5,7 @@
<% if mine?(@pack) -%>
<li><%= icon('manage', edit_pack_path(@pack), nil, nil, 'Manage Pack') -%></li>
<% end -%>
- <% if @pack.authorized?("destroy", current_user) %>
+ <% if Authorization.is_authorized?("destroy", nil, @pack, current_user) %>
<li><%= icon('destroy', pack_path(@pack), nil, { :confirm => 'This deletes the Pack and all metadata such as tags and comments, BUT does not delete the actual items pointed to in the Pack. Are you sure you would like to delete this Pack?', :method => :delete }, 'Delete Pack') %></li>
<% end %>
</ul>
Modified: branches/authorization_new/app/views/policies/_test_results.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/policies/_test_results.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/policies/_test_results.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -7,8 +7,8 @@
</tr>
<tr>
<td><%= contributor(contributor.id, contributor.type.to_s, true, 60) %></td>
- <td><%= check_box_tag "view_private", 1, checked = contribution.authorized?("show", contributor), :disabled => true %></td>
- <td><%= check_box_tag "download_private", 1, checked = contribution.authorized?("download", contributor), :disabled => true %></td>
- <td><%= check_box_tag "edit_private", 1, checked = contribution.authorized?("edit", contributor), :disabled => true %></td>
+ <td><%= check_box_tag "view_private", 1, checked = Authorization.is_authorized?("show", nil, contribution, contributor), :disabled => true %></td>
+ <td><%= check_box_tag "download_private", 1, checked = Authorization.is_authorized?("download", nil, contribution, contributor), :disabled => true %></td>
+ <td><%= check_box_tag "edit_private", 1, checked = Authorization.is_authorized?("edit", nil, contribution, contributor), :disabled => true %></td>
</tr>
</table>
\ No newline at end of file
Modified: branches/authorization_new/app/views/runners/_table.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/runners/_table.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/runners/_table.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -35,6 +35,7 @@
</td>
<td class="actions" style="width: 80px;">
<%= icon "show", runner_path(runner), nil, nil, "View" %>
+ <% # runners don't use policy-based authorization, so it's better to keep the runner-specific authorization -%>
<% if runner.authorized?("edit", logged_in? ? current_user : nil) %>
<%= icon('edit', edit_runner_path(runner), nil, nil, 'Edit') %>
<% end %>
Modified: branches/authorization_new/app/views/runners/show.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/runners/show.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/runners/show.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -1,5 +1,6 @@
<% t "address@hidden - #{h @runner.title}" -%>
+<% # runners don't use policy-based authorization, so it's better to keep the runner-specific authorization -%>
<% if @runner.authorized?('edit', current_user) -%>
<ul class="sectionIcons">
<li><%= icon('edit', edit_runner_path(@runner), nil, nil, 'Edit Runner') %></li>
Modified: branches/authorization_new/app/views/workflows/_anchors.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/workflows/_anchors.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/workflows/_anchors.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -7,7 +7,7 @@
<% collection.each_index do |i| %>
<% workflow = collection[i] %>
- <% if workflow.authorized?("show", current_user) %>
+ <% if Authorization.is_authorized?("show", nil, workflow, current_user) %>
<a href="" h(workflow.title).gsub(/ /, "_") %>"><%= num %>. <%= h(workflow.title) %></a><br/>
<% num = num + 1 %>
<% end %>
Modified: branches/authorization_new/app/views/workflows/_table.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/workflows/_table.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/workflows/_table.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -7,9 +7,9 @@
<% for workflow in collection %>
<% # If only one item in collection, check if 'show' permission is available (eg: if this partial was called from contributions/table) -%>
<% if collection.size == 1 -%>
- <% show ||= workflow.authorized?("show", current_user) -%>
+ <% show ||= Authorization.is_authorized?("show", nil, workflow, current_user) -%>
<% else -%>
- <% show = workflow.authorized?("show", current_user) -%>
+ <% show = Authorization.is_authorized?("show", nil, workflow, current_user) -%>
<% end -%>
<% if show -%>
<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
@@ -56,7 +56,7 @@
<p style="font-size:85%;">
<b>Attributions:</b>
<% attributors.each do |a| %>
- <% if thing_authorized?('show', a.attributor) -%>
+ <% if Authorization.is_authorized?("show", nil, a.attributor, current_user) -%>
<% if a.attributor_type == 'Workflow' %>
<%= icon('workflow', nil, nil, nil, '') %>
<% elsif a.attributor_type == 'Blob' %>
@@ -115,7 +115,7 @@
<% end -%>
<td class="actions" style="width: 120px;">
<%= icon "show", workflow_path(workflow), nil, nil, "View" %>
- <% if workflow.authorized?("download", current_user) %><%= icon "download", download_workflow_path(workflow), nil, nil, "Download (v#{workflow.versions.count})" %><% end %>
+ <% if Authorization.is_authorized?("download", nil, workflow, current_user) %><%= icon "download", download_workflow_path(workflow), nil, nil, "Download (v#{workflow.versions.count})" %><% end %>
<% if mine?(workflow) %><%= icon "manage", edit_workflow_path(workflow), nil, nil, "Manage" %><% end %>
<br/><br/>
Modified: branches/authorization_new/app/views/workflows/_workflow.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/workflows/_workflow.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/workflows/_workflow.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -1,5 +1,5 @@
<% image = !(workflow.image.nil?) -%>
-<% show = workflow.authorized?("show", (logged_in? ? current_user : nil)) -%>
+<% show = Authorization.is_authorized?("show", nil, workflow, current_user) -%>
<% if show %>
<center>
@@ -44,10 +44,10 @@
<tr>
<td colspan="<%= show ? 3 : 2 %>">
<center>
- <% if workflow.authorized?("download", (logged_in? ? current_user : nil)) %><%= icon "download", download_workflow_path(workflow) %> <% end %>
+ <% if Authorization.is_authorized?("download", nil, workflow, current_user) %><%= icon "download", download_workflow_path(workflow) %> <% end %>
<% if show %><%= icon "show", workflow_path(workflow) %> <% end %>
- <% if logged_in? and workflow.authorized?("edit", current_user) %><%= icon "edit", edit_workflow_path(workflow) %> <% end %>
- <% if logged_in? and workflow.authorized?("destroy", current_user) %><%= icon "destroy", workflow_path(workflow), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
+ <% if logged_in? && Authorization.is_authorized?("edit", nil, workflow, current_user) %><%= icon "edit", edit_workflow_path(workflow) %> <% end %>
+ <% if logged_in? && Authorization.is_authorized?("destroy", nil, workflow, current_user) %><%= icon "destroy", workflow_path(workflow), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
</center>
</td>
</tr>
Modified: branches/authorization_new/app/views/workflows/show.rhtml (2054 => 2055)
--- branches/authorization_new/app/views/workflows/show.rhtml 2009-01-16 12:34:25 UTC (rev 2054)
+++ branches/authorization_new/app/views/workflows/show.rhtml 2009-01-16 13:15:54 UTC (rev 2055)
@@ -15,7 +15,7 @@
<% if mine?(@workflow) -%>
<li><%= icon('manage', edit_workflow_path(@workflow), nil, nil, 'Manage Workflow Entry')%></li>
<% end -%>
- <% if @workflow.authorized?("destroy", current_user) -%>
+ <% if Authorization.is_authorized?("destroy", nil, @workflow, current_user) -%>
<li>
<%= icon('destroy', workflow_path(@workflow), nil, { :confirm => 'This deletes all versions of the Workflow and all metadata such as tags, comments and citations. Are you sure?', :method => :delete }, 'Delete Workflow Entry') %>
</li>
@@ -131,7 +131,7 @@
<li style="margin-left: 0;"><%= icon('edit', workflow_version_edit_url(@workflow.id, @viewing_version.version), nil, nil, "Edit This Version") %></li>
<% if false %>
<% if @latest_version_number > 1 %>
- <% if @workflow.authorized?("destroy", current_user) %>
+ <% if Authorization.is_authorized?("destroy", nil, @workflow, current_user) %>
<li><%= icon('destroy', workflow_version_delete_url(@workflow.id, @viewing_version.version), nil, { :confirm => "Are you sure you want to delete this version (Version address@hidden) of the Workflow file (including title/description metadata)?", :method => :delete }, 'Delete This Version') %></li>
<% end %>
<% end %>