Diff
Modified: branches/wf4ever/Rakefile (3142 => 3143)
--- branches/wf4ever/Rakefile 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/Rakefile 2012-10-08 12:24:24 UTC (rev 3143)
@@ -114,7 +114,7 @@
# Obtain all public workflows
workflows = Workflow.find(:all).select do |workflow|
- Authorization.check(:action ="" 'read', :object => workflow, :user => nil)
+ Authorization.check('view', workflow, nil)
end
# Generate OAI static repository file
@@ -227,10 +227,8 @@
task "myexp:blobstore:checksum:rebuild" do
require File.dirname(__FILE__) + '/config/environment'
- ContentBlob.all.each do |blob|
- blob.update_checksums
- puts "blob changed? = #{blob.changed?}"
- blob.save if blob.changed?
- end
+ conn = ActiveRecord::Base.connection
+
+ conn.execute('UPDATE content_blobs SET sha1 = SHA1(data), md5 = MD5(data)')
end
Modified: branches/wf4ever/app/controllers/application_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/application_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/application_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -29,8 +29,12 @@
def check_for_sleeper
if request.method != :get && logged_in?
if current_user.account_status == "sleep"
- current_user.update_attribute(:account_status, "recheck")
+ current_user.update_attribute(:account_status, "sleep recheck")
end
+
+ if current_user.account_status == "suspect"
+ current_user.update_attribute(:account_status, "suspect recheck")
+ end
end
end
Modified: branches/wf4ever/app/controllers/blobs_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/blobs_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/blobs_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -338,7 +338,7 @@
:limit => 20,
:select => 'DISTINCT *')
- files = files.select {|f| Authorization.is_authorized?('view', nil, f, current_user) }
+ files = files.select {|f| Authorization.check('view', f, current_user) }
render :partial => 'contributions/autocomplete_list', :locals => { :contributions => files }
end
@@ -371,10 +371,32 @@
protected
def find_blob_auth
+
+ action_permissions = {
+ "create" => "create",
+ "destroy" => "destroy",
+ "download" => "download",
+ "edit" => "edit",
+ "favourite" => "view",
+ "favourite_delete" => "view",
+ "index" => "view",
+ "named_download" => "download",
+ "named_download_with_version" => "download",
+ "new" => "create",
+ "process_suggestions" => "edit",
+ "rate" => "view",
+ "search" => "view",
+ "show" => "view",
+ "statistics" => "view",
+ "suggestions" => "view",
+ "tag" => "view",
+ "update" => "edit"
+ }
+
begin
blob = Blob.find(params[:id])
- if Authorization.is_authorized?(action_name, nil, blob, current_user)
+ if Authorization.check(action_permissions[action_name], blob, current_user)
@blob = blob
if params[:version]
Modified: branches/wf4ever/app/controllers/blog_posts_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/blog_posts_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/blog_posts_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -75,10 +75,21 @@
protected
def find_blog_auth
+
+ action_permissions = {
+ "create" => "create",
+ "destroy" => "destroy",
+ "edit" => "edit",
+ "index" => "view",
+ "new" => "create",
+ "show" => "view",
+ "update" => "edit"
+ }
+
begin
blog = Blog.find(params[:blog_id])
- if Authorization.is_authorized?(action_name, nil, blog, current_user)
+ if Authorization.check(action_permissions[action_name], blog, current_user)
@blog = blog
else
error("Blog not found (id not authorized)", "is invalid (not authorized)")
Modified: branches/wf4ever/app/controllers/blogs_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/blogs_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/blogs_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -110,10 +110,21 @@
end
def find_blog_auth
+
+ action_permissions = {
+ "create" => "create",
+ "destroy" => "destroy",
+ "edit" => "edit",
+ "index" => "view",
+ "new" => "create",
+ "show" => "view",
+ "update" => "edit",
+ }
+
begin
blog = Blog.find(params[:id])
- if Authorization.is_authorized?(action_name, nil, blog, current_user)
+ if Authorization.check(action_permissions[action_name], blog, current_user)
@blog = blog
else
if logged_in?
Modified: branches/wf4ever/app/controllers/citations_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/citations_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/citations_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -86,11 +86,11 @@
workflow = Workflow.find(params[:workflow_id])
- if Authorization.is_authorized?((["index", "show"].include?(action_name) ? "show" : "edit"), nil, workflow, current_user)
+ if Authorization.check((["index", "show"].include?(action_name) ? "view" : "edit"), workflow, current_user)
@workflow = workflow
# remove workflow data from workflow if the user is not authorized for download
- @workflow.content_blob.data = "" unless Authorization.is_authorized?("download", nil, @workflow, current_user)
+ @workflow.content_blob.data = "" unless Authorization.check("download", @workflow, current_user)
else
if logged_in?
error("Workflow not found (id not authorized)", "is invalid (not authorized)")
Modified: branches/wf4ever/app/controllers/comments_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/comments_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/comments_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -72,7 +72,7 @@
@comment = Comment.find_by_id(params[:id])
return error if @comment.nil? || @context.nil? || @comment.commentable != @context
- return error if Authorization.is_authorized?('view', nil, @context, current_user) == false
+ return error if Authorization.check('view', @context, current_user) == false
end
def find_resource_context
@@ -80,7 +80,7 @@
@context = extract_resource_context(params)
return error if @context.nil?
- return error if Authorization.is_authorized?('view', nil, @context, current_user) == false
+ return error if Authorization.check('view', @context, current_user) == false
end
def error
Modified: branches/wf4ever/app/controllers/content_types_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/content_types_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/content_types_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -50,7 +50,7 @@
# PUT /content_types/1
def update
- if !Authorization.check(:action ="" 'edit', :object => @content_type, :user => current_user)
+ if !Authorization.check('edit', @content_type, current_user)
error("You do not have the authorisation to edit.", "is unauthorised")
return
end
Modified: branches/wf4ever/app/controllers/contributions_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/contributions_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/contributions_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -28,7 +28,7 @@
return error if @contributable.nil?
# Abort if we're not allowed to see this contributable
- return error unless Authorization.check(:action ="" 'view', :object => @contributable, :user => current_user)
+ return error unless Authorization.check('view', @contributable, current_user)
rescue
Modified: branches/wf4ever/app/controllers/experiments_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/experiments_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/experiments_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -114,9 +114,20 @@
end
def find_experiment_auth
+
+ action_permissions = {
+ "create" => "create",
+ "destroy" => "destroy",
+ "edit" => "edit",
+ "index" => "view",
+ "new" => "create",
+ "show" => "view",
+ "update" => "edit"
+ }
+
experiment = Experiment.find(:first, :conditions => ["id = ?", params[:id]])
- if experiment and Authorization.is_authorized?(action_name, nil, experiment, current_user)
+ if experiment and Authorization.check(action_permissions[action_name], experiment, current_user)
@experiment = experiment
else
error("Experiment not found or action not authorized", "is invalid (not authorized)")
Modified: branches/wf4ever/app/controllers/jobs_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/jobs_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/jobs_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -23,14 +23,14 @@
end
def show
- unless Authorization.is_authorized?(action_name, nil, @job.runnable, current_user)
+ unless Authorization.check("view", @job.runnable, current_user)
flash[:error] = "<p>You will not be able to submit this Job, but you can still see the details of it."
flash[:error] = "<p>The runnable item (address@hidden) is not authorized - you need download priviledges to run it.</p>"
end
# TODO: check that runnable version still exists
- unless Authorization.is_authorized?(action_name, nil, @job, current_user)
+ unless Authorization.check("view", @job, current_user)
flash[:error] = "You will not be able to submit this Job, but you can still see the details of it." unless flash[:error]
flash[:error] += "<p>The runner is not authorized - you need to either own it or be part of a Group that owns it.</p>"
end
@@ -112,7 +112,7 @@
end
end
- if not runnable or not Authorization.is_authorized?('download', nil, runnable, user)
+ if not runnable or not Authorization.check('download', runnable, user)
success = false
@job.errors.add(:runnable_id, "not valid or not authorized")
else
@@ -126,7 +126,7 @@
# Check runner is a valid and authorized one
# (for now we can assume it's a TavernaEnactor)
runner = TavernaEnactor.find(:first, :conditions => ["id = ?", params[:job][:runner_id]])
- if not runner or not Authorization.is_authorized?('execute', nil, runner, user)
+ if not runner or not Authorization.check('execute', runner, user)
success = false
@job.errors.add(:runner_id, "not valid or not authorized")
end
@@ -227,12 +227,12 @@
errors_text = ''
# Authorize the runnable and runner
- unless Authorization.is_authorized?(action_name, nil, @job, current_user)
+ unless Authorization.check("download", @job.runnable, current_user)
success = false;
errors_text += "<p>The runnable item (address@hidden) is not authorized - you need download priviledges to run it.</p>"
end
- unless Authorization.is_authorized?(action_name, nil, @job, current_user)
+ unless Authorization.check("edit", @job, current_user)
success = false;
errors_text += "<p>The runner is not authorized - you need to either own it or be part of a Group that owns it.</p>"
end
@@ -325,7 +325,7 @@
job.experiment = Experiment.new(:title => Experiment.default_title(user), :contributor => user)
elsif params[:change_experiment] == 'existing'
experiment = Experiment.find(params[:change_experiment_id])
- if experiment and Authorization.is_authorized?('edit', nil, experiment, user)
+ if experiment and Authorization.check('edit', experiment, user)
job.experiment = experiment
else
flash[:error] = "Job could not be created because could not assign the parent Experiment."
@@ -349,9 +349,20 @@
end
def find_experiment_auth
+
+ action_permissions = {
+ "create" => "create",
+ "destroy" => "destroy",
+ "edit" => "edit",
+ "index" => "view",
+ "new" => "create",
+ "show" => "view",
+ "update" => "edit"
+ }
+
experiment = Experiment.find(:first, :conditions => ["id = ?", params[:experiment_id]])
- if experiment and Authorization.is_authorized?(action_name, nil, experiment, current_user)
+ if experiment and Authorization.check(action_permissions[action_name], experiment, current_user)
@experiment = experiment
else
# New and Create actions are allowed to run outside of the context of an Experiment
@@ -366,9 +377,28 @@
end
def find_job_auth
+
+ action_permissions = {
+ "create" => "create",
+ "destroy" => "destroy",
+ "edit" => "edit",
+ "index" => "view",
+ "new" => "create",
+ "outputs_package" => "download",
+ "outputs_xml" => "download",
+ "refresh_outputs" => "download",
+ "refresh_status" => "download",
+ "render_output" => "download",
+ "rerun" => "download",
+ "save_inputs" => "download",
+ "show" => "view",
+ "submit_job" => "download",
+ "update" => "edit",
+ }
+
job = Job.find(:first, :conditions => ["id = ?", params[:id]])
- if job and job.experiment.id == @experiment.id and Authorization.is_authorized?(action_name, nil, job, current_user)
+ if job and job.experiment.id == @experiment.id and Authorization.check(action_permissions[action_name], job, current_user)
@job = job
else
error("Job not found or action not authorized", "is invalid (not authorized)")
Modified: branches/wf4ever/app/controllers/linked_data_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/linked_data_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/linked_data_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -161,7 +161,7 @@
return not_found if tag.nil?
return not_found if tagging.nil?
return not_found if tagging.tag != tag
- return not_auth if Authorization.is_authorized?('view', nil, tagging.taggable, current_user) == false
+ return not_auth if Authorization.check('view', tagging.taggable, current_user) == false
respond_to do |format|
if Conf.rdfgen_enable
@@ -183,7 +183,7 @@
end
return not_found if @contributable.nil?
- return not_auth if Authorization.is_authorized?('view', nil, @contributable, current_user) == false
+ return not_auth if Authorization.check('view', @contributable, current_user) == false
end
def not_found
Modified: branches/wf4ever/app/controllers/oauth_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/oauth_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/oauth_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -161,6 +161,16 @@
private
def find_client_application_auth
+
+ action_permissions = {
+ "access_token" => "view",
+ "authorize" => "view",
+ "index" => "view",
+ "request_token" => "view",
+ "test_request" => "view",
+ "show" => "view"
+ }
+
if action_name == 'update'
id = params[:client_application][:id]
else
@@ -168,7 +178,7 @@
end
begin
client_app=ClientApplication.find(id)
- if Authorization.is_authorized?(action_name, nil, client_app, current_user)
+ if Authorization.check(action_permissions[action_name], client_app, current_user)
@client_application = client_app
else
error("Client Application not found (id not authorized)", "is invalid (not authorized)")
Modified: branches/wf4ever/app/controllers/packs_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/packs_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/packs_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -363,7 +363,7 @@
errors, type, entry = @pack.resolve_link(uri, request.host, request.port.to_s, current_user)
entry.comment = params[:comment]
- @contributable = entry.contributable
+ @contributable = entry.contributable if type == 'contributable'
# By this point, we either have errors, or have an entry that needs saving.
if errors.empty? && entry.save
@@ -416,14 +416,39 @@
end
def find_pack_auth
+
+ action_permissions = {
+ "create" => "create",
+ "create_item" => "edit",
+ "destroy" => "destroy",
+ "destroy_item" => "destroy",
+ "download" => "download",
+ "edit" => "edit",
+ "edit_item" => "edit",
+ "favourite" => "view",
+ "favourite_delete" => "view",
+ "index" => "view",
+ "items" => "view",
+ "new" => "create",
+ "new_item" => "edit",
+ "quick_add" => "edit",
+ "resolve_link" => "edit",
+ "search" => "view",
+ "show" => "view",
+ "statistics" => "view",
+ "tag" => "view",
+ "update" => "edit",
+ "update_item" => "edit"
+ }
+
begin
pack = Pack.find(params[:id])
- if Authorization.is_authorized?(action_name, nil, pack, current_user)
+ if Authorization.check(action_permissions[action_name], pack, current_user)
@pack = pack
- @authorised_to_edit = logged_in? && Authorization.is_authorized?("edit", nil, @pack, current_user)
- @authorised_to_download = Authorization.is_authorized?("download", nil, @pack, current_user)
+ @authorised_to_edit = logged_in? && Authorization.check("edit", @pack, current_user)
+ @authorised_to_download = Authorization.check("download", @pack, current_user)
@pack_entry_url = url_for : false,
:host => base_host,
Modified: branches/wf4ever/app/controllers/previews_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/previews_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/previews_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -36,7 +36,7 @@
auth_object = @context
end
- if Authorization.check(:action ="" 'view', :object => auth_object, :user => user) == false
+ if Authorization.check('view', auth_object, user) == false
render :nothing => true, :status => "401 Unauthorized"
response.headers['WWW-Authenticate'] = "Basic realm=\"#{Conf.sitename} REST API\""
return
@@ -69,6 +69,11 @@
when 'svg'; content_blob = @context.preview.svg_blob
end
+ if content_blob.nil?
+ render :nothing => true, :status => "404 Not Found"
+ return
+ end
+
file_name = @context.preview.file_name(type)
send_cached_data(file_name, :type => mime_type, :disposition => 'inline') {
Modified: branches/wf4ever/app/controllers/relationships_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/relationships_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/relationships_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -53,7 +53,7 @@
# DELETE /:context_type/:context_id/relationships/:id
def destroy
- if Authorization.is_authorized?('destroy', nil, @relationship, current_user)
+ if Authorization.check('destroy', @relationship, current_user)
@relationship.destroy
end
@@ -69,7 +69,7 @@
@relationship = Relationship.find_by_id(params[:id])
return error if @relationship.nil? || @context.nil? || @relationship.context != @context
- return error if Authorization.is_authorized?('view', nil, @context, current_user) == false
+ return error if Authorization.check('view', @context, current_user) == false
end
def find_resource_context
@@ -77,7 +77,7 @@
@context = extract_resource_context(params)
return false if @context.nil?
- return false if Authorization.is_authorized?('view', nil, @context, current_user) == false
+ return false if Authorization.check('view', @context, current_user) == false
end
def error
Modified: branches/wf4ever/app/controllers/reviews_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/reviews_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/reviews_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -128,9 +128,9 @@
workflow = Workflow.find(params[:workflow_id])
- if Authorization.is_authorized?('show', nil, workflow, current_user)
+ if Authorization.check('view', workflow, current_user)
# remove workflow data from workflow if the user is not authorized for download
- workflow.content_blob.data = "" unless Authorization.is_authorized?('download', nil, workflow, current_user)
+ workflow.content_blob.data = "" unless Authorization.check('download', workflow, current_user)
@reviewable = workflow
else
if logged_in?
Modified: branches/wf4ever/app/controllers/runners_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/runners_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/runners_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -124,9 +124,21 @@
end
def find_runner_auth
+
+ action_permissions = {
+ "create" => "create",
+ "destroy" => "destroy",
+ "edit" => "edit",
+ "index" => "view",
+ "new" => "create",
+ "show" => "view",
+ "update" => "edit",
+ "verify" => "view"
+ }
+
runner = TavernaEnactor.find(:first, :conditions => ["id = ?", params[:id]])
- if runner and Authorization.is_authorized?(action_name, nil, runner, current_user)
+ if runner and Authorization.check(action_permissions[action_name], runner, current_user)
@runner = runner
else
error("Runner not found or action not authorized", "is invalid (not authorized)")
Modified: branches/wf4ever/app/controllers/tags_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/tags_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/tags_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -79,7 +79,7 @@
# Authorise entries now
taggings.each do |t|
if t.taggable.respond_to?(:contribution)
- @tagged_with << t.taggable if Authorization.is_authorized?('show', nil, t.taggable.contribution, current_user)
+ @tagged_with << t.taggable if Authorization.check('view', t.taggable.contribution, current_user)
else
@tagged_with << t.taggable
end
Modified: branches/wf4ever/app/controllers/user_reports_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/user_reports_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/user_reports_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -28,7 +28,7 @@
return error if object.nil?
# ensure that the object is visible to the user
- return error unless Authorization.check(:action ="" 'read', :object => object, :user => current_user)
+ return error unless Authorization.check('view', object, current_user)
@object = object
Modified: branches/wf4ever/app/controllers/users_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/users_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/users_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -184,13 +184,15 @@
# basic spam check
- url = ""
+ unless RAILS_ENV == 'test'
+ url = ""
- sfs_response = ActiveSupport::JSON.decode(open(url).read)
+ sfs_response = ActiveSupport::JSON.decode(open(url).read)
- if (sfs_response["success"] == 1)
- if ((sfs_response["email"]["appears"] == 1) || (sfs_response["ip"]["appears"] == 1))
- spammer = true
+ if (sfs_response["success"] == 1)
+ if ((sfs_response["email"]["appears"] == 1) || (sfs_response["ip"]["appears"] == 1))
+ spammer = true
+ end
end
end
@@ -275,7 +277,7 @@
# DELETE /users/1
def destroy
- unless Authorization.check(:action ="" 'destroy', :object => @user, :user => current_user)
+ unless Authorization.check('destroy', @user, current_user)
flash[:notice] = 'You do not have permission to delete this user.'
redirect_to :action ="" :index
return
@@ -599,7 +601,7 @@
if @to > 0
- users = User.find(:all, :conditions => ["activated_at IS NOT NULL AND id >= ? AND id <= ? AND (account_status IS NULL OR (account_status != 'sleep' AND account_status != 'whitelist'))", @from, @to])
+ users = User.find(:all, :conditions => ["activated_at IS NOT NULL AND id >= ? AND id <= ? AND (account_status IS NULL OR (account_status != 'sleep' AND account_status != 'suspect' AND account_status != 'whitelist'))", @from, @to])
@userlist = users.map do |user|
@@ -705,6 +707,8 @@
user.update_attributes(:account_status => "whitelist")
when "sleep"
user.update_attributes(:account_status => "sleep")
+ when "suspect"
+ user.update_attributes(:account_status => "suspect")
when "delete"
# build an "all elements" user.xml record
Modified: branches/wf4ever/app/controllers/workflows_controller.rb (3142 => 3143)
--- branches/wf4ever/app/controllers/workflows_controller.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/controllers/workflows_controller.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -235,7 +235,7 @@
end
@contributions_with_similar_services = @workflow.workflows_with_similar_services.select do |w|
- Authorization.is_authorized?('view', nil, w, current_user)
+ Authorization.check('view', w, current_user)
end.map do |w|
w.contribution
end
@@ -661,7 +661,7 @@
:limit => 20,
:select => 'DISTINCT *')
- wfs = wfs.select {|w| Authorization.is_authorized?('view', nil, w, current_user) }
+ wfs = wfs.select {|w| Authorization.check('view', w, current_user) }
render :partial => 'contributions/autocomplete_list', :locals => { :contributions => wfs }
end
@@ -696,6 +696,35 @@
end
def find_workflow_auth
+
+ action_permissions = {
+ "create" => "create",
+ "create_version" => "edit",
+ "destroy" => "destroy",
+ "destroy_version" => "edit",
+ "download" => "download",
+ "edit" => "edit",
+ "edit_version" => "edit",
+ "favourite" => "view",
+ "favourite_delete" => "view",
+ "galaxy_tool" => "download",
+ "galaxy_tool_download" => "download",
+ "index" => "view",
+ "launch" => "download",
+ "named_download" => "download",
+ "new" => "create",
+ "new_version" => "edit",
+ "process_tag_suggestions" => "edit",
+ "rate" => "view",
+ "search" => "view",
+ "show" => "view",
+ "statistics" => "view",
+ "tag" => "view",
+ "tag_suggestions" => "view",
+ "update" => "edit",
+ "update_version" => "edit",
+ }
+
begin
# Use eager loading only for 'show' action
if action_name == 'show'
@@ -704,7 +733,7 @@
workflow = Workflow.find(params[:id])
end
- if Authorization.is_authorized?(action_name, nil, workflow, current_user)
+ if Authorization.check(action_permissions[action_name], workflow, current_user)
@latest_version_number = workflow.current_version
@workflow = workflow
@@ -720,12 +749,12 @@
@viewing_version = @workflow.find_version(@latest_version_number)
end
- @authorised_to_edit = logged_in? && Authorization.is_authorized?('edit', nil, @workflow, current_user)
+ @authorised_to_edit = logged_in? && Authorization.check('edit', @workflow, current_user)
if @authorised_to_edit
# can save a call to .is_authorized? if "edit" was already found to be allowed - due to cascading permissions
@authorised_to_download = true
else
- @authorised_to_download = Authorization.is_authorized?('download', nil, @workflow, current_user)
+ @authorised_to_download = Authorization.check('download', @workflow, current_user)
end
# remove scufl from workflow if the user is not authorized for download
@@ -959,8 +988,8 @@
# Rewind the file, just in case
file.rewind
- workflow_to_set.title = processor_instance.get_title
- workflow_to_set.body = processor_instance.get_description
+ workflow_to_set.title = processor_instance.get_title if processor_instance.get_title
+ workflow_to_set.body = processor_instance.get_description if processor_instance.get_description
workflow_to_set.content_type = ContentType.find_by_title(processor_class.display_name)
Modified: branches/wf4ever/app/helpers/application_helper.rb (3142 => 3143)
--- branches/wf4ever/app/helpers/application_helper.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/helpers/application_helper.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -400,7 +400,7 @@
if thumb
unless w.image.nil?
- if Authorization.is_authorized?('show', nil, w, current_user)
+ if Authorization.check('view', w, current_user)
dot = image_tag url_for_file_column(w, "image", "thumb")
else
dot = image_tag url_for_file_column(w, "image", "padlock")
@@ -833,7 +833,7 @@
:joins => 'LEFT OUTER JOIN users ON workflows.contributor_type = "User" AND workflows.contributor_id = users.id',
:order => 'workflows.id ASC')
- workflows.select { |w| Authorization.is_authorized?('show', 'Workflow', w.id, current_user) }
+ workflows.select { |w| Authorization.check('view', w, current_user) }
end
def blobs_for_attribution_form
@@ -841,7 +841,7 @@
:joins => 'LEFT OUTER JOIN users ON blobs.contributor_type = "User" AND blobs.contributor_id = users.id',
:order => 'blobs.id ASC')
- blobs.select { |b| Authorization.is_authorized?('show', 'Blob', b.id, current_user) }
+ blobs.select { |b| Authorization.check('view', b, current_user) }
end
def networks_for_credits_form
@@ -1057,12 +1057,6 @@
:version => version_number)
end
- def thing_authorized?(action, thing)
- # method preserved only in case some code absolutely requires it in the future;
- # for now (Jan 2009) all occurrences of it's usage were replaced with Authorization.is_authorized?()
- return Authorization.is_authorized?(action, nil, thing, current_user)
- end
-
def strip_html(str, preserve_tags=[])
str = str.strip || ''
preserve_arr = preserve_tags.join('|') << '|\/'
Modified: branches/wf4ever/app/helpers/workflows_helper.rb (3142 => 3143)
--- branches/wf4ever/app/helpers/workflows_helper.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/helpers/workflows_helper.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -13,8 +13,8 @@
types << "Other"
end
- def get_type_dir(workflow)
- klass = workflow.processor_class
+ def get_type_dir(workflow_version)
+ klass = workflow_version.processor_class
return (klass.nil? ? "other" : h(klass.to_s.demodulize.underscore))
end
Modified: branches/wf4ever/app/models/pack.rb (3142 => 3143)
--- branches/wf4ever/app/models/pack.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/models/pack.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -190,8 +190,8 @@
next # skips all further processing and moves on to the next item
end
- download_allowed = Authorization.is_authorized?('download', nil, item_contribution, user)
- viewing_allowed = download_allowed ? true : Authorization.is_authorized?('view', nil, item_contribution, user)
+ download_allowed = Authorization.check('download', item_contribution, user)
+ viewing_allowed = download_allowed ? true : Authorization.check('view', item_contribution, user)
case item_entry.contributable_type.downcase
@@ -503,88 +503,75 @@
errors_here = Pack.new.errors
type = nil
entry = nil
-
is_remote = false
-
+
begin
-
uri = URI.parse(link)
-
- if uri.absolute?
- if is_internal_uri?(uri, host_name, host_port)
- # Attempt to initialise a pack_contributable_entry
-
- expr = /^\/(workflows|files|packs)\/(\d+)$/ # e.g: "\workflows\45"
- if uri.path =~ expr
- arr = uri.path.scan(expr)
- c_type, id = arr[0][0], arr[0][1]
-
- # Try to find the contributable item being pointed at
- case c_type.downcase
- when 'workflows'
- contributable = Workflow.find(:first, :conditions => ["id = ?", id])
- when 'files'
- contributable = Blob.find(:first, :conditions => ["id = ?", id])
- when 'packs'
- contributable = Pack.find(:first, :conditions => ["id = ?", id])
- else
- contributable = nil
+
+ if uri.relative? || (uri.absolute? && is_internal_uri?(uri, host_name, host_port))
+ # Attempt to initialise a pack_contributable_entry
+ contributable = nil
+
+ # Use Rails' routing to figure out the URL
+ begin
+ request = ActionController::Routing::Routes.recognize_path(uri.path, :method => :get)
+ model_name = request[:controller].classify
+ rescue Exception => exc
+ raise URI::InvalidURIError
+ end
+
+ if Conf.contributable_models.include?(model_name) && request[:action] == "show"
+ contributable = eval(model_name).find_by_id(request[:id])
+ else
+ is_remote = true # Treat as a remote entry
+ end
+
+ if !is_remote
+ if contributable && errors_here.empty?
+ entry = PackContributableEntry.new
+ entry.contributable = contributable
+
+ type = 'contributable'
+
+ # check if the 'contributable' is a pack, then that it's not the same pack,
+ # to which we are trying to add something at the moment
+ if contributable == self.id
+ errors_here.add_to_base('Cannot add the pack to itself')
end
-
- if contributable
- entry = PackContributableEntry.new
- entry.contributable = contributable
-
- type = 'contributable'
-
- # check if the 'contributable' is a pack, then that it's not the same pack,
- # to which we are trying to add something at the moment
- if c_type.downcase == 'packs' && contributable.id == self.id
- errors_here.add_to_base('Cannot add the pack to itself')
- end
-
- # Check if version was specified in the uri
- unless uri.query.blank?
- expr2 = /version=(\d+)/
- if uri.query =~ expr2
- entry.contributable_version = uri.query.scan(expr2)[0][0]
- end
- end
- else
- errors_here.add_to_base('The item the link points to does not exist.')
+
+ # Check if version was specified in the uri
+ entry.contributable_version = request[:version]
+
+ # maybe it was as a query instead?
+ if uri.query
+ entry.contributable_version = CGI.parse(uri.query)["version"].first.try(:to_i)
end
else
- # Treat as a remote entry
- is_remote = true
+ errors_here.add_to_base('The item the link points to does not exist.')
end
-
- else
- # Treat as a remote entry
- is_remote = true
end
else
- errors_here.add_to_base('Please provide a valid link.')
+ is_remote = true # Treat as a remote entry
end
-
+
if is_remote
entry = PackRemoteEntry.new(:title => "Link", :uri => link)
type = 'remote'
end
-
+
if entry
entry.pack = self
entry.user = current_user
end
-
+
rescue URI::InvalidURIError
errors_here.add_to_base('Really struggled to parse this link. Please could you check if it is valid.')
end
-
+
return [errors_here, type, entry]
end
-
# Checks if the uri provided points to something internally to the host site.
# Note: assumes that the host site runs on HTTP.
def is_internal_uri?(uri, host_name, host_port)
Modified: branches/wf4ever/app/models/user.rb (3142 => 3143)
--- branches/wf4ever/app/models/user.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/models/user.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -269,6 +269,20 @@
return Conf.admins.include?(self.username.downcase)
end
+ def curator?
+ return false if self.username.blank?
+ return Conf.curators.include?(self.username.downcase)
+ end
+
+ def network_admin?(network)
+ if network.class == Network
+ network.owner == self
+ else
+ result = self.networks_owned.find(:first, :conditions => { :id => network } )
+ !result.nil?
+ end
+ end
+
acts_as_site_entity
acts_as_contributor
Modified: branches/wf4ever/app/models/workflow.rb (3142 => 3143)
--- branches/wf4ever/app/models/workflow.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/models/workflow.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -114,7 +114,7 @@
metadata = {}
- if proc_class
+ if proc_class && opts[:data]
processor = proc_class.new(opts[:data])
@@ -150,7 +150,7 @@
def processor_class
if self.content_type
- @processor_class ||= WorkflowTypesHandler.processor_class_for_type_display_name(self.content_type.title)
+ @processor_class ||= WorkflowTypesHandler.processor_class_for_type_display_name(self.content_type.title)
end
end
@@ -170,25 +170,34 @@
end
def get_workflow_processor(version = current_version)
- return nil unless (workflow_version = self.find_version(version))
- return (self.processor_class.nil? ? nil : self.processor_class.new(workflow_version.content_blob.data))
+
+ return nil unless workflow_version = self.find_version(version)
+ return nil unless version_processor = workflow_version.processor_class
+
+ version_processor.new(workflow_version.content_blob.data)
end
def get_workflow_model_object(version)
- return nil unless (workflow_version = self.find_version(version))
- return (self.processor_class.nil? ? nil : self.processor_class.new(workflow_version.content_blob.data).get_workflow_model_object)
+
+ return nil unless version_processor = get_workflow_processor(version)
+
+ version_processor.get_workflow_model_object
end
-
+
def get_search_terms(version)
- return nil unless (workflow_version = self.find_version(version))
- return (self.processor_class.nil? ? nil : self.processor_class.new(workflow_version.content_blob.data).get_search_terms)
+
+ return nil unless version_processor = get_workflow_processor(version)
+
+ version_processor.get_search_terms
end
# Begin acts_as_runnable overridden methods
def get_input_ports(version)
- return nil unless (workflow_version = self.find_version(version))
- return (self.processor_class.nil? ? nil : self.processor_class.new(workflow_version.content_blob.data).get_workflow_model_input_ports)
+
+ return nil unless version_processor = get_workflow_processor(version)
+
+ return version_processor.get_workflow_model_input_ports
end
# End acts_as_runnable overridden methods
Modified: branches/wf4ever/app/models/workflow_version.rb (3142 => 3143)
--- branches/wf4ever/app/models/workflow_version.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/models/workflow_version.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -3,6 +3,8 @@
# Copyright (c) 2012 University of Manchester and the University of Southampton.
# See license.txt for details.
+require 'lib/previews'
+
class WorkflowVersion < ActiveRecord::Base
is_version_of :workflow
@@ -22,8 +24,8 @@
has_previews
def components
- if workflow.processor_class
- workflow.processor_class.new(content_blob.data).get_components
+ if processor_class
+ processor_class.new(content_blob.data).get_components
else
XML::Node.new('components')
end
Modified: branches/wf4ever/app/views/announcements/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/announcements/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/announcements/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,7 +1,6 @@
<li><%= link_to 'Announcements', announcements_path -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@announcement.title) -%></li>
@@ -9,7 +8,6 @@
<li>New Announcement</li>
<% when "edit" %>
<li><%= link_to "#{h(@announcement.title)}", announcement_path(@announcement) -%></li>
- <li>></li>
<li>Edit</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/blobs/_blob.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blobs/_blob.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blobs/_blob.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -23,9 +23,9 @@
</tr>
<tr>
<td colspan="2">
- <% if Authorization.is_authorized?('download', nil, blob, current_user) %><%= icon "download", download_blob_path(blob) %> <% end %>
- <% if Authorization.is_authorized?('show', nil, blob, current_user) %><%= icon "show", blob_url(blob), nil, nil, "View" %> <% end %>
- <% if logged_in? and Authorization.is_authorized?('edit', nil, blob, current_user) %><%= icon "edit", edit_blob_path(blob) %> <% end %>
+ <% if Authorization.check('download', blob, current_user) %><%= icon "download", download_blob_path(blob) %> <% end %>
+ <% if Authorization.check('view', blob, current_user) %><%= icon "show", blob_url(blob), nil, nil, "View" %> <% end %>
+ <% if logged_in? and Authorization.check('edit', blob, current_user) %><%= icon "edit", edit_blob_path(blob) %> <% end %>
<% if logged_in? and blob.owner?(current_user) %><%= icon "destroy", blob_path(blob), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
</td>
</tr>
Modified: branches/wf4ever/app/views/blobs/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blobs/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blobs/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,7 +1,6 @@
<li><%= link_to 'Files', blobs_path -%></li>
<% if ["show", "new", "edit", "all", "search", "suggestions"].include? controller.action_name.to_s -%>
- <li>></li>
<% case controller.action_name.to_s; when "show" -%>
<li><%= contributable_name(@blob.id, 'Blob') -%></li>
@@ -9,7 +8,6 @@
<li>Upload File</li>
<% when "edit" %>
<li><%= link_to "#{contributable_name(@blob.id, 'Blob')}", blob_path(@blob) -%></li>
- <li>></li>
<li>Manage</li>
<% when "all" %>
<li>All Files</li>
@@ -17,7 +15,6 @@
<li>Search Results</li>
<% when "suggestions" %>
<li><%= link_to "#{contributable_name(@blob.id, 'Blob')}", blob_path(@blob) -%></li>
- <li>></li>
<li>Suggestions</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/blobs/_table.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blobs/_table.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blobs/_table.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -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 ||= Authorization.is_authorized?('show', nil, blob, current_user) -%>
+ <% show ||= Authorization.check('view', blob, current_user) -%>
<% else -%>
- <% show = Authorization.is_authorized?('show', nil, blob, current_user) -%>
+ <% show = Authorization.check('view', blob, current_user) -%>
<% end -%>
<% if show -%>
<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
@@ -49,7 +49,7 @@
<p style="font-size:85%;">
<b>Attributions:</b>
<% attributors.each do |a| %>
- <% if Authorization.is_authorized?("show", nil, a.attributor, current_user) -%>
+ <% if Authorization.check("view", a.attributor, current_user) -%>
<% if a.attributor_type == 'Workflow' %>
<%= icon('workflow', nil, nil, nil, '') %>
<% elsif a.attributor_type == 'Blob' %>
@@ -96,7 +96,7 @@
<td class="actions" style="width: 80px;">
<%= icon "show", blob_path(blob), nil, nil, "View" %>
- <% if Authorization.is_authorized?("download", nil, blob, current_user) %><%= icon "download", download_blob_path(blob) %><% end %>
+ <% if Authorization.check("download", blob, current_user) %><%= icon "download", download_blob_path(blob) %><% end %>
<% if mine?(blob) %><%= icon "manage", edit_blob_path(blob), nil, nil, "Manage" %><% end %>
</td>
</tr>
Modified: branches/wf4ever/app/views/blobs/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blobs/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blobs/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -4,7 +4,7 @@
<% if mine?(@blob) -%>
<li><%= icon('manage', edit_blob_path(@blob), nil, nil, 'Manage File Entry')%></li>
<% end -%>
- <% if Authorization.is_authorized?('destroy', nil, @blob, current_user) %>
+ <% if Authorization.check('destroy', @blob, current_user) %>
<li><%= icon('destroy', blob_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>
@@ -88,7 +88,7 @@
Download
</h3>
- <% if Authorization.is_authorized?('download', nil, @blob, current_user) %>
+ <% if Authorization.check('download', @blob, current_user) %>
<ul class="sectionIcons">
<li><%= icon('blob', @named_download_url, "Download File", nil, "Download File") %></li>
</ul>
@@ -116,7 +116,7 @@
:owner_id => ((@blob.contributor_type == 'User') ? @blob.contributor_id : nil),
:add_path => tag_blob_path(@blob),
:edit_path => edit_blob_path(@blob),
- :allow_edit => Authorization.is_authorized?('edit', nil, @blob, current_user) } %>
+ :allow_edit => Authorization.check('edit', @blob, current_user) } %>
<%= render :partial => "contributions/shared_with_groups_box", :locals => { :contributable => @blob } %>
@@ -159,7 +159,7 @@
<%= render :partial => "contributions/sharing_summary", :locals => { :contributable => @blob } %>
<%= render :partial => "contributions/updating_summary", :locals => { :contributable => @blob } %>
- <% if Authorization.is_authorized?('edit', nil, @blob, current_user) %>
+ <% if Authorization.check('edit', @blob, current_user) %>
<ul class="sectionIcons">
<li><%= icon('edit', edit_blob_path(@blob), nil, nil, 'Edit')%></li>
</ul>
Modified: branches/wf4ever/app/views/blog_posts/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blog_posts/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blog_posts/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,12 +1,8 @@
<li><%= link_to 'Blogs', blogs_path %></li>
-<li>></li>
-
<li><%= link_to "#{h(@blog_post.blog.title)}", blog_path(@blog_post.blog) %></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s %>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= link_to "View: #{h(@blog_post.title)}", blog_blog_post_path(@blog_post.blog, @blog_post) %></li>
<% when "new" %>
Modified: branches/wf4ever/app/views/blog_posts/_subnav.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blog_posts/_subnav.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blog_posts/_subnav.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,6 +1,6 @@
<% case controller.action_name.to_s; when "show" %>
- <% if logged_in? && Authorization.is_authorized?("edit", nil, @blog_post.blog, current_user) %>
+ <% if logged_in? && Authorization.check("edit", @blog_post.blog, current_user) %>
<ul class="sectionIcons">
<li><%= link_to 'Edit Blog Post', edit_blog_blog_post_path(@blog_post.blog, @blog_post) %></li>
</ul>
Modified: branches/wf4ever/app/views/blog_posts/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blog_posts/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blog_posts/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,4 +1,4 @@
-<% if logged_in? && Authorization.is_authorized?("edit", nil, @blog_post.blog, current_user) %>
+<% if logged_in? && Authorization.check("edit", @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/wf4ever/app/views/blogs/_blog.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blogs/_blog.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blogs/_blog.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -23,11 +23,11 @@
<tr>
<td colspan="2">
<center>
- <% 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 %>
+ <% if Authorization.check("view", blog, current_user) %><%= icon "show", blog_path(blog), nil, nil, "View" %> <% end %>
+ <% if logged_in? && Authorization.check("edit", blog, current_user) %><%= icon "edit", edit_blog_path(blog) %> <% end %>
+ <% if logged_in? && Authorization.check("destroy", blog, current_user) %><%= icon "destroy", blog_path(blog), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
</center>
</td>
</tr>
</table>
-</center>
\ No newline at end of file
+</center>
Modified: branches/wf4ever/app/views/blogs/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blogs/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blogs/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,8 +1,6 @@
<li><%= link_to 'Blogs', blogs_path %></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s %>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= link_to "View: #{h(@blog.title)}", blog_path(@blog) %></li>
<% when "new" %>
Modified: branches/wf4ever/app/views/blogs/_table.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blogs/_table.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blogs/_table.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -19,12 +19,12 @@
<td><%=h blog.posts.length %></td>
<td><%=datetime(blog.posts[-1].created_at, false) unless blog.posts.empty? %></td>
<td class="actions">
- <% 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 Authorization.check("view", blog, current_user) %><%= icon "show", blog_path(blog), nil, nil, "View" %> <% end %>
+ <% if logged_in? && Authorization.check("edit", 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 %>
</table>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/wf4ever/app/views/blogs/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/blogs/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/blogs/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -6,12 +6,12 @@
<% if logged_in? %>
<ul class="sectionIcons">
- <% if Authorization.is_authorized?("edit", nil, @blog, current_user) %>
+ <% if Authorization.check("edit", @blog, current_user) %>
<li><%= icon('new', new_blog_blog_post_path(@blog), nil, nil, "New post") %></li>
<li><%= icon('edit', edit_blog_path(@blog), nil, nil, 'Edit ' + truncate(@blog.title, :length => 10)) %></li>
<% end %>
- <% if Authorization.is_authorized?("destroy", nil, @blog, current_user) %>
+ <% if Authorization.check("destroy", @blog, current_user) %>
<li><%= icon('destroy', blog_path(@blog), nil, { :confirm => 'Are you sure?', :method => :delete }, 'Remove ' + truncate(@blog.title, :length => 10)) %></li>
<% end %>
</ul>
@@ -23,7 +23,7 @@
<%= render :partial => "blog_posts/post", :collection => @blog.posts %>
<% end %>
-<% if logged_in? and Authorization.is_authorized?("destroy", nil, @blog, current_user) %>
+<% if logged_in? and Authorization.check("destroy", @blog, current_user) %>
<h2>History</h2>
<%= render :partial => "contributions/history", :object => @blog.contribution %>
Modified: branches/wf4ever/app/views/bookmarks/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/bookmarks/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/bookmarks/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,8 +1,6 @@
<li><%= link_to 'Bookmarks', bookmarks_path %></li>
<% if ["show"].include? controller.action_name.to_s %>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= link_to "View: #{contributable(@bookmark.bookmarkable_id, @bookmark.bookmarkable_type, false)}", bookmark_path(@bookmark) %></li>
<% else %>
Modified: branches/wf4ever/app/views/citations/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/citations/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/citations/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,23 +1,16 @@
<li><%= link_to 'Workflows', workflows_path -%></li>
-<li>></li>
-
<li><%= link_to "#{h(@workflow.title)}", workflow_path(@workflow) -%></li>
-<li>></li>
-
<li><%= link_to 'Citations', workflow_citations_path(@workflow) -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@citation.title) -%></li>
<% when "new" %>
<li>New Citation</li>
<% when "edit" %>
<li><%= link_to "#{h(@citation.title)}", workflow_citation_path(@workflow, @citation) %></li>
- <li>></li>
<li>Edit</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/citations/_citation.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/citations/_citation.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/citations/_citation.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -12,7 +12,7 @@
<%= arr[i] %><%= "," unless i.to_i == arr.length.to_i - 1 %>
<% end %>
-<% if actions and Authorization.is_authorized?("edit", nil, item, current_user) %>
+<% if actions and Authorization.check("edit", item, current_user) %>
<small>[<%= link_to "view", workflow_citation_path(item, citation) %>]</small>
<small>[<%= link_to "edit", edit_workflow_citation_path(item, citation) %>]</small>
<% end %>
Modified: branches/wf4ever/app/views/citations/_table.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/citations/_table.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/citations/_table.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -27,8 +27,8 @@
<% end %>
<td class="actions">
<%= icon "show", workflow_citation_path(workflow, citation), nil, nil, "View" %>
- <% if logged_in? && Authorization.is_authorized?("edit", nil, @workflow, current_user) %><%= icon "edit", edit_workflow_citation_path(workflow, citation) %> <% end %>
- <% if logged_in? && Authorization.is_authorized?("destroy", nil, @workflow, current_user) %><%= icon "destroy", workflow_citation_path(workflow, citation), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
+ <% if logged_in? && Authorization.check("edit", @workflow, current_user) %><%= icon "edit", edit_workflow_citation_path(workflow, citation) %> <% end %>
+ <% if logged_in? && Authorization.check("destroy", @workflow, current_user) %><%= icon "destroy", workflow_citation_path(workflow, citation), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
</td>
</tr>
<% end %>
Modified: branches/wf4ever/app/views/citations/index.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/citations/index.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/citations/index.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,6 +1,6 @@
<h1>Citations for Workflow: <%= contributable(@workflow.id, 'Workflow') -%></h1>
-<% if Authorization.is_authorized?("edit", nil, @workflow, current_user) %>
+<% if Authorization.check("edit", @workflow, current_user) %>
<ul class="sectionIcons">
<li><%= icon('new', new_workflow_citation_path(@workflow), nil, nil, 'New Citation', nil) %></li>
</ul>
Modified: branches/wf4ever/app/views/citations/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/citations/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/citations/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -2,11 +2,11 @@
<ul class="sectionIcons">
<% if logged_in? %>
- <% if Authorization.is_authorized?("edit", nil, @workflow, current_user) %>
+ <% if Authorization.check("edit", @workflow, current_user) %>
<li><%= icon('edit', edit_workflow_citation_path(@workflow, @citation), nil, nil, 'Edit Citation') %></li>
<% end %>
- <% if Authorization.is_authorized?("destroy", nil, @workflow, current_user) %>
+ <% if Authorization.check("destroy", @workflow, current_user) %>
<li><%= icon('destroy', workflow_citation_path(@workflow, @citation), nil, { :confirm => 'Are you sure?', :method => :delete }, 'Delete Citation') %></li>
<% end %>
<% end %>
Modified: branches/wf4ever/app/views/comments/_comment.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/comments/_comment.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/comments/_comment.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -17,7 +17,7 @@
<tr>
<td style="text-align: right; padding-right: 1em;">
<%= render(:partial => 'contributions/user_report', :locals => { :subject => comment, :user => current_user }) -%>
- <% if Authorization.check(:action ="" 'destroy', :object => comment, :user => current_user) %>
+ <% if Authorization.check('destroy', comment, current_user) %>
<small>
[
<%= link_to_remote( "delete",
Modified: branches/wf4ever/app/views/content_types/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/content_types/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/content_types/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -2,8 +2,6 @@
<% if ["show"].include? controller.action_name.to_s %>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@content_type.title) %></li>
<% end %>
Modified: branches/wf4ever/app/views/content_types/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/content_types/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/content_types/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -3,7 +3,7 @@
<ul class="sectionIcons">
<li><%= icon('workflow', content_types_path, nil, nil, 'Show all types')%></li>
<li><%= icon('workflow', "/address@hidden", nil, nil, 'Browse content')%></li>
- <% if Authorization.check(:action ="" 'edit', :object => @content_type, :user => current_user) %>
+ <% if Authorization.check('edit', @content_type, current_user) %>
<li><%= icon('manage', edit_content_type_path(@content_type), nil, nil, 'Manage Content Type Entry')%></li>
<% end -%>
</ul>
Modified: branches/wf4ever/app/views/contributions/_attributed_by.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/contributions/_attributed_by.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/contributions/_attributed_by.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -16,7 +16,7 @@
<% if a.attributable.nil? -%>
<span class="none_text">Item doesn't exist anymore</span>
<% else -%>
- <% if Authorization.is_authorized?("show", nil, a.attributable, current_user) -%>
+ <% if Authorization.check("view", a.attributable, current_user) -%>
<% if a.attributable_type == 'Workflow' %>
<%= icon('workflow', nil, nil, nil, '') %>
<% elsif a.attributable_type == 'Blob' %>
@@ -36,4 +36,4 @@
<p class="none_text">None</p>
<% end %>
-</div>
\ No newline at end of file
+</div>
Modified: branches/wf4ever/app/views/contributions/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/contributions/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/contributions/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,8 +1,6 @@
<% if controller.action_name == 'curation' %>
<li><%= link_to(params[:contributable_type].humanize.capitalize, "/#{params[:contributable_type]}") %></li>
- <li>></li>
<li><%= link_to(@contributable.label, "/#{params[:contributable_type]}/#{params[:contributable_id]}") %></li>
- <li>></li>
<li>Curation</li>
<% end %>
Modified: branches/wf4ever/app/views/contributions/_citations_tab.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/contributions/_citations_tab.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/contributions/_citations_tab.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -15,7 +15,7 @@
<br/>
- <% if Authorization.is_authorized?("edit", nil, item, current_user) %>
+ <% if Authorization.check("edit", item, current_user) %>
<ul class="sectionIcons">
<li><%= icon('new', new_workflow_citation_path(item), nil, nil, 'New Citation', nil) %></li>
<li><%= icon('edit', workflow_citations_path(item), nil, nil, 'Edit Citations', nil) %></li>
Modified: branches/wf4ever/app/views/contributions/_credit_attribution_form.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/contributions/_credit_attribution_form.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/contributions/_credit_attribution_form.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -257,7 +257,7 @@
// Attributions
<% contributable.attributors.each do |a| %>
- <% if Authorization.is_authorized?("show", nil, a.attributor, current_user) -%>
+ <% if Authorization.check("view", a.attributor, current_user) -%>
<% if a.attributor_type == 'Workflow' %>
attributions_workflows[<%= a.attributor_id %>] = '<%= escape_javascript contributable_name(a.attributor_id, 'Workflow') %>';
<% elsif a.attributor_type == 'Blob' %>
Modified: branches/wf4ever/app/views/contributions/_credits_attributions_box.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/contributions/_credits_attributions_box.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/contributions/_credits_attributions_box.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -45,7 +45,7 @@
<% if a.attributor.nil? -%>
<span class="none_text">Item doesn't exist anymore</span>
<% else -%>
- <% if Authorization.is_authorized?("show", nil, a.attributor, current_user) -%>
+ <% if Authorization.check("view", a.attributor, current_user) -%>
<% if a.attributor_type == 'Workflow' %>
<%= icon('workflow', nil, nil, nil, '') %>
<% elsif a.attributor_type == 'Blob' %>
@@ -65,8 +65,8 @@
<p class="none_text">None</p>
<% end %>
- <% if Authorization.is_authorized?("edit", nil, contributable, current_user) %>
+ <% if Authorization.check("edit", contributable, current_user) %>
<p style="text-align: right;"><small>[ <%= link_to "edit", edit_path %> ]</small></p>
<% end %>
-</div>
\ No newline at end of file
+</div>
Modified: branches/wf4ever/app/views/contributions/_in_packs_box.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/contributions/_in_packs_box.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/contributions/_in_packs_box.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -10,7 +10,7 @@
<ul class="items">
<% packs.each do |p| %>
<li>
- <% if Authorization.is_authorized?("show", nil, p, current_user) -%>
+ <% if Authorization.check("view", p, current_user) -%>
<%= icon('pack', nil, nil, nil, '') %>
<%= contributable(p.id, 'Pack') %>
<% else -%>
Modified: branches/wf4ever/app/views/contributions/_table.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/contributions/_table.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/contributions/_table.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,7 +1,7 @@
<% unless collection.empty? %>
<% for contribution in collection %>
- <% if (show = Authorization.is_authorized?("show", nil, contribution, current_user)) %>
+ <% if (show = Authorization.check("view", contribution.contributable, current_user)) %>
<% unless params[:contributable_type] %>
<p style="margin-top: 0.5em;"><b><%= visible_name(contribution.contributable_type) %></b></p>
<% end %>
Modified: branches/wf4ever/app/views/experiments/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/experiments/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/experiments/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,15 +1,12 @@
<li><%= link_to 'Experiments', experiments_path -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" -%>
<li><%= h(@experiment.title) -%></li>
<% when "new" %>
<li>New Experiment</li>
<% when "edit" %>
<li><%= link_to "#{h(@experiment.title)}", experiment_path(@experiment) -%></li>
- <li>></li>
<li>Manage</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/experiments/_table.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/experiments/_table.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/experiments/_table.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -33,7 +33,7 @@
</td>
<td class="actions" style="width: 80px;">
<%= icon "show", experiment_path(experiment), nil, nil, "View" %>
- <% if Authorization.is_authorized?('edit', nil, experiment, current_user) %>
+ <% if Authorization.check('edit', experiment, current_user) %>
<%= icon('edit', edit_experiment_path(experiment), nil, nil, 'Edit') %>
<% end %>
<%= icon "job", new_experiment_job_path(experiment), nil, nil, "New Job" %>
Modified: branches/wf4ever/app/views/experiments/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/experiments/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/experiments/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,6 +1,6 @@
<% t "#{h @experiment.title}" -%>
-<% if Authorization.is_authorized?('edit', nil, @experiment, current_user) -%>
+<% if Authorization.check('edit', @experiment, current_user) -%>
<ul class="sectionIcons">
<li><%= icon('edit', edit_experiment_path(@experiment), nil, nil, 'Edit Experiment') %></li>
</ul>
Modified: branches/wf4ever/app/views/friendships/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/friendships/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/friendships/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,19 +1,13 @@
<% if @user %>
<li><%= link_to 'Users', users_path %></li>
- <li>></li>
-
<li><%= name(@user) %></li>
- <li>></li>
-
<li><%= link_to 'Friendships', user_friendships_path(@user) %></li>
<% else %>
<li><%= link_to 'Friendships', url_for(:controller => :friendships) %>
<% end %>
<% if ["show"].include? controller.action_name.to_s %>
- <li>></li>
-
<li><%= link_to "View: #{h(@friendship.user.name)}", user_friendship_path(@friendship.friend, @friendship) %></li>
<% end %>
Modified: branches/wf4ever/app/views/gadgets/_most_popular_tags.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/gadgets/_most_popular_tags.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/gadgets/_most_popular_tags.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -3,7 +3,7 @@
<div class="header">
<p>
- <b>Popular Tags</b><br />
+ Popular Tags<br />
<small><%= pluralize(limit, "tag") %></small><br/>
<small>[<%= link_to "All Tags", tags_path %>]</small>
</p>
Modified: branches/wf4ever/app/views/gadgets/_network_monitor.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/gadgets/_network_monitor.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/gadgets/_network_monitor.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -2,7 +2,7 @@
<div class="header">
<p>
- <b><%= title(network) %></b><br/>
+ <%= title(network) %><br/>
<small>
<%= pluralize(network.members(false).length, "member") %>, <%= pluralize(network.contributions.length, "contribution") %>
</small>
Modified: branches/wf4ever/app/views/gadgets/_user_favourites.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/gadgets/_user_favourites.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/gadgets/_user_favourites.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -5,7 +5,7 @@
<div class="header">
<p>
- <b>My Favourites</b><br />
+ My Favourites<br />
<small>
<%= link_to(pluralize(current_user.bookmarks.length, "favourite"), currentusers_things_url('favourites')) %>
</small>
Modified: branches/wf4ever/app/views/gadgets/_user_tags.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/gadgets/_user_tags.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/gadgets/_user_tags.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -4,7 +4,7 @@
<div class="header">
<p>
- <b>My Tags</b><br />
+ My Tags<br />
<small>
<%= link_to(pluralize(current_user.tags.length, "tag"), currentusers_things_url('tags')) %>
</small>
Modified: branches/wf4ever/app/views/group_announcements/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/group_announcements/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/group_announcements/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,19 +1,14 @@
<li><%= link_to 'Groups', networks_path -%></li>
-<li>></li>
<li><b><%= link_to h(@group.title), network_path(@group) -%></b></li>
-<li>></li>
<li><b><%= link_to "Group Announcements", group_announcements_path(@group) -%></b>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" -%>
<li><%= truncate(h(@announcement.title), :length => 50) -%></li>
<% when "new" -%>
<li>New Announcement</li>
<% when "edit" -%>
<li><%= link_to "#{truncate(h(@announcement.title), :length => 50)}", group_announcement_path(@group, @announcement) -%></li>
- <li>></li>
<li>Edit</li>
<% else -%>
<!-- no specific breadcrumb for other actions -->
Modified: branches/wf4ever/app/views/home/_latest_comments.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/home/_latest_comments.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/home/_latest_comments.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -9,7 +9,7 @@
<% unless (comments = Comment.latest).empty? %>
<ul class="list">
<% comments.each do |c| %>
- <% if Authorization.is_authorized?("show", nil, c.commentable, current_user) %>
+ <% if Authorization.check("view", c.commentable, current_user) %>
<li>
<b><%= c_type = visible_name(c.commentable_type); icon(c.commentable_type.to_s, nil, nil, c_type, c_type) %>:</b>
<span><%= c.commentable_type == 'Network' ? title(c.commentable_id) : contributable(c.commentable_id, c.commentable_type) %></span>
Modified: branches/wf4ever/app/views/home/_latest_groups.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/home/_latest_groups.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/home/_latest_groups.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -9,7 +9,7 @@
<% unless (groups = Network.recently_created).empty? %>
<ul class="list" style="font-size: 85%;">
<% groups.each do |g| %>
- <% if Authorization.is_authorized?("show", nil, g, current_user) %>
+ <% if Authorization.check("view", g, current_user) %>
<li>
<%= icon('network', nil, nil, 'group icon', '') %>
<b><%= link_to h(g.title), network_path(g) %></b>
Modified: branches/wf4ever/app/views/home/_latest_reviews.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/home/_latest_reviews.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/home/_latest_reviews.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -9,7 +9,7 @@
<% unless (reviews = Review.latest).empty? %>
<ul class="list">
<% reviews.each do |r| %>
- <% if Authorization.is_authorized?("show", nil, r.reviewable, current_user) %>
+ <% if Authorization.check("view", r.reviewable, current_user) %>
<li>
<b><%= r_type = visible_name(r.reviewable_type); icon(r.reviewable_type.to_s, nil, nil, r_type, r_type) %>:</b>
<span><%= contributable(r.reviewable_id, r.reviewable_type) %></span>
Modified: branches/wf4ever/app/views/home/_latest_tags.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/home/_latest_tags.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/home/_latest_tags.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -9,7 +9,7 @@
<% unless (taggings = Tagging.latest(20)).empty? %>
<ul class="list" style="font-size: 85%;">
<% taggings.each do |t| %>
- <% if Authorization.is_authorized?("show", nil, t.taggable, current_user) %>
+ <% if Authorization.check("view", t.taggable, current_user) %>
<li>
<span class="box_standout" style="padding: 0.1em 0.4em;">
<b><%= link_to_tag(t.tag) %></b>
Modified: branches/wf4ever/app/views/home/_updated_items.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/home/_updated_items.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/home/_updated_items.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -8,7 +8,7 @@
<% unless (contributions = Contribution.last_updated(15)).empty? %>
<ul class="list">
<% contributions.each do |c| %>
- <% if Authorization.is_authorized?("show", nil, c, current_user) %>
+ <% if Authorization.check("view", c, current_user) %>
<li>
<b><%= c_type = visible_name(c.contributable_type); icon(c.contributable_type.to_s, nil, nil, c_type, c_type) %>:</b>
<%= c.contributable_type == 'Network' ? title(c.contributable_id) : contributable(c.contributable_id, c.contributable_type) %>
Modified: branches/wf4ever/app/views/jobs/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/jobs/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/jobs/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,23 +1,16 @@
<% if @experiment -%>
<li><%= link_to 'Experiments', experiments_path -%></li>
- <li>></li>
-
<li><%= link_to "#{h(@experiment.title)}", experiment_path(@experiment) -%></li>
- <li>></li>
-
<li><%= link_to 'Jobs', experiment_jobs_path(@experiment) -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" -%>
<li><%= h(@job.title) -%></li>
<% when "new" %>
<li>New Job</li>
<% when "edit" %>
<li><%= link_to "#{h(@job.title)}", experiment_job_path(@experiment, @job) -%></li>
- <li>></li>
<li>Manage</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/jobs/_table.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/jobs/_table.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/jobs/_table.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -45,7 +45,7 @@
<td class="actions" style="width: 80px;">
<%= icon "show", experiment_job_url(job.experiment, job), nil, nil, "View" %>
<% if false -%>
- <% if Authorization.is_authorized?('edit', nil, job, current_user) -%>
+ <% if Authorization.check('edit', job, current_user) -%>
<%= icon('edit', edit_experiment_job_path(job.experiment, job), nil, nil, 'Edit') %>
<% end -%>
<% end -%>
Modified: branches/wf4ever/app/views/layouts/_breadcrumbs_bar.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/layouts/_breadcrumbs_bar.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/layouts/_breadcrumbs_bar.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -3,7 +3,6 @@
<td>
<ul class="breadcrumb_list">
<li><%= link_to "Home", home_url %></li>
- <li>></li>
<%= render :partial => "breadcrumbs" %>
</ul>
</td>
Modified: branches/wf4ever/app/views/layouts/_pack_items.rxml (3142 => 3143)
--- branches/wf4ever/app/views/layouts/_pack_items.rxml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/layouts/_pack_items.rxml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,5 +1,5 @@
pack.contributable_entries.each do |e|
- show = e.available? ? Authorization.is_authorized?("show", nil, e.contributable, current_user) : false
+ show = e.available? ? Authorization.check("view", e.contributable, current_user) : false
xm.item do
if show
xm.title "#{visible_name(e.contributable_type)}: #{contributable_name(e.contributable_id, e.contributable_type)}"
@@ -45,4 +45,4 @@
xm.author contributor_name(e.user_id, 'User')
xm.link pack_url(pack) + "#item_remote_#{e.id.to_s}"
end
-end
\ No newline at end of file
+end
Modified: branches/wf4ever/app/views/licenses/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/licenses/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/licenses/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,15 +1,12 @@
<li><%= link_to 'Licenses', licenses_path -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@license.title) -%></li>
<% when "new" %>
<li>New License</li>
<% when "edit" %>
<li><%= link_to "#{h(@license.title)}", license_path(@license) -%></li>
- <li>></li>
<li>Edit</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/mashup/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/mashup/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/mashup/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,8 +1,6 @@
<li><%= link_to 'Mashup', mashup_path %></li>
<% if ["show", "api"].include? controller.action_name.to_s %>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li>Resources</li>
<% when "api" %>
Modified: branches/wf4ever/app/views/memberships/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/memberships/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/memberships/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,19 +1,13 @@
<% if @user %>
<li><%= link_to 'Users', users_path %></li>
- <li>></li>
-
<li><%= name(@user) %></li>
- <li>></li>
-
<li><%= link_to 'Memberships', user_memberships_path(@user) %></li>
<% else %>
<li><%= link_to 'Memberships', url_for(:controller => :memberships) %>
<% end %>
<% if ["show"].include? controller.action_name.to_s %>
- <li>></li>
-
<li><%= link_to "View: #{h(@membership.network.title)}", user_membership_path(@membership.user, @membership) %></li>
<% end %>
Modified: branches/wf4ever/app/views/messages/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/messages/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/messages/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,8 +1,6 @@
<li><%= link_to 'Messages', messages_path -%></li>
<% if ["show", "new"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@message.subject) -%></li>
<% when "new" %>
Modified: branches/wf4ever/app/views/networks/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/networks/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/networks/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,15 +1,12 @@
<li><%= link_to 'Groups', networks_path -%></li>
<% if ["show", "new", "edit", "search", "all", "invite"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@network.title) -%></li>
<% when "new" %>
<li>New Group</li>
<% when "edit" %>
<li><%= link_to "#{h(@network.title)}", network_path(@network) %></li>
- <li>></li>
<li>Manage</li>
<% when "search" %>
<li>Search Results</li>
@@ -17,7 +14,6 @@
<li>All Groups</li>
<% when "invite" %>
<li><%= link_to "#{h(@network.title)}", network_path(@network) %></li>
- <li>></li>
<li>Invite people to group</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/oauth/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/oauth/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/oauth/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,17 +1,14 @@
<li><%= link_to 'OAuth', oauth_path %></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" -%>
<li><%= @client_application.name -%></li>
<% when "new" %>
<li>Regsiter Client Application</li>
<% when "edit" %>
<li><%= link_to @client_application.name, {:controller=>'oauth', :action="" -%></li>
- <li>></li>
<li>Update</li>
<% else %>
<!-- no breadcrumb -->
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/wf4ever/app/views/openid/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/openid/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/openid/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,5 +1,3 @@
<li><%= name(current_user) %></li>
-<li>></li>
-
-<li>Validate OpenID URL</li>
\ No newline at end of file
+<li>Validate OpenID URL</li>
Modified: branches/wf4ever/app/views/packs/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/packs/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/packs/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,23 +1,18 @@
<li><%= link_to 'Packs', packs_path %></li>
<% if ["show", "new", "edit", "all", "new_item", "edit_item", "search"].include? controller.action_name.to_s %>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@pack.title) %></li>
<% when "new" %>
<li>New Pack</li>
<% when "edit" %>
<li><%= link_to "#{h(@pack.title)}", pack_path(@pack) %></li>
- <li>></li>
<li>Manage</li>
<% when "new_item" %>
<li><%= link_to "#{h(@pack.title)}", pack_path(@pack) %></li>
- <li>></li>
<li>Add New Item</li>
<% when "edit_item" %>
<li><%= link_to "#{h(@pack.title)}", pack_path(@pack) %></li>
- <li>></li>
<li>Edit Item Entry</li>
<% when "all" %>
<li>All Packs</li>
Modified: branches/wf4ever/app/views/packs/_entry_item.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/packs/_entry_item.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/packs/_entry_item.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -2,7 +2,7 @@
<% if type and item_entry -%>
<% if type == 'contributable' -%>
<% if item_entry.contributable -%>
- <% if Authorization.is_authorized?("show", nil, item_entry.contributable, current_user) -%>
+ <% if Authorization.check("view", item_entry.contributable, current_user) -%>
<p style="text-align: center;">
<b>
<%= visible_name(item_entry.contributable_type) -%>:
@@ -30,4 +30,4 @@
<%= link_to h(item_entry.uri), h(item_entry.uri), :popup => true %>
</p>
<% end -%>
-<% end -%>
\ No newline at end of file
+<% end -%>
Modified: branches/wf4ever/app/views/packs/_items.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/packs/_items.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/packs/_items.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -11,7 +11,7 @@
<!-- Contributable Item Entries -->
<% pack.contributable_entries.each do |e| %>
- <% show = e.available? ? Authorization.is_authorized?("show", nil, e.contributable, current_user) : false -%>
+ <% show = e.available? ? Authorization.check("view", e.contributable, current_user) : false -%>
<li>
<table>
<tr>
Modified: branches/wf4ever/app/views/packs/_table.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/packs/_table.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/packs/_table.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -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 ||= Authorization.is_authorized?("show", nil, pack, current_user) -%>
+ <% show ||= Authorization.check("view", pack, current_user) -%>
<% else -%>
- <% show = Authorization.is_authorized?("show", nil, pack, current_user) -%>
+ <% show = Authorization.check("view", 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 Authorization.is_authorized?("download", nil, pack, current_user) -%><%= icon('download', download_pack_path(pack), nil, nil, 'Download') -%><% end -%>
+ <% if Authorization.check("download", 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 Authorization.is_authorized?("edit", nil, pack, current_user) -%><%= icon('new', new_item_pack_path(pack), nil, nil, 'Add New Item') -%><% end -%>
+ <% if Authorization.check("edit", pack, current_user) -%><%= icon('new', new_item_pack_path(pack), nil, nil, 'Add New Item') -%><% end -%>
</td>
</tr>
<% end %>
Modified: branches/wf4ever/app/views/packs/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/packs/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/packs/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -5,7 +5,7 @@
<% if mine?(@pack) -%>
<li><%= icon('manage', edit_pack_path(@pack), nil, nil, 'Manage Pack') -%></li>
<% end -%>
- <% if Authorization.is_authorized?("destroy", nil, @pack, current_user) %>
+ <% if Authorization.check("destroy", @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/wf4ever/app/views/pictures/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/pictures/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/pictures/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,17 +1,12 @@
<% if params[:user_id] %>
<li><%= link_to 'Users', users_path -%></li>
- <li>></li>
-
<li><%= link_to contributor_name(params[:user_id], "User"), user_path(params[:user_id]) -%></li>
-
- <li>></li>
<% end %>
<li><%= link_to 'Pictures', user_pictures_path -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
<% case controller.action_name.to_s; when "show" %>
<li><%= link_to "address@hidden", user_picture_path(@picture.owner, @picture) %></li>
@@ -19,7 +14,6 @@
<li>Upload New Picture</li>
<% when "edit" %>
<li><%= link_to "address@hidden", user_picture_path(@picture.owner, @picture) %></li>
- <li>></li>
<li>Edit</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/pictures/index.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/pictures/index.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/pictures/index.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -15,7 +15,7 @@
<% odd_row = false -%>
<% for picture in @pictures %>
- <% if Authorization.is_authorized?("view", nil, picture, current_user) %>
+ <% if Authorization.check("view", picture, current_user) %>
<tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
<td width="150">
<% if picture.selected? %>
Modified: branches/wf4ever/app/views/profiles/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/profiles/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/profiles/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,14 +1,10 @@
<% if @user -%>
<li><%= link_to 'Users', users_path -%></li>
- <li>></li>
-
<li><%= link_to h(@user.name), user_path(@user) -%></li>
<% end %>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" -%>
<li>Profile</li>
<% when "new" -%>
Modified: branches/wf4ever/app/views/relationships/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/relationships/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/relationships/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,11 +1,8 @@
<li><%= link_to 'Packs', packs_path %></li>
<% if ["edit_relationships"].include? controller.action_name.to_s %>
- <li>></li>
-
<% case controller.action_name.to_s; when "edit_relationships" %>
<li><%= link_to "#{h(@context.title)}", pack_path(@context) %></li>
- <li>></li>
<li>Edit Relationships</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/relationships/_relationships.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/relationships/_relationships.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/relationships/_relationships.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,4 +1,4 @@
-<% can_edit = Authorization.check(:action ="" 'edit', :object => context, :user => current_user) %>
+<% can_edit = Authorization.check('edit', context, current_user) %>
<% relationships = context.relationships %>
<% if relationships.empty? %>
Modified: branches/wf4ever/app/views/research_objects/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/research_objects/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/research_objects/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -3,10 +3,8 @@
<% end %>
<% case controller.action_name.to_s; when "show" %>
- <li>></li>
<li><%= h(@contributable.label) %></li>
<% when "search" %>
- <li>></li>
<li>Search Results</li>
<% when "index" %>
<li>Research objects</li>
Modified: branches/wf4ever/app/views/reviews/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/reviews/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/reviews/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,21 +1,14 @@
<li><%= link_to 'Workflows', workflows_path -%></li>
-<li>></li>
-
<li><%= link_to "#{h(@reviewable.title)}", workflow_path(@reviewable) -%></li>
-<li>></li>
-
<li><%= link_to 'Reviews', workflow_reviews_path(@reviewable) -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" -%>
<li><%= h(@review.title) -%></li>
<% when "new" -%>
<li>New Review</li>
<% when "edit" -%>
<li><%= link_to "#{h(@review.title)}", workflow_review_path(@reviewable, @review) -%></li>
- <li>></li>
<li>Edit</li>
<% else -%>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/runners/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/runners/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/runners/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,15 +1,12 @@
<li><%= link_to 'Runners', runners_path -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" -%>
<li><%= h(@runner.title) -%></li>
<% when "new" -%>
<li>New Runner</li>
<% when "edit" -%>
<li><%= link_to "#{h(@runner.title)}", runner_path(@runner) -%></li>
- <li>></li>
<li>Edit</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/runners/_table.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/runners/_table.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/runners/_table.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -35,7 +35,7 @@
</td>
<td class="actions" style="width: 80px;">
<%= icon "show", runner_path(runner), nil, nil, "View" %>
- <% if Authorization.is_authorized?('edit', nil, runner, current_user) %>
+ <% if Authorization.check('edit', runner, current_user) %>
<%= icon('edit', edit_runner_path(runner), nil, nil, 'Edit') %>
<% end %>
</td>
Modified: branches/wf4ever/app/views/runners/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/runners/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/runners/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,6 +1,6 @@
<% t "address@hidden - #{h @runner.title}" -%>
-<% if Authorization.is_authorized?('edit', nil, @runner, current_user) -%>
+<% if Authorization.check('edit', @runner, current_user) -%>
<ul class="sectionIcons">
<li><%= icon('edit', edit_runner_path(@runner), nil, nil, 'Edit Runner') %></li>
</ul>
Modified: branches/wf4ever/app/views/services/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/services/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/services/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -3,13 +3,10 @@
<% end %>
<% case controller.action_name.to_s; when "show" %>
- <li>></li>
<li><%= h(@contributable.label) %></li>
<% when "search" %>
- <li>></li>
<li>Search Results</li>
<% when "all" %>
- <li>></li>
<li>All services</li>
<% when "index" %>
<li>Services</li>
Modified: branches/wf4ever/app/views/sessions/new.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/sessions/new.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/sessions/new.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -6,7 +6,7 @@
<% else %>
<br/>
<center>
- <div style="width: 190px;">
+ <div class="new-session-sign-in">
<%= render :partial => "gadgets/sign_in" %>
</div>
</center>
Modified: branches/wf4ever/app/views/tags/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/tags/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/tags/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,8 +1,6 @@
<li><%= link_to "Tags", tags_path -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" -%>
<li>
<% if @internal_type -%>
Modified: branches/wf4ever/app/views/topics/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/topics/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/topics/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,8 +1,6 @@
<li><%= link_to 'Topics', topics_path %></li>
<% if ["show", "new", "edit", "search", "all", "new_version", "edit_version", "comments_timeline"].include? controller.action_name.to_s %>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li>Topic</li>
<% else %>
Modified: branches/wf4ever/app/views/userhistory/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/userhistory/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/userhistory/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,13 +1,9 @@
<% if @user -%>
<li><%= link_to 'Users', users_path -%></li>
- <li>></li>
-
<li><%= name(@user) -%></li>
<% if ["show"].include? controller.action_name.to_s -%>
- <li>></li>
-
<li><%= link_to "My History", user_userhistory_path(@user) if @user == current_user %></li>
<% end %>
<% else %>
Modified: branches/wf4ever/app/views/users/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/users/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/users/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,16 +1,12 @@
<li><%= link_to 'Users', users_path -%></li>
<% if ["edit"].include? controller.action_name.to_s -%>
- <li>></li>
<li><%= link_to h(@user.name), user_path(@user) -%></li>
<% elsif @user -%>
- <li>></li>
<li><%= h(@user.name) -%></li>
<% end -%>
<% if ["new", "edit", "search", "all", "forgot_password"].include? controller.action_name.to_s -%>
- <li>></li>
-
<% case controller.action_name.to_s; when "new" -%>
<li>Register</li>
<% when "edit" -%>
Modified: branches/wf4ever/app/views/users/_listing.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/users/_listing.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/users/_listing.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -87,7 +87,7 @@
<% end %>
<% end %>
- <% if Authorization.check(:action ="" 'destroy', :object => user, :user => current_user) %>
+ <% if Authorization.check('destroy', user, current_user) %>
<%= icon "destroy", user_path(user) + "?return_to=" + CGI::escape(request.request_uri), nil, {
:confirm => "Are you sure you want to remove this user?", :method => :delete},
"Delete User" %>
Modified: branches/wf4ever/app/views/users/check.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/users/check.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/users/check.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -148,11 +148,16 @@
changeSelectedKSE("whitelist");
break;
- case 115: /* 's' key */
+ case 111: /* 'o' key */
changeSelectedKSE("sleep");
break;
+ case 115: /* 's' key */
+
+ changeSelectedKSE("suspect");
+ break;
+
case 120: /* 'x' key */
changeSelectedKSE("delete");
@@ -209,6 +214,10 @@
<label for="" input_name -%>-sleep">Sleep</label>
</div>
<div>
+ <input name="<%= input_name -%>" id="<%= input_name -%>-suspect" value="suspect" type="radio" user[:ob].id -%>').className = 'suspect';"/>
+ <label for="" input_name -%>-suspect">Suspect</label>
+ </div>
+ <div>
<input name="<%= input_name -%>" id="<%= input_name -%>-delete" value="delete" type="radio" user[:ob].id -%>').className = 'delete';"/>
<label for="" input_name -%>-delete">Delete</label>
</div>
Modified: branches/wf4ever/app/views/users/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/users/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/users/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -59,7 +59,7 @@
<li><%= icon('history', user_userhistory_path(@user), nil, nil, 'View My History')%></li>
<% end %>
- <% if Authorization.check(:action ="" 'destroy', :object => @user, :user => current_user) %>
+ <% if Authorization.check('destroy', @user, current_user) %>
<li><%= icon "destroy", user_path(@user), nil, {
:confirm => "Are you sure you want to remove this user?", :method => :delete},
"Delete User" %></li>
@@ -213,7 +213,7 @@
<div class="stats_box">
<p>
<b>
- <%= link_to(pluralize(@user.friends.length, "Friend"), url_for(:action ="" 'friends')) -%>
+ <%= link_to(pluralize(Friendship.count(:conditions => ["accepted_at IS NOT NULL AND (user_id = ? OR friend_id = ?)", @user.id, @user.id]), "Friend"), url_for(:action ="" 'friends')) -%>
</b>
</p>
@@ -249,7 +249,7 @@
<p>
<b>
<%= h @user.name -%> has been credited
- <%= link_to(pluralize(@user.creditations.length, "time"), url_for(:action ="" 'credits')) -%>
+ <%= link_to(pluralize(Authorization.scoped(Contribution).find(:all, :select => "0", :joins => "JOIN creditations ON creditations.creditable_type = contributions.contributable_type AND creditations.creditable_id = contributions.contributable_id", :conditions => ["creditations.creditor_type = ? AND creditations.creditor_id = ?", "User", @user.id]).length, "time"), url_for(:action ="" 'credits')) -%>
</b>
</p>
</div>
Modified: branches/wf4ever/app/views/workflows/_anchors.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/workflows/_anchors.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/workflows/_anchors.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -7,7 +7,7 @@
<% collection.each_index do |i| %>
<% workflow = collection[i] %>
- <% if Authorization.is_authorized?("show", nil, workflow, current_user) %>
+ <% if Authorization.check("view", workflow, current_user) %>
<a href="" h(workflow.title).gsub(/ /, "_") %>"><%= num %>. <%= h(workflow.title) %></a><br/>
<% num = num + 1 %>
<% end %>
Modified: branches/wf4ever/app/views/workflows/_breadcrumbs.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/workflows/_breadcrumbs.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/workflows/_breadcrumbs.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,15 +1,12 @@
<li><%= link_to 'Workflows', workflows_path %></li>
<% if ["show", "new", "edit", "search", "all", "new_version", "edit_version", "comments_timeline", "galaxy_tool"].include? controller.action_name.to_s %>
- <li>></li>
-
<% case controller.action_name.to_s; when "show" %>
<li><%= h(@workflow.title) %></li>
<% when "new" %>
<li>Upload Workflow</li>
<% when "edit" %>
<li><%= link_to "#{h(@workflow.title)}", workflow_path(@workflow) %></li>
- <li>></li>
<li>Manage</li>
<% when "search" %>
<li>Search Results</li>
@@ -17,19 +14,15 @@
<li>All Workflows</li>
<% when "new_version" %>
<li><%= link_to "#{h(@workflow.title)}", workflow_path(@workflow) %></li>
- <li>></li>
<li>New Version</li>
<% when "edit_version" %>
<li><%= link_to "#{h(@workflow.title)}", workflow_path(@workflow) %></li>
- <li>></li>
<li>Edit Version</li>
<% when "comments_timeline" %>
<li><%= link_to "#{h(@workflow.title)}", workflow_path(@workflow) %></li>
- <li>></li>
<li>Comments Timeline</li>
<% when "galaxy_tool" %>
<li><%= link_to "#{h(@workflow.title)}", workflow_path(@workflow) %></li>
- <li>></li>
<li>Galaxy tool download</li>
<% else %>
<!-- no breadcrumb -->
Modified: branches/wf4ever/app/views/workflows/_table.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/workflows/_table.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/workflows/_table.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -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 ||= Authorization.is_authorized?("show", nil, workflow, current_user) -%>
+ <% show ||= Authorization.check("view", workflow, current_user) -%>
<% else -%>
- <% show = Authorization.is_authorized?("show", nil, workflow, current_user) -%>
+ <% show = Authorization.check("view", 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 Authorization.is_authorized?("show", nil, a.attributor, current_user) -%>
+ <% if Authorization.check("view", a.attributor, current_user) -%>
<% if a.attributor_type == 'Workflow' %>
<%= icon('workflow', nil, nil, nil, '') %>
<% elsif a.attributor_type == 'Blob' %>
@@ -120,7 +120,7 @@
<% end -%>
<td class="actions" style="width: 120px;">
<%= icon "show", workflow_path(workflow), nil, nil, "View" %>
- <% if Authorization.is_authorized?("download", nil, workflow, current_user) -%>
+ <% if Authorization.check("download", workflow, current_user) -%>
<%= icon "download", download_workflow_path(workflow), nil, nil, "Download (v#{workflow.versions.count})" %>
<% if ( session[:callback] && (session[:callback][:types].include?(workflow.content_type_id))) -%>
<%= icon "download", callback_url(workflow).to_s, nil, {:rel => 'nofollow'}, session[:callback][:label] -%>
Modified: branches/wf4ever/app/views/workflows/_workflow.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/workflows/_workflow.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/workflows/_workflow.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,5 +1,5 @@
<% image = !(workflow.image.nil?) -%>
-<% show = Authorization.is_authorized?("show", nil, workflow, current_user) -%>
+<% show = Authorization.check("view", workflow, current_user) -%>
<% if show %>
<center>
@@ -44,10 +44,10 @@
<tr>
<td colspan="<%= show ? 3 : 2 %>">
<center>
- <% if Authorization.is_authorized?("download", nil, workflow, current_user) %><%= icon "download", download_workflow_path(workflow) %> <% end %>
+ <% if Authorization.check("download", workflow, current_user) %><%= icon "download", download_workflow_path(workflow) %> <% end %>
<% if show %><%= icon "show", workflow_path(workflow) %> <% 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 %>
+ <% if logged_in? && Authorization.check("edit", workflow, current_user) %><%= icon "edit", edit_workflow_path(workflow) %> <% end %>
+ <% if logged_in? && Authorization.check("destroy", workflow, current_user) %><%= icon "destroy", workflow_path(workflow), nil, :confirm => 'Are you sure?', :method => :delete %><% end %>
</center>
</td>
</tr>
Modified: branches/wf4ever/app/views/workflows/show.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/workflows/show.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/workflows/show.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -7,7 +7,7 @@
<% if mine?(@workflow) -%>
<li><%= icon('manage', edit_workflow_path(@workflow), nil, nil, 'Manage Workflow Entry')%></li>
<% end -%>
- <% if Authorization.is_authorized?("destroy", nil, @workflow, current_user) -%>
+ <% if Authorization.check("destroy", @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>
@@ -67,7 +67,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 Authorization.is_authorized?("destroy", nil, @workflow, current_user) %>
+ <% if Authorization.check("destroy", @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 %>
@@ -241,7 +241,7 @@
<% if @authorised_to_download %>
<% begin %>
- <%= render :partial => "workflows/#{get_type_dir(@workflow)}/internals", :locals => { :workflow => @workflow, :version => @viewing_version_number } -%>
+ <%= render :partial => "workflows/#{get_type_dir(@viewing_version)}/internals", :locals => { :workflow => @workflow, :version => @viewing_version_number } -%>
<% rescue %>
<p class="none_text">
There was a problem in extracting the internals of this workflow.
Modified: branches/wf4ever/app/views/workflows/taverna2/_internals.rhtml (3142 => 3143)
--- branches/wf4ever/app/views/workflows/taverna2/_internals.rhtml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/app/views/workflows/taverna2/_internals.rhtml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -67,6 +67,28 @@
</div>
</div>
+ <!-- Dependencies -->
+ <% dependencies = model.dependencies -%>
+ <div class="fold">
+ <div class="foldTitle">
+ <%= info_icon_with_tooltip "These are the listed dependencies of the workflow" %>
+ Dependencies (<%= dependencies.length -%>)
+ </div>
+ <div class="foldContent" style="display: none;">
+ <% unless dependencies.empty? -%>
+ <table class="simple">
+ <% dependencies.each do |dep| -%>
+ <tr>
+ <td><%= h dep -%></td>
+ </tr>
+ <% end %>
+ </table>
+ <% else %>
+ <p class="none_text">None</p>
+ <% end %>
+ </div>
+ </div>
+
<!-- Sources -->
<% sources = model.sources -%>
<div class="fold">
Modified: branches/wf4ever/config/environment.rb (3142 => 3143)
--- branches/wf4ever/config/environment.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/config/environment.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -43,8 +43,6 @@
:exception_notification,
:fckeditor,
:headliner,
- :mannie_taverna_scufl,
- :mannie_taverna_t2flow,
:oauth,
:oauth_plugin,
:open_id_authentication,
Property changes: branches/wf4ever/db/migrate/088_add_group_admins.rb
Deleted: svn:executable
Copied: branches/wf4ever/db/migrate/097_add_checksums_to_content_blobs.rb (from rev 3142, trunk/db/migrate/097_add_checksums_to_content_blobs.rb) (0 => 3143)
--- branches/wf4ever/db/migrate/097_add_checksums_to_content_blobs.rb (rev 0)
+++ branches/wf4ever/db/migrate/097_add_checksums_to_content_blobs.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -0,0 +1,19 @@
+# myExperiment: db/migrate/097_add_checksums_to_content_blobs.rb
+#
+# Copyright (c) 2012 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class AddChecksumsToContentBlobs < ActiveRecord::Migration
+ def self.up
+ add_column :content_blobs, :md5, :string, :limit => 32
+ add_column :content_blobs, :sha1, :string, :limit => 40
+
+ add_index :content_blobs, :md5
+ add_index :content_blobs, :sha1
+ end
+
+ def self.down
+ remove_column :content_blobs, :md5
+ remove_column :content_blobs, :sha1
+ end
+end
Deleted: branches/wf4ever/db/migrate/20120605091404_add_checksums_to_content_blobs.rb (3142 => 3143)
--- branches/wf4ever/db/migrate/20120605091404_add_checksums_to_content_blobs.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/db/migrate/20120605091404_add_checksums_to_content_blobs.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,16 +0,0 @@
-# myExperiment: db/migrate/20120605091404_add_checksums_to_content_blobs.rb
-#
-# Copyright (c) 2012 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-class AddChecksumsToContentBlobs < ActiveRecord::Migration
- def self.up
- add_column :content_blobs, :md5, :string, :limit => 32
- add_column :content_blobs, :sha1, :string, :limit => 40
- end
-
- def self.down
- remove_column :content_blobs, :md5
- remove_column :content_blobs, :sha1
- end
-end
Modified: branches/wf4ever/db/schema.rb (3142 => 3143)
--- branches/wf4ever/db/schema.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/db/schema.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120605091404) do
+ActiveRecord::Schema.define(:version => 20120921144930) do
create_table "activity_limits", :force => true do |t|
t.string "contributor_type", :null => false
@@ -400,6 +400,9 @@
t.datetime "invalidated_at"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "callback_url"
+ t.string "verifier", :limit => 20
+ t.string "scope"
end
add_index "oauth_tokens", ["token"], :name => "index_oauth_tokens_on_token", :unique => true
Modified: branches/wf4ever/lib/authorization.rb (3142 => 3143)
--- branches/wf4ever/lib/authorization.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/lib/authorization.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,469 +1,148 @@
-# myExperiment: lib/is_authorized.rb
+# myExperiment: lib/authorization.rb
#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
+# Copyright (c) 2012 University of Manchester and the University of Southampton.
# See license.txt for details.
module Authorization
- # Authorization logic collected from enactment code
-
- # Note: at the moment (Feb 2008), Experiments (and associated Jobs) are
- # private to the owner, if a User owns it, OR accessible by all members of a
- # Group, if a Group owns it.
-
- def Authorization.experiment_authorized?(experiment, action_name, user)
- return false if user.nil?
-
- case experiment.contributor_type.to_s
- when "User"
- return experiment.contributor_id.to_i == user.id.to_i
- when "Network"
- return experiment.contributor.member?(user.id)
- else
- return false
- end
- end
-
- def Authorization.job_authorized?(job, action_name, user)
- # Use authorization logic from parent Experiment
- return Authorization.experiment_authorized?(job.experiment, action_name, user)
- end
-
- def Authorization.runner_authorized?(runner, action_name, user)
- return false if user.nil?
-
- case runner.contributor_type.to_s
- when "User"
- return runner.contributor_id.to_i == user.id.to_i
- when "Network"
- if ['edit','update','delete'].include?(action_name.downcase)
- return runner.contributor.owner?(user.id)
- else
- return runner.contributor.member?(user.id)
- end
- else
- return false
- end
- end
-
- def self.user_is_administrator?(user)
-
- return false if user.nil?
-
- if user.instance_of?(User)
- Conf.admins.include?(user.username)
- else
- Conf.admins.include?(User.find(user).username)
- end
- end
-
- def self.user_is_curator?(user)
-
- return false if user.nil?
-
- if user.instance_of?(User)
- Conf.curators.include?(user.username)
- else
- Conf.curators.include?(User.find(user).username)
- end
- end
-
- # Single entry point to authorisation checks for instances of objects and
- # also classes of objects.
+ # Authorisation check for instances and classes of objects.
#
- # Options:
+ # Arguments:
#
- # :action - This string describes the action to be performed, e.g.
- # 'create', 'read', 'update' or 'destroy'.
+ # action - This string describes the action to be performed, e.g.
+ # 'create', 'read', 'update' or 'destroy'.
#
- # :object - This is the object being acted upon, e.g. an instance of a
- # Comment or an instance of a Workflow.
+ # object - This is the object being acted upon, e.g. an instance of a
+ # Comment or an instance of a Workflow.
#
- # :object_type - As an alternative to an instance of an object, you can
- # :object_id specify the type and id instead and this might not cause
- # the object to be loaded into memory.
+ # user - The user that the check is with respect to. Typically,
+ # this would be current_user.
#
- # :model - If the action is performed on a class of objects, such as
- # creating a Workflow, then specify the class of the object
- # to be acted upon instead of an instance. This is a class
- # object, e.g. Workflow.
- #
- # :user - The user that the check is with respect to. Typically,
- # this would be current_user.
- #
- # :context - This is the context in which the object or object to be
- # created is made. For example, pack entries can only be
- # created by those that can edit the pack that the entry will
- # be made in, so the context here would be an instance of the
- # pack in question. This is only usually required for
- # 'create' actions.
+ # context - This is the context in which the object or object to be
+ # created is made. For example, pack entries can only be
+ # created by those that can edit the pack that the entry will
+ # be made in, so the context here would be an instance of the
+ # pack in question. This is only usually required for 'create'
+ # actions.
- def self.check(opts = {})
+ def self.check(action, object, user, context = nil)
- raise "Missing action in authorisation check" if opts[:action].nil?
+ valid_actions = ["create", "view", "edit", "destroy", "download", "execute"]
- opts[:user] = nil if opts[:user] == 0
+ # This behaviour isn't ideal, but the old authorisation function would just
+ # return false with invalid arguments. I'll have this in here until I can
+ # remove it.
- if opts[:model].nil? && opts[:object].nil? && (opts[:object_type].nil? || opts[:object_id])
- raise "Missing object / model in authorisation check"
- end
+ return false if action.nil? || object.nil?
+ # raise "Missing action in authorisation check" unless action
+ # raise "Missing object in authorisation check" unless object
- if opts[:model]
- Authorization.is_authorized_for_type?(opts[:action], opts[:model], opts[:user], opts[:context])
- else
- if opts[:object]
- Authorization.is_authorized?(opts[:action], nil, opts[:object], opts[:user])
- else
- Authorization.is_authorized_for_type?(opts[:action], opts[:object_type], opts[:object_id], opts[:user])
- end
- end
- end
+ # If it is a contribution, then work on the contributable instead. I'm not
+ # sure this is still needed and I'll remove it if I can.
- def Authorization.is_authorized_for_type?(action, object_type, user, context)
+ object = object.contributable if object.kind_of?(Contribution)
- # This method deals with cases where there is no instantiated object to
- # authorize. This is usually when thing area created. The other normal
- # CRUD actions (read, update and destroy) are handled by is_authorized?
- # since there's an instantiatable object to authorize on.
-
- # normalise user to nil if this is for an unauthenticated user
- user = nil if user == 0
+ raise "Invalid action ('#{action}') in authorisation check" unless action && valid_actions.include?(action)
- raise "object_type missing in is_authorized_for_type?" if object_type.nil?
+ # Set the user to nil if there is no user (e.g. 0 becomes nil).
- # Workflow permissions
+ user = nil unless user.kind_of?(User)
- if (object_type == 'Workflow') && (action == 'create')
+ is_authorized = false
- # Workflows can only be created by authenticated users
- return !user.nil?
- end
-
- # Blob permissions
-
- if (object_type == 'Blob') && (action == 'create')
+ object_type = object.class == Class ? object.name : object.class.name
- # Files can only be created by authenticated users
- return !user.nil?
- end
-
- # Pack permissions
+ case object_type
- if (object_type == 'Pack') && (action == 'create')
+ when "Workflow", "Blog", "Blob", "Pack", "Service", "Contribution"
- # Packs can only be created by authenticated users
- return !user.nil?
- end
+ # workflows can only be created by authenticated users
+ if (action == "create") && [Workflow, Blob, Pack].include?(object)
+ return !user.nil?
+ end
- if (object_type == 'PackRemoteEntry') && (action == 'create')
+ # the owner of a contributable can perform all actions on it
+ return true if object.contributor == user
- # Remote pack items can only be added by users that can edit a pack
- return Authorization.is_authorized?('edit', nil, context, user)
- end
+ # get the object with edit, view and download permissions attached
+ ob = Authorization.scoped(object.class, :permissions_only => true, :authorised_user => user).find_by_id(object.id)
- if (object_type == 'PackContributableEntry') && (action == 'create')
+ # not getting an object means that there is no view permission
+ return false if ob.nil?
- # Contributable pack items can only be added by users that can edit a pack
- return Authorization.is_authorized?('edit', nil, context, user)
- end
-
- # Comment permissions
-
- if (object_type == 'Comment') && (action == 'create')
-
- # Comments can only be created by authenticated users
- return false if user.nil?
-
- # Comments can only be added to things that a user can view
- return Authorization.is_authorized?('view', nil, context, user) if context
-
- return true
- end
-
- # Rating permissions
-
- if (object_type == 'Rating') && (action == 'create')
-
- # Ratings can only be created by authenticated users
- return false if user.nil?
-
- # Ratings can only be set on things that a user can view
- return Authorization.is_authorized?('view', nil, context, user) if context
-
- return true
- end
-
- # Tagging permissions
-
- if (object_type == 'Tagging') && (action == 'create')
-
- # Taggings can only be created by authenticated users
- return false if user.nil?
-
- # Taggings can only be set on things that a user can view
- return Authorization.is_authorized?('view', nil, context, user) if context
-
- return true
- end
-
- # Bookmark permissions
-
- if (object_type == 'Bookmark') && (action == 'create')
-
- # Bookmarks can only be created by authenticated users
- return false if user.nil?
-
- # Bookmarks can only be added to things that a user can view
- return Authorization.is_authorized?('view', nil, context, user) if context
-
- return true
- end
-
- # Ontology permissions
-
- if (object_type == 'Ontology') && (action == 'create')
-
- # Ontologies can only be created by authenticated users
- return !user.nil?
- end
-
- # Predicate permissions
-
- if (object_type == 'Predicate') && (action == 'create')
-
- # Predicates can only be added by users that can edit its ontology
- return Authorization.is_authorized?('edit', nil, context, user)
- end
-
- # Relationship permissions
-
- if (object_type == 'Relationship') && (action == 'create')
-
- # Relationships can only be added by users that can edit its context
- return Authorization.is_authorized?('edit', nil, context, user)
- end
-
- return false
- end
-
- # 1) action_name - name of the action that is about to happen with the "thing"
- # 2) thing_type - class name of the thing that needs to be authorized;
- # use NIL as a value of this parameter if an instance of the object to be authorized is supplied as "thing";
- # 3) thing - this is supposed to be an instance of the thing to be authorized, but
- # can also accept an ID (since we have the type, too - "thing_type")
- # 4) user - can be either user instance or the ID (NIL or 0 to indicate anonymous/not logged in user)
- #
- # Note: there is no method overloading in Ruby and it's a good idea to have a default "nil" value for "user";
- # this leaves no other choice as to have (sometimes) redundant "thing_type" parameter.
- def Authorization.is_authorized?(action_name, thing_type, thing, user=nil)
- thing_instance = nil
- thing_contribution = nil
- thing_id = nil
- user_instance = nil
- user_id = nil # if this value will not get updated by input parameters - user will be treated as anonymous
-
- # ***************************************
- # Pre-checks on the Parameters
- # ***************************************
-
- # check first if the action that is being executed is known - not authorized otherwise
- action = ""
- return false unless action
-
- # if "thing" is unknown, or "thing" expresses ID of the object to be authorized, but "thing_type" is unknown - don't authorise the action
- # (this would allow, however, supplying no type, but giving the object instance as "thing" instead)
- return false if thing.blank? || (thing_type.blank? && thing.kind_of?(Fixnum))
-
-
-
- # some value for "thing" supplied - assume that the object exists; check if it is an instance or the ID
- if thing.kind_of?(Fixnum)
- # just an ID was provided - "thing_type" is assumed to have a type then
- thing_id = thing
- elsif thing.kind_of?(Contribution)
- # thing_type/_id should be properties of the actual "thing", not it's contribution
- thing_contribution = thing
- thing_type = thing_contribution.contributable_type
- thing_id = thing_contribution.contributable_id
- else
- # "thing" isn't an ID of the object; it's not a Contribution,
- # so it must be an instance of the object to be authorized -- this can be:
- # -- "contributable" (workflow / file / pack) : (will still have to "find" the Contribution instance for this contributable aftewards)
- # OR
- # -- Network instance
- # -- Experiment / Job / Runner / TavernaEnactor instance
- # -- Comment / Bookmark
- # -- or any other object instance, for which we'll use the object itself to run .authorized?() on it
- thing_instance = thing
- thing_type = thing.class.name
- thing_id = thing.id
- end
-
-
- if user.kind_of?(User)
- user_instance = user
- user_id = user.id
- elsif user == 0
- # "Authenticated System" sets current_user to 0 if not logged in (i.e. anonymous user)
- user_id = nil
- elsif user.nil? || user.kind_of?(Fixnum)
- # anonymous user OR only id of the user, not an instance was provided;
- user_id = user
- end
-
-
- # ***************************************
- # Actual Authorization Begins
- # ***************************************
-
- # if (thing_type, ID) pair was supplied instead of a "thing" instance,
- # need to find the object that needs to be authorized first;
- # (only do this for object types that are known to require authorization)
- #
- # this is required to get "policy_id" for policy-based aurhorized objects (like workflows / blobs / packs / contributions)
- # and to get objects themself for other object types (networks, experiments, jobs, tavernaenactors, runners)
- if (thing_contribution.nil? && ["Workflow", "Blog", "Blob", "Pack", "Ontology", "Contribution"].include?(thing_type)) ||
- (thing_instance.nil? && ["Network", "Comment", "Bookmark", "Experiment", "Job", "TavernaEnactor", "Runner", "Picture", "ClientApplication", "Predicate", "Relationship"].include?(thing_type))
-
- found_thing = find_thing(thing_type, thing_id)
-
- unless found_thing
- # search didn't yield any results - the "thing" wasn't found; can't authorize unknown objects
- Rails.logger.error("UNEXPECTED ERROR - Couldn't find object to be authorized:(#{thing_type}, #{thing_id}); action: #{action_name}; user: #{user_id}")
- return false
- else
- if ["Workflow", "Blog", "Blob", "Pack", "Contribution"].include?(thing_type)
- # "contribution" are only found for these three types of object (and the contributions themself),
- # for all the rest - use instances
- thing_contribution = found_thing
- else
- thing_instance = found_thing
+ # return the response
+ case action
+ when "view"; return ob.view_permission == "1"
+ when "download"; return ob.download_permission == "1"
+ when "edit"; return ob.edit_permission == "1"
+ else; return false
end
- end
- end
-
-
- # initially not authorized, so if all tests fail -
- # safe result of being not authorized will get returned
- is_authorized = false
-
- case thing_type
- when "Workflow", "Blog", "Blob", "Pack", "Contribution"
- unless user_id.nil?
- # access is authorized and no further checks required in two cases:
- # ** user is the owner of the "thing"
- return true if is_owner?(user_id, thing_contribution)
-
- # ** user is admin of the policy associated with the "thing"
- # (this means that the user might not have uploaded the "thing", but
- # is the one managing the access permissions for it)
- #
- # it's fine if policy will not be found at this step - default one will get
- # used further when required
- policy_id = thing_contribution.policy_id
- policy = get_policy(policy_id, thing_contribution)
- return false unless policy # if policy wasn't found (and default one couldn't be applied) - error; not authorized
- return true if is_policy_admin?(policy, user_id)
-
-
- # only owners / policy admins are allowed to perform actions categorized as "destroy";
- # hence "destroy" actions are not authorized below this point
- return false if action == "destroy"
-
-
- # user is not the owner/admin of the object; action is not of "destroy" class;
- # next thing - obtain all the permissions that are relevant to the user
- # (start with individual user permissions; group permissions will only
- # be considered if that is required further on)
- user_permissions = get_user_permissions(user_id, policy_id)
-
- # individual user permissions override any other settings;
- # if several of these are found (which shouldn't be the case),
- # all are considered, but the one with "highest" access right is
- # used to make final decision -- that is if at least one of the
- # user permissions allows to make the action, it will be allowed;
- # likewise, if none of the permissions allow the action it will
- # not be allowed
- unless user_permissions.empty?
- authorized_by_user_permissions = false
- user_permissions.each do |p|
- authorized_by_user_permissions = true if permission_allows_action?(action, p)
- end
- return authorized_by_user_permissions
- end
-
-
- # no user permissions found, need to check what is allowed by policy
- # (if no policy was found, default policy is in use instead)
- authorized_by_policy = false
- authorized_by_policy = authorized_by_policy?(policy, thing_contribution, action, user_id)
- return true if authorized_by_policy
-
-
- # not authorized by policy, check the group permissions -- the ones
- # attached to "thing's" policy and belonging to the groups, where
- # "user" is a member or admin of;
- #
- # these cannot limit what is allowed by policy settings, only give more access rights
- authorized_by_group_permissions = false
- group_permissions = get_group_permissions(policy_id)
-
- unless group_permissions.empty?
- group_permissions.each do |p|
- # check if this permission is applicable to the "user"
- if permission_allows_action?(action, p) && (is_network_member?(user_id, p.contributor_id) || is_network_admin?(user_id, p.contributor_id))
- authorized_by_group_permissions = true
- break
- end
- end
- return authorized_by_group_permissions if authorized_by_group_permissions
- end
-
- # user permissions, policy settings and group permissions didn't give the
- # positive result - decline the action request
- return false
- else
- # this is for cases where trying to authorize anonymous users;
- # the only possible check - on public policy settings:
- policy_id = thing_contribution.policy_id
- policy = get_policy(policy_id, thing_contribution)
- return false unless policy # if policy wasn't found (and default one couldn't be applied) - error; not authorized
-
- return authorized_by_policy?(policy, thing_contribution, action, nil)
- end
-
when "Network"
case action
when "edit", "destroy"
# check to allow only admin to edit / delete the group
- is_authorized = is_network_admin?(user_id, thing_id)
+ is_authorized = user && user.network_admin?(object.id)
else
is_authorized = true
end
when "Comment"
case action
+ when "create"
+
+ # Comments can be created by authenticated users that can view the context
+ is_authorized = !user.nil? && Authorization.check('view', context, user)
+
when "destroy"
+
# Users can delete their own comments. Curators and
# administrators can delete any comment.
- is_authorized = Authorization.is_owner?(user_id, thing_instance) ||
- user_is_administrator?(user_id) || user_is_curator?(user_id)
+ is_authorized = object.user == user || (user && user.admin?) || (user && user.curator?)
when "view"
# user can view comment if they can view the item that this comment references
- is_authorized = Authorization.is_authorized?('view', thing_instance.commentable_type, thing_instance.commentable_id, user)
+ is_authorized = Authorization.check('view', object.commentable, user)
else
# 'edit' or any other actions are not allowed on comments
is_authorized = false
end
+ when "Rating"
+ case action
+ when "create"
+
+ # Ratings can be created by authenticated users that can view the context
+ is_authorized = !user.nil? && Authorization.check('view', context, user)
+
+ when "edit", "destroy"
+
+ # Users can edit or remove their own ratings
+ is_authorized = !user.nil? && object.user == user
+ end
+
+ when "Tagging"
+ case action
+ when "create"
+
+ # Taggings can be created by authenticated users that can view the context
+ is_authorized = !user.nil? && Authorization.check('view', context, user)
+
+ when "destroy"
+
+ # Users can delete their own taggings
+ is_authorized = !user.nil? && object.user == user
+ end
+
when "Bookmark"
case action
+ when "create"
+ # Bookmarks can be created by authenticated users that can view the context
+ is_authorized = !user.nil? && Authorization.check('view', context, user)
when "destroy"
# only the user who created the bookmark can delete it
- is_authorized = Authorization.is_owner?(user_id, thing_instance)
+ is_authorized = object.user == user
when "view"
# everyone can view bookmarks
is_authorized = true
@@ -475,24 +154,52 @@
when "Experiment"
- user_instance = get_user(user_id) unless user_instance
+ if user.nil?
+ is_authorized = false
+ else
+ case object.contributor_type.to_s
+ when "User"
+ is_authorized = object.contributor_id.to_i == user.id.to_i
+ when "Network"
+ is_authorized = object.contributor.member?(user.id)
+ else
+ is_authorized = false
+ end
+ end
- # "action_name" used to work with original action name, rather than classification made inside the module
- is_authorized = Authorization.experiment_authorized?(thing_instance, action_name, user)
-
when "TavernaEnactor", "Runner"
- user_instance = get_user(user_id) unless user_instance
+ if user.nil?
+ is_authorized = false
+ else
+ case object.contributor_type.to_s
+ when "User"
+ is_authorized = object.contributor_id.to_i == user.id.to_i
+ when "Network"
+ if ['edit', 'destroy'].include?(action.downcase)
+ is_authorized = object.contributor.owner?(user.id)
+ else
+ is_authorized = object.contributor.member?(user.id)
+ end
+ else
+ is_authorized = false
+ end
+ end
- # "action_name" used to work with original action name, rather than classification made inside the module
- is_authorized = Authorization.runner_authorized?(thing_instance, action_name, user)
-
when "Job"
- user_instance = get_user(user_id) unless user_instance
-
- # "action_name" used to work with original action name, rather than classification made inside the module
- is_authorized = Authorization.job_authorized?(thing_instance, action_name, user)
+ if user.nil?
+ is_authorized = false
+ else
+ case object.experiment.contributor_type.to_s
+ when "User"
+ is_authorized = object.experiment.contributor_id.to_i == user.id.to_i
+ when "Network"
+ is_authorized = object.experiment.contributor.member?(user.id)
+ else
+ is_authorized = false
+ end
+ end
when "ContentType"
@@ -504,7 +211,7 @@
when "edit"
# the owner of the content type can edit
- is_authorized = !user.nil? && thing_instance.user_id == user_id
+ is_authorized = !user.nil? && object.user == user
when "destroy"
# noone can destroy them yet - they just fade away from view
@@ -521,11 +228,11 @@
when "edit"
# the owner of a user record can edit
- is_authorized = !user.nil? && user_id == thing_id
+ is_authorized = !user.nil? && user == object
when "destroy"
# only adminstrators can delete accounts at present
- is_authorized = user_is_administrator?(user)
+ is_authorized = user && user.admin?
end
when "Picture"
@@ -534,366 +241,104 @@
when "view"
# owner can view all their pictures
- return true if is_owner?(user_id, thing_instance)
+ return true if object.owner == user
# anyone can view a user's selected pictures
- is_authorized = thing_instance.selected?
+ is_authorized = object.selected?
when "edit", "destroy"
# only the owner of a picture can edit/destroy
- is_authorized = is_owner?(user_id, thing_instance)
+ is_authorized = object.owner == user
end
when "ClientApplication"
- is_authorized = is_owner?(user_id, thing_instance)
+ is_authorized = object.user == user
when "Ontology"
case action
+ when "create"
+ # Authenticated users can create ontologies
+ is_authorized = !user.nil?
+
when "view"
# All users can view
is_authorized = true
when "edit", "destroy"
# Users can edit and destroy their own ontologies
- is_authorized = Authorization.is_owner?(user_id, thing_instance)
+ is_authorized = object.user == user
end
when "Predicate"
case action
+ when "create"
+
+ raise "Context required for authorisation check" unless context
+
+ # Only users that can edit an ontology can add predicates to it
+ return !user.nil? && Authorization.check('edit', context, user)
+
when "view"
# All users can view predicates
is_authorized = true
else
# All other predicate permissions are inherited from the ontology
- is_authorized = Authorization.is_authorized?('edit', nil, thing_instance.ontology, user_id)
+ is_authorized = Authorization.check('edit', object.ontology, user)
end
when "Relationship"
case action
+ when "create"
+
+ raise "Context required for authorisation check" unless context
+
+ # Only users that can edit a pack can add relationships to it
+ return !user.nil? && Authorization.check('edit', context, user)
+
when "view"
# Users that can view the context can view the relationship
- is_authorized = Authorization.is_authorized?('view', nil, thing_instance.context, user_id)
+ is_authorized = Authorization.check('view', object.context, user)
else
# All other relationship permissions depend on edit access to the context
- is_authorized = Authorization.is_authorized?('edit', nil, thing_instance.context, user_id)
+ is_authorized = Authorization.check('edit', object.context, user)
end
- else
- # don't recognise the kind of "thing" that is being authorized, so
- # we don't specifically know that it needs to be blocked;
- # therefore, allow any actions on it
- is_authorized = true
- end
-
- is_authorized
- end
+ when "PackContributableEntry", "PackRemoteEntry"
+ case action
- private
+ when "create"
- def Authorization.categorize_action(action_name)
- case action_name
- when 'show', 'index', 'view', 'search', 'favourite', 'favourite_delete', 'comment', 'comment_delete', 'comments', 'comments_timeline', 'rate', 'tag', 'items', 'statistics', 'curation', 'suggestions', 'tag_suggestions', 'extra_metadata', 'read', 'verify'
- action = ''
- when 'edit', 'new', 'create', 'update', 'new_version', 'create_version', 'destroy_version', 'edit_version', 'update_version', 'new_item', 'create_item', 'edit_item', 'update_item', 'quick_add', 'resolve_link', 'process_suggestions', 'process_tag_suggestions', 'process_extra_metadata', 'edit_relationships'
- action = ''
- when 'download', 'named_download', 'named_download_with_version', 'launch', 'submit_job', 'save_inputs', 'refresh_status', 'rerun', 'refresh_outputs', 'render_output', 'outputs_xml', 'outputs_package', 'galaxy_tool', 'galaxy_tool_download'
- action = ''
- when 'destroy', 'delete', 'destroy_item'
- action = ''
- when 'execute'
- # action is available only(?) for runners at the moment;
- # possibly, "launch" action for workflows should be moved into this category, too
- action = ''
- else
- # unknown action
- action = ""
- end
-
- return action
- end
+ raise "Context required for authorisation check" unless context
- # check if the DB holds entry for the "thing" to be authorized
- def Authorization.find_thing(thing_type, thing_id)
- found_instance = nil
-
- begin
- case thing_type
- when "Workflow", "Blog", "Blob", "Pack"
- # "find_by_sql" works faster itself PLUS only a subset of all fields is selected;
- # this is the most frequent query to be executed, hence needs to be optimised
- found_instance = Contribution.find_by_sql "SELECT contributor_id, contributor_type, policy_id FROM contributions WHERE contributable_id=#{thing_id} AND contributable_type='#{thing_type}'"
- found_instance = (found_instance.empty? ? nil : found_instance[0]) # if nothing was found - nil; otherwise - first match
- when "Contribution"
- # fairly possible that it's going to be a contribution itself, not a contributable
- found_instance = Contribution.find(thing_id)
- when "Network"
- found_instance = Network.find(thing_id)
- when "Comment"
- found_instance = Comment.find(thing_id)
- when "Bookmark"
- found_instance = Bookmark.find(thing_id)
- when "Experiment"
- found_instance = Experiment.find(thing_id)
- when "Job"
- found_instance = Job.find(thing_id)
- when "TavernaEnactor"
- found_instance = TavernaEnactor.find(thing_id)
- when "Runner"
- # the line below doesn't have a typo - "runners" should really be searched in "TavernaEnactor" model
- found_instance = TavernaEnactor.find(thing_id)
- when "ContentType"
- found_instance = ContentType.find(thing_id)
- when "Picture"
- found_instance = Picture.find(thing_id)
- when "ClientApplication"
- found_instance = ClientApplication.find(thing_id)
- when "Ontology"
- found_instance = Ontology.find(thing_id)
- when "Predicate"
- found_instance = Predicate.find(thing_id)
- when "Relationship"
- found_instance = Relationship.find(thing_id)
- end
- rescue ActiveRecord::RecordNotFound
- # do nothing; makes sure that app won't crash when the required object is not found;
- # the method will return "nil" anyway, so no need to take any further actions here
- end
-
- return found_instance
- end
+ # Only users that can edit a pack can add items to it
+ return !user.nil? && Authorization.check('edit', context, user)
+ when "edit", "destroy"
+ # Users that can edit the pack can also edit / delete items
+ is_authorized = Authorization.check('edit', object.pack, user)
- # checks if "user" is owner of the "thing"
- def Authorization.is_owner?(user_id, thing)
- is_authorized = false
-
- case thing.class.name
- when "Contribution"
- # if owner of the "thing" is the "user" then the "user" is authorized
- if thing.contributor_type == 'User' && thing.contributor_id == user_id
- is_authorized = true
- elsif thing.contributor_type == 'Network'
- is_authorized = is_network_admin?(user_id, thing.contributor_id)
end
- when "Comment"
- is_authorized = (thing.user_id == user_id)
- when "Bookmark"
- is_authorized = (thing.user_id == user_id)
- when "Picture"
- is_authorized = (thing.user_id == user_id)
- when "ClientApplication"
- is_authorized = (thing.user_id == user_id)
- when "Ontology"
- is_authorized = (thing.user_id == user_id)
- #else
- # do nothing -- unknown "thing" types are not authorized by default
- end
- return is_authorized
- end
-
- # checks if "user" is admin of the policy associated with the "thing"
- def Authorization.is_policy_admin?(policy, user_id)
- # if anonymous user or no policy provided - definitely not policy admin
- return false unless (policy && user_id)
-
- return(policy.contributor_type == 'User' && policy.contributor_id == user_id)
- end
-
-
- def Authorization.is_network_admin?(user_id, network_id)
-
- return false unless user_id
-
- # checks if there is a network with ID(network_id) which has admin with ID(user_id) -
- # if found, user with ID(user_id) is an admin of that network
- network = Network.find_by_sql "SELECT user_id FROM networks WHERE id=#{network_id} AND user_id=#{user_id}"
- return(!network.blank?)
- end
-
-
- def Authorization.is_network_member?(user_id, network_id)
-
- return false unless user_id
-
- # checks if user with ID(user_id) is a member of the group ID(network_id)
- membership = Membership.find_by_sql "SELECT id FROM memberships WHERE user_id=#{user_id} AND network_id=#{network_id} AND user_established_at IS NOT NULL AND network_established_at IS NOT NULL"
- return(!membership.blank?)
- end
-
-
- # checks if two users are friends
- def Authorization.is_friend?(contributor_id, user_id)
- friendship = Friendship.find_by_sql "SELECT id FROM friendships WHERE ((user_id=#{contributor_id} AND friend_id=#{user_id}) OR (user_id=#{user_id} AND friend_id=#{contributor_id})) AND accepted_at IS NOT NULL"
- return(!friendship.blank?)
- end
-
-
- # gets the user object from the user_id;
- # used by is_authorized when calling model.authorized? method for classes that don't use policy-based authorization
- def Authorization.get_user(user_id)
- return nil if user_id == 0
-
- begin
- user = User.find(:first, :conditions => ["id = ?", user_id])
- return user
- rescue ActiveRecord::RecordNotFound
- # user not found, "nil" for anonymous user will be returned
- return nil
+ else
+ # don't recognise the kind of object that is being authorized, so
+ # we don't specifically know that it needs to be blocked;
+ # therefore, allow any actions on it
+ is_authorized = true
end
- end
-
-
- # query database for relevant fields in policies table
- #
- # Parameters:
- # 1) policy_id - ID of the policy to find in the DB;
- # 2) thing_contribution - Contribution object for the "thing" that is being authorized;
- def Authorization.get_policy(policy_id, thing_contribution)
- unless policy_id.blank?
- select_string = 'id, contributor_id, contributor_type, share_mode, update_mode'
- policy_array = Policy.find_by_sql "SELECT #{select_string} FROM policies WHERE policies.id=#{policy_id}"
-
- # if nothing's found, use the default policy
- policy = (policy_array.blank? ? get_default_policy(thing_contribution) : policy_array[0])
- else
- # if the "policy_id" turns out unknown, use default policy
- policy = get_default_policy(thing_contribution)
- end
- return policy
+ is_authorized
end
-
-
- # if a policy instance not found to be associated with the Contribution of a "thing", use a default one
- def Authorization.get_default_policy(thing_contribution)
- # an unlikely event that contribution doesn't have a policy - need to use
- # default one; "owner" of the contribution will be treated as policy admin
- #
- # the following is slow, but given the very rare execution can be kept
- begin
- # thing_contribution is Contribution, so thing_contribution.contributor is the original uploader == owner of the item
- contributor = eval("#{thing_contribution.contributor_type}.find(#{thing_contribution.contributor_id})")
- policy = Policy._default(contributor)
- return policy
- rescue ActiveRecord::RecordNotFound => e
- # original contributor not found, but the Contribution entry still exists -
- # this is an error in associations then, because all dependent items
- # should have been deleted along with the contributor entry; log the error
- Rails.logger.error("UNEXPECTED ERROR - Contributor object missing for an existing contribution: (#{thing_contribution.class.name}, #{thing_contribution.id})")
- Rails.logger.error("EXCEPTION:" + e)
- return nil
- end
- end
-
-
- # get all user permissions related to policy for the "thing" for "user"
- def Authorization.get_user_permissions(user_id, policy_id)
- unless user_id.blank? || policy_id.blank?
- select_string = 'contributor_id, download, edit, view'
- Permission.find_by_sql "SELECT #{select_string} FROM permissions WHERE policy_id=#{policy_id} AND contributor_type='User' AND contributor_id=#{user_id}"
- else
- # an empty array to be returned has the same effect as if no permissions were found anyway
- return []
- end
- end
-
-
- # get all group permissions related to policy for the "thing"
- def Authorization.get_group_permissions(policy_id)
- unless policy_id.blank?
- select_string = 'contributor_id, download, edit, view'
- Permission.find_by_sql "SELECT #{select_string} FROM permissions WHERE policy_id=#{policy_id} AND contributor_type='Network'"
- else
- # an empty array to be returned has the same effect as if no permissions were found anyway
- return []
- end
- end
-
- # checks whether "user" is authorized for "action" on "thing"
- def Authorization.authorized_by_policy?(policy, thing_contribution, action, user_id)
- is_authorized = false
-
- # NB! currently myExperiment won't support objects owned by entities other than users
- # (especially, policy checks are not agreed for these cases - however, owner tests and
- # permission tests are possible and will be carried out)
- unless thing_contribution.contributor_type == "User"
- return false
- end
-
- ####################################################################################
- #
- # For details on what each sharing / updating mode means, see the wiki:
- # http://wiki.myexperiment.org/index.php/Developer:Ownership_Sharing_and_Permissions
- #
- ####################################################################################
- share_mode = policy.share_mode
- update_mode = policy.update_mode
-
- case action
- when 'view'
- if (share_mode == 0 || share_mode == 1 || share_mode == 2)
- # if share mode is 0,1,2, anyone can view
- is_authorized = true
- elsif !user_id.nil? && (share_mode == 3 || share_mode == 4 || update_mode == 1)
- # if share mode is 3,4, friends can view; AND friends can also view if update mode is 1 -- due to cascading permissions
- is_authorized = is_friend?(thing_contribution.contributor_id, user_id)
- end
-
- when 'download'
- if (share_mode == 0)
- # if share mode is 0, anyone can download
- is_authorized = true
- elsif !user_id.nil? && (share_mode == 1 || share_mode == 3 || update_mode == 1)
- # if share mode is 1,3, friends can download; AND if update mode is 1, friends can download too -- due to cascading permissions
- is_authorized = is_friend?(thing_contribution.contributor_id, user_id)
- end
- when 'edit'
- if (update_mode == 0 && share_mode == 0)
- # if update mode is 0, anyone with view & download permissions can edit (sharing mode 0 for anonymous)
- is_authorized = true
- elsif !user_id.nil? && (update_mode == 1 || (update_mode == 0 && (share_mode == 1 || share_mode == 3)))
- # if update mode is 1, friends can edit; AND if update mode is 0 and friends have view & download permissions, they can edit
- is_authorized = is_friend?(thing_contribution.contributor_id, user_id)
- end
- end
-
- return is_authorized
- end
-
-
- # checks if a permission instance allows certain action taking into account cascading permissions
- #
- # NB! caller of this method *assumes* that the permission belongs to the user, for which
- # authorization is performed
- def Authorization.permission_allows_action?(action, permission)
- # check that a permission instance was supplied
- return false unless permission
-
- case action
- when "view"
- return (permission.attributes["view"] || permission.attributes["download"] || permission.attributes["edit"])
- when "download"
- return (permission.attributes["download"] || permission.attributes["edit"])
- when "edit"
- return permission.attributes["edit"]
- else
- # any other type of action is not allowed by permissions
- return false
- end
- end
-
def self.scoped(model, opts = {})
def self.view_conditions(user_id, friends, networks)
@@ -967,7 +412,7 @@
# not support authorization in themselves but by association with the
# taggable association.
#
- # In thie case, :auth_type would be "taggings.taggable_type" and :auth_id
+ # In this case, :auth_type would be "taggings.taggable_type" and :auth_id
# authorize would be "taggings.taggable_id".
auth_id = opts.delete(:auth_id) || "#{model.table_name}.id"
@@ -983,15 +428,20 @@
# Include the effective permissions in the result?
- if opts.delete(:include_permissions)
+ include_permissions = opts.delete(:include_permissions)
+ permissions_only = opts.delete(:permissions_only)
- opts[:select] = "#{model.table_name}.*"
+ select_parts = []
- opts[:select] << ", BIT_OR(#{view_conditions(user_id, friends, networks)}) AS view_permission"
- opts[:select] << ", BIT_OR(#{download_conditions(user_id, friends, networks)}) AS download_permission"
- opts[:select] << ", BIT_OR(#{edit_conditions(user_id, friends, networks)}) AS edit_permission"
+ select_parts << "#{model.table_name}.*" if include_permissions
+
+ if include_permissions || permissions_only
+ select_parts << "BIT_OR(#{view_conditions(user_id, friends, networks)}) AS view_permission"
+ select_parts << "BIT_OR(#{download_conditions(user_id, friends, networks)}) AS download_permission"
+ select_parts << "BIT_OR(#{edit_conditions(user_id, friends, networks)}) AS edit_permission"
end
+ opts[:select] = select_parts.join(", ") unless select_parts.empty?
opts[:conditions] = view_conditions(user_id, friends, networks)
opts[:group] ||= 'contributions.contributable_type, contributions.contributable_id'
opts[:joins] = joins
Modified: branches/wf4ever/lib/maintenance/backup.rb (3142 => 3143)
--- branches/wf4ever/lib/maintenance/backup.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/lib/maintenance/backup.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -109,7 +109,7 @@
content_blob_ids =
(Workflow.find(:all) + Workflow::Version.find(:all) + Blob.find(:all)).select do |x|
- Authorization.is_authorized?('view', nil, x, nil)
+ Authorization.check('view', x, nil)
end.map do |x|
x.content_blob_id
end
@@ -178,14 +178,14 @@
cmd = "tar czf address@hidden"
Workflow.find(:all).select do |w|
- if Authorization.is_authorized?('view', nil, w, nil)
+ if Authorization.check('view', w, nil)
add_path("public/workflow/image/#{w.id}", cmd)
add_path("public/workflow/svg/#{w.id}", cmd)
end
end
Workflow::Version.find(:all).select do |wv|
- if Authorization.is_authorized?('view', nil, wv.workflow, nil)
+ if Authorization.check('view', wv.workflow, nil)
add_path("public/workflow/version/image/#{wv.id}", cmd)
add_path("public/workflow/version/svg/#{wv.id}", cmd)
end
Modified: branches/wf4ever/lib/rest.rb (3142 => 3143)
--- branches/wf4ever/lib/rest.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/lib/rest.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -163,7 +163,7 @@
permission = model_data['Permission'][i]
if permission
- return nil if !Authorization.is_authorized?(permission, nil, ob, user)
+ return nil if !Authorization.check(permission, ob, user)
end
return nil if elements.nil? || elements[model_data['REST Attribute'][i]].nil?
@@ -196,7 +196,7 @@
# filter out things that the user cannot see
collection = collection.select do |c|
- not c.respond_to?('contribution') or Authorization.is_authorized?("view", nil, c, user)
+ not c.respond_to?('contribution') or Authorization.check("view", c, user)
end
collection.each do |item|
@@ -257,7 +257,7 @@
when 'xml'
if query['version'] and model_data['Versioned'][i] == 'yes'
- text = eval("ob.find_version(#{query['version']}).#{accessor}")
+ text = eval(sprintf("ob.find_version(%d).%s", query['version'], accessor))
else
text = eval("ob.#{accessor}")
end
@@ -280,7 +280,11 @@
el = LibXML::XML::Node.new(model_data['REST Attribute'][i])
- item = eval("ob.#{model_data['Accessor'][i]}")
+ if query['version'] and model_data['Versioned'][i] == 'yes'
+ item = eval(sprintf("ob.find_version(%d).%s", query['version'], model_data['Accessor'][i]))
+ else
+ item = eval("ob.#{model_data['Accessor'][i]}")
+ end
if item != nil
resource_uri = rest_resource_uri(item)
@@ -303,7 +307,7 @@
if accessor
if query['version'] and model_data['Versioned'][i] == 'yes'
- text = eval("ob.find_version(#{query['version']}).#{accessor}").to_s
+ text = eval(sprintf("ob.find_version(%d).%s", query['version'], accessor)).to_s
else
val = eval("ob.#{accessor}")
@@ -438,7 +442,7 @@
case rules['Permission']
when 'public'; # do nothing
- when 'view'; return rest_response(401, :reason => "Not authorised") if not Authorization.is_authorized?("show", nil, perm_ob, user)
+ when 'view'; return rest_response(401, :reason => "Not authorised") if not Authorization.check("view", perm_ob, user)
when 'owner'; return rest_response(401, :reason => "Not authorised") if logged_in?.nil? or object_owner(perm_ob) != user
end
@@ -457,7 +461,7 @@
results.select do |result|
- selected = Authorization.is_authorized?('view', nil, result, user)
+ selected = Authorization.check('view', result, user)
if selected
filters.each do |attribute, bits|
@@ -854,7 +858,7 @@
resource = cl.find_by_id(id)
- return nil if !Authorization.is_authorized?('view', nil, resource, user)
+ return nil if !Authorization.check('view', resource, user)
resource
end
@@ -878,7 +882,7 @@
return nil if resource.nil?
if permission
- return nil if !Authorization.is_authorized?(permission, nil, resource, user)
+ return nil if !Authorization.check(permission, resource, user)
end
resource
@@ -903,7 +907,7 @@
end
if permission
- if !Authorization.is_authorized?(permission, nil, resource, user)
+ if !Authorization.check(permission, resource, user)
return [nil, rest_response(401, :reason => "Not authorised for #{type} #{id}")]
end
end
@@ -923,7 +927,7 @@
return rest_response(404, :reason => "The specified resource does not exist") if ob.nil?
- return rest_response(401, :reason => "Not authorised for the specified resource") if !Authorization.is_authorized?('view', nil, ob, opts[:user])
+ return rest_response(401, :reason => "Not authorised for the specified resource") if !Authorization.check('view', ob, opts[:user])
rest_response(307, :location => rest_access_uri(ob))
end
@@ -980,13 +984,13 @@
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create a workflow") unless Authorization.is_authorized_for_type?('create', 'Workflow', opts[:user], nil)
+ return rest_response(401, :reason => "Not authorised to create a workflow") unless Authorization.check('create', Workflow, opts[:user], nil)
if opts[:query]['id']
ob, error = obtain_rest_resource('Workflow', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
ob = Workflow.new(:contributor => opts[:user])
end
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Workflow', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -1018,9 +1022,6 @@
# build the contributable
- ob.title = title if title
- ob.body = description if description
-
if license_type
if license_type == ""
ob.license = nil
@@ -1064,6 +1065,26 @@
ob.content_blob_id = ContentBlob.create(:data ="" content).id if content
+ # Handle versioned metadata. Priority:
+ #
+ # 1st = elements in REST request
+ # 2nd = extracted metadata from workflow processor
+ # 3rd = values from previous version
+
+ metadata = Workflow.extract_metadata(:type => ob.content_type.title, :data ="" content)
+
+ if title
+ ob.title = title
+ elsif metadata["title"]
+ ob.title = metadata["title"]
+ end
+
+ if description
+ ob.body = description
+ elsif metadata["description"]
+ ob.body = metadata["description"]
+ end
+
# Handle the preview and svg images. If there's a preview supplied, use
# it. Otherwise auto-generate one if we can.
@@ -1090,7 +1111,8 @@
return rest_response(500, :reason => "Unable to extract metadata")
end
- new_version = action == 'create' && opts[:query]['id']
+ new_version = action == 'create' && opts[:query]['id'] != nil
+ edit_version = action == 'edit' && opts[:query]['version'] != nil
if new_version
ob.preview = nil
@@ -1124,7 +1146,7 @@
end
def put_workflow(opts)
- workflow_aux('update', opts)
+ workflow_aux('edit', opts)
end
def delete_workflow(opts)
@@ -1139,13 +1161,13 @@
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create a file") unless Authorization.is_authorized_for_type?('create', 'Blob', opts[:user], nil)
+ return rest_response(401, :reason => "Not authorised to create a file") unless Authorization.check('create', Blob, opts[:user], nil)
if opts[:query]['id']
ob, error = obtain_rest_resource('Blob', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
ob = Blob.new(:contributor => opts[:user])
end
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Blob', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -1169,7 +1191,7 @@
type = parse_element(data, :text, '/file/type')
content_type = parse_element(data, :text, '/file/content-type')
content = parse_element(data, :binary, '/file/content')
- revision_comment = parse_element(data, :text, '/workflow/revision-comment')
+ revision_comment = parse_element(data, :text, '/file/revision-comment')
permissions = data.find_first('/file/permissions')
@@ -1252,7 +1274,7 @@
end
def put_file(opts)
- file_aux('update', opts)
+ file_aux('edit', opts)
end
def delete_file(opts)
@@ -1267,9 +1289,9 @@
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create a pack") unless Authorization.is_authorized_for_type?('create', 'Pack', opts[:user], nil)
+ return rest_response(401, :reason => "Not authorised to create a pack") unless Authorization.check('create', Pack, opts[:user], nil)
ob = Pack.new(:contributor => opts[:user])
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Pack', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -1315,7 +1337,7 @@
end
def put_pack(opts)
- pack_aux('update', opts)
+ pack_aux('edit', opts)
end
def delete_pack(opts)
@@ -1340,9 +1362,9 @@
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create an external pack item") unless Authorization.is_authorized_for_type?('create', 'PackRemoteEntry', opts[:user], pack)
+ return rest_response(401, :reason => "Not authorised to create an external pack item") unless Authorization.check('create', PackRemoteEntry, opts[:user], pack)
return rest_response(400, :reason => "Pack not found") if pack.nil?
- return rest_response(401, :reason => "Not authorised to change the specified pack") unless Authorization.is_authorized?('edit', nil, pack, opts[:user])
+ return rest_response(401, :reason => "Not authorised to change the specified pack") unless Authorization.check('edit', pack, opts[:user])
ob = PackRemoteEntry.new(:user => opts[:user],
:pack => pack,
@@ -1351,12 +1373,12 @@
:alternate_uri => alternate_uri,
:comment => comment)
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('PackRemoteEntry', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
if ob
- return rest_response(401, :reason => "Not authorised to change the specified pack") unless Authorization.is_authorized?('edit', nil, ob.pack, opts[:user])
+ return rest_response(401, :reason => "Not authorised to change the specified pack") unless Authorization.check('edit', ob.pack, opts[:user])
end
else
@@ -1389,7 +1411,7 @@
end
def put_external_pack_item(opts)
- external_pack_item_aux('update', opts)
+ external_pack_item_aux('edit', opts)
end
def delete_external_pack_item(opts)
@@ -1412,23 +1434,18 @@
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create an internal pack item") unless Authorization.is_authorized_for_type?('create', 'PackContributableEntry', opts[:user], pack)
+ return rest_response(401, :reason => "Not authorised to create an internal pack item") unless Authorization.check('create', PackContributableEntry, opts[:user], pack)
return rest_response(400, :reason => "Pack not found") if pack.nil?
- return rest_response(401, :reason => "Not authorised to change the specified pack") unless Authorization.is_authorized?('edit', nil, pack, opts[:user])
ob = PackContributableEntry.new(:user => opts[:user],
:pack => pack,
:contributable => item,
:comment => comment)
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('PackContributableEntry', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
- if ob
- return rest_response(401, :reason => "Not authorised to change the specified pack") unless Authorization.is_authorized?('edit', nil, ob.pack, opts[:user])
- end
-
else
raise "Invalid action '#{action}'"
end
@@ -1456,7 +1473,7 @@
end
def put_internal_pack_item(opts)
- internal_pack_item_aux('update', opts)
+ internal_pack_item_aux('edit', opts)
end
def delete_internal_pack_item(opts)
@@ -1483,9 +1500,9 @@
# runner = TavernaEnactor.find_by_id(runner_bits[1].to_i)
# runnable = Workflow.find_by_id(runnable_bits[1].to_i)
#
-# return rest_response(400) if experiment.nil? or not Authorization.is_authorized?('edit', nil, experiment, opts[:user])
-# return rest_response(400) if runner.nil? or not Authorization.is_authorized?('download', nil, runner, opts[:user])
-# return rest_response(400) if runnable.nil? or not Authorization.is_authorized?('view', nil, runnable, opts[:user])
+# return rest_response(400) if experiment.nil? or not Authorization.check('edit', experiment, opts[:user])
+# return rest_response(400) if runner.nil? or not Authorization.check('download', runner, opts[:user])
+# return rest_response(400) if runnable.nil? or not Authorization.check('view', runnable, opts[:user])
#
# puts "#{params[:job]}"
#
@@ -1541,7 +1558,7 @@
obs = model.find(:all, :conditions => ['id >= ? AND id <= ?', bits[2], bits[3]])
- obs = (obs.select do |c| c.respond_to?('contribution') == false or Authorization.is_authorized?("view", nil, c, opts[:user]) end)
+ obs = (obs.select do |c| c.respond_to?('contribution') == false or Authorization.check("view", c, opts[:user]) end)
return produce_rest_list(opts[:req_uri], opts[:rules], opts[:query], obs, 'search', {}, opts[:user])
end
@@ -1622,7 +1639,7 @@
def workflow_count(opts)
workflows = Workflow.find(:all).select do |w|
- Authorization.is_authorized?('view', nil, w, opts[:user])
+ Authorization.check('view', w, opts[:user])
end
root = LibXML::XML::Node.new('workflow-count')
@@ -1637,7 +1654,7 @@
def pack_count(opts)
packs = Pack.find(:all).select do |p|
- Authorization.is_authorized?('view', nil, p, opts[:user])
+ Authorization.check('view', p, opts[:user])
end
root = LibXML::XML::Node.new('pack-count')
@@ -1669,7 +1686,7 @@
obs = tag ? tag.tagged : []
# filter out ones they are not allowed to get
- obs = (obs.select do |c| c.respond_to?('contribution') == false or Authorization.is_authorized?("index", nil, c, opts[:user]) end)
+ obs = (obs.select do |c| c.respond_to?('contribution') == false or Authorization.check("view", c, opts[:user]) end)
produce_rest_list("tagged", opts[:rules], opts[:query], obs, 'tagged', [], opts[:user])
end
@@ -1773,7 +1790,7 @@
privileges = LibXML::XML::Node.new('privileges')
['view', 'download', 'edit'].each do |type|
- if Authorization.is_authorized?(type, nil, ob, user)
+ if Authorization.check(type, ob, user)
privilege = LibXML::XML::Node.new('privilege')
privilege['type'] = type
@@ -1788,14 +1805,22 @@
def comment_aux(action, opts)
+ unless action == "destroy"
+
+ data = ""
+
+ comment = parse_element(data, :text, '/comment/comment')
+ subject = parse_element(data, :resource, '/comment/subject')
+ end
+
# Obtain object
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create a comment") unless Authorization.is_authorized_for_type?('create', 'Comment', opts[:user], nil)
+ return rest_response(401, :reason => "Not authorised to create a comment") unless Authorization.check('create', Comment, opts[:user], subject)
ob = Comment.new(:user => opts[:user])
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Comment', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -1809,16 +1834,11 @@
else
- data = ""
-
- comment = parse_element(data, :text, '/comment/comment')
- subject = parse_element(data, :resource, '/comment/subject')
-
ob.comment = comment if comment
if subject
return rest_response(400, :reason => "Specified resource does not support comments") unless [Blob, Network, Pack, Workflow].include?(subject.class)
- return rest_response(401, :reason => "Not authorised to add a comment to the specified resource") unless Authorization.is_authorized_for_type?(action, 'Comment', opts[:user], subject)
+ return rest_response(401, :reason => "Not authorised to add a comment to the specified resource") unless Authorization.check(action, Comment, opts[:user], subject)
ob.commentable = subject
end
@@ -1902,7 +1922,7 @@
end
def put_comment(opts)
- comment_aux('update', opts)
+ comment_aux('edit', opts)
end
def delete_comment(opts)
@@ -1913,14 +1933,21 @@
def favourite_aux(action, opts)
+ unless action == "destroy"
+
+ data = ""
+
+ target = parse_element(data, :resource, '/favourite/object')
+ end
+
# Obtain object
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create a favourite") unless Authorization.is_authorized_for_type?('create', 'Bookmark', opts[:user], nil)
+ return rest_response(401, :reason => "Not authorised to create a favourite") unless Authorization.check('create', Bookmark, opts[:user], target)
ob = Bookmark.new(:user => opts[:user])
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Bookmark', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -1934,13 +1961,9 @@
else
- data = ""
-
- target = parse_element(data, :resource, '/favourite/object')
-
if target
return rest_response(400, :reason => "Specified resource is not a valid favourite target") unless [Blob, Pack, Workflow].include?(target.class)
- return rest_response(401, :reason => "Not authorised to create the favourite") unless Authorization.is_authorized_for_type?(action, 'Bookmark', opts[:user], target)
+ return rest_response(401, :reason => "Not authorised to create the favourite") unless Authorization.check(action, Bookmark, opts[:user], target)
ob.bookmarkable = target
end
@@ -1955,7 +1978,7 @@
end
def put_favourite(opts)
- favourite_aux('update', opts)
+ favourite_aux('edit', opts)
end
def delete_favourite(opts)
@@ -1966,14 +1989,22 @@
def rating_aux(action, opts)
+ unless action == "destroy"
+
+ data = ""
+
+ rating = parse_element(data, :text, '/rating/rating')
+ subject = parse_element(data, :resource, '/rating/subject')
+ end
+
# Obtain object
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create a rating") unless Authorization.is_authorized_for_type?('create', 'Rating', opts[:user], nil)
+ return rest_response(401, :reason => "Not authorised to create a rating") unless Authorization.check('create', Rating, opts[:user], subject)
ob = Rating.new(:user => opts[:user])
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Rating', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -1987,16 +2018,11 @@
else
- data = ""
-
- rating = parse_element(data, :text, '/rating/rating')
- subject = parse_element(data, :resource, '/rating/subject')
-
ob.rating = rating if rating
if subject
return rest_response(400, :reason => "Specified resource does not support ratings") unless [Blob, Network, Pack, Workflow].include?(subject.class)
- return rest_response(401, :reason => "Not authorised for the specified resource") unless Authorization.is_authorized_for_type?(action, 'Rating', opts[:user], subject)
+ return rest_response(401, :reason => "Not authorised for the specified resource") unless Authorization.check(action, Rating, opts[:user], subject)
ob.rateable = subject
end
@@ -2011,7 +2037,7 @@
end
def put_rating(opts)
- rating_aux('update', opts)
+ rating_aux('edit', opts)
end
def delete_rating(opts)
@@ -2022,14 +2048,23 @@
def tagging_aux(action, opts)
+ unless action == "destroy"
+
+ data = ""
+
+ subject = parse_element(data, :resource, '/tagging/subject')
+ label = parse_element(data, :text, '/tagging/label')
+ tag = parse_element(data, :resource, '/tagging/tag')
+ end
+
# Obtain object
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create a tagging") unless Authorization.is_authorized_for_type?('create', 'Tagging', opts[:user], nil)
+ return rest_response(401, :reason => "Not authorised to create a tagging") unless Authorization.check('create', Tagging, opts[:user], subject)
ob = Tagging.new(:user => opts[:user])
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Tagging', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -2043,17 +2078,11 @@
else
- data = ""
-
- subject = parse_element(data, :resource, '/tagging/subject')
- label = parse_element(data, :text, '/tagging/label')
- tag = parse_element(data, :resource, '/tagging/tag')
-
ob.label = label if label
ob.tag = tag if tag
if subject
- return rest_response(401, :reason => "Not authorised for the specified resource") unless Authorization.is_authorized_for_type?(action, 'Rating', opts[:user], subject)
+ return rest_response(401, :reason => "Not authorised for the specified resource") unless Authorization.check(action, Rating, opts[:user], subject)
ob.taggable = subject
end
@@ -2079,9 +2108,9 @@
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create an ontology") unless Authorization.is_authorized_for_type?('create', 'Ontology', opts[:user], nil)
+ return rest_response(401, :reason => "Not authorised to create an ontology") unless Authorization.check('create', Ontology, opts[:user], nil)
ob = Ontology.new(:user => opts[:user])
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Ontology', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -2122,7 +2151,7 @@
end
def put_ontology(opts)
- ontology_aux('update', opts)
+ ontology_aux('edit', opts)
end
def delete_ontology(opts)
@@ -2149,9 +2178,9 @@
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create a predicate") unless Authorization.is_authorized_for_type?('create', 'Predicate', opts[:user], ontology)
+ return rest_response(401, :reason => "Not authorised to create a predicate") unless Authorization.check('create', Predicate, opts[:user], ontology)
ob = Predicate.new
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Predicate', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -2186,7 +2215,7 @@
end
def put_predicate(opts)
- predicate_aux('update', opts)
+ predicate_aux('edit', opts)
end
def delete_predicate(opts)
@@ -2211,9 +2240,9 @@
case action
when 'create':
- return rest_response(401, :reason => "Not authorised to create a relationship") unless Authorization.is_authorized_for_type?('create', 'Relationship', opts[:user], context)
+ return rest_response(401, :reason => "Not authorised to create a relationship") unless Authorization.check('create', Relationship, opts[:user], context)
ob = Relationship.new(:user => opts[:user])
- when 'read', 'update', 'destroy':
+ when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Relationship', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else
raise "Invalid action '#{action}'"
@@ -2247,7 +2276,7 @@
end
def put_relationship(opts)
- relationship_aux('update', opts)
+ relationship_aux('edit', opts)
end
def delete_relationship(opts)
Modified: branches/wf4ever/public/stylesheets/biovel.css (3142 => 3143)
--- branches/wf4ever/public/stylesheets/biovel.css 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/public/stylesheets/biovel.css 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,4 +1,4 @@
-/* Stylesheet for the e-LICO layout. Requires main myExperiment stylesheet. */
+/* Stylesheet for the BioVeL group's skin, based on the e-LICO layout. Requires main myExperiment stylesheet. */
body {
background: #EEEB99;
@@ -8,6 +8,9 @@
background-color: #99cc33;
}
+.pagination a, .tabnav li a:hover, .tabnav li#selected_tabnav a {
+ background-image: none;
+}
#myexp_searchbar {
background-image: url('/images/searchfade_alpha.png');
}
Modified: branches/wf4ever/public/stylesheets/gadgets.css (3142 => 3143)
--- branches/wf4ever/public/stylesheets/gadgets.css 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/public/stylesheets/gadgets.css 2012-10-08 12:24:24 UTC (rev 3143)
@@ -1,7 +1,7 @@
/* begin css gadget base */
.myexperiment_gadget {
- margin: 0 0 0.5em 0;
+ margin: 0 0 6px 0;
text-align: center;
}
@@ -27,19 +27,13 @@
}
.myexperiment_gadget .header {
- border: #CCCCCC 0px solid;
- border-width: 1px 1px 1px 1px;
- border-bottom-color: #CCCCCC;
- border-radius: 8px 8px 0px 0px;
- -moz-border-radius: 8px 8px 0px 0px;
- -webkit-border-top-left-radius: 8px;
- -webkit-border-top-right-radius: 8px;
- background-image: url('/images/gadget-hd-bg.png');
- background-position: top;
- background-repeat: repeat-x;
- background-color: #EEEEEE;
+ border-radius: 5px 5px 0px 0px;
+ -moz-border-radius: 5px 5px 0px 0px;
+ -webkit-border-top-left-radius: 5px;
+ -webkit-border-top-right-radius: 5px;
+ background-color: #E0E0E0;
text-align: center;
- padding: 0 0.5em 0.2em 0.5em;
+ padding: 0 6px 0 6px;
}
.myexperiment_gadget .header p {
@@ -51,18 +45,14 @@
font-size: 85%;
line-height: 1.4;
color: #333333;
- margin: 0 0.5em;
+ margin: 0 4px;
}
.myexperiment_gadget .contents {
- border-top: none;
- border-right: #CCCCCC 1px solid;
- border-bottom: #CCCCCC 1px solid;
- border-left: #CCCCCC 1px solid;
- border-radius: 0px 0px 8px 8px;
- -moz-border-radius: 0px 0px 8px 8px;
- -webkit-border-bottom-left-radius: 8px;
- -webkit-border-bottom-right-radius: 8px;
+ border-radius: 0px 0px 5px 5px;
+ -moz-border-radius: 0px 0px 5px 5px;
+ -webkit-border-bottom-left-radius: 5px;
+ -webkit-border-bottom-right-radius: 5px;
color: #000000;
padding: 0.4em;
margin-top: 0;
@@ -75,8 +65,10 @@
}
.myexperiment_gadget .contents hr {
- height: 1px;
- border-bottom: 1px dotted #999999;
+ border: none;
+ height: 2px;
+ color: #456AAA;
+ background-color: #456AAA;
margin: 0.7em 0;
*margin: 0;
padding: 0;
@@ -115,85 +107,14 @@
/* end css gadget base */
-/* begin css rounded corners - based on "Snazzy Corners" */
-
-.myexperiment_gadget .xtop,
-.myexperiment_gadget .xbottom {
- display: block;
- background: transparent;
- font-size: 1px;
-}
-
-.myexperiment_gadget .xb1,
-.myexperiment_gadget .xb2,
-.myexperiment_gadget .xb3,
-.myexperiment_gadget .xb4,
-.myexperiment_gadget .xb5,
-.myexperiment_gadget .xb6,
-.myexperiment_gadget .xb7 {
- display: block;
- overflow: hidden;
-}
-
-.myexperiment_gadget .xb1,
-.myexperiment_gadget .xb2,
-.myexperiment_gadget .xb3,
-.myexperiment_gadget .xb6,
-.myexperiment_gadget .xb7 {
- height: 1px;
-}
-
-.myexperiment_gadget .xb2,
-.myexperiment_gadget .xb3,
-.myexperiment_gadget .xb4 {
- background: #DEDEDE;
- border-left: 1px solid #CCCCCC;
- border-right: 1px solid #CCCCCC;
-}
-
-.myexperiment_gadget .xb5,
-.myexperiment_gadget .xb6,
-.myexperiment_gadget .xb7 {
- background: #FFFFFF;
- border-left: 1px solid #CCCCCC;
- border-right: 1px solid #CCCCCC;
-}
-
-.myexperiment_gadget .xb1 {
- margin: 0 5px;
- background: #CCCCCC;
-}
-
-.myexperiment_gadget .xb2,
-.myexperiment_gadget .xb7 {
- margin: 0 3px;
- border-width: 0 2px;
-}
-
-.myexperiment_gadget .xb3,
-.myexperiment_gadget .xb6 {
- margin: 0 2px;
-}
-
-.myexperiment_gadget .xb4,
-.myexperiment_gadget .xb5 {
- height: 2px;
- margin: 0 1px;
-}
-
-/* end css rounded corners - based on "Snazzy Corners" */
-
/* begin css New Object Gadget style */
#new_object_form {
- padding: 0 0.5em;
- text-align: center;
+ padding: 0;
}
#new_object_type {
width: 110px;
- text-align: center;
- font-weight: bold;
}
/* end css New Object Gadget style */
@@ -224,8 +145,7 @@
margin-top: 0.6em;
margin-bottom: 0.2em;
padding: 0.2em 0;
- border-bottom: 1px dotted #999999;
- font-weight: bold;
+ font-size: 100%;
}
#myexp_assetmanager_gadget_contents .content {
Modified: branches/wf4ever/public/stylesheets/reset-fonts-grids.css (3142 => 3143)
--- branches/wf4ever/public/stylesheets/reset-fonts-grids.css 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/public/stylesheets/reset-fonts-grids.css 2012-10-08 12:24:24 UTC (rev 3143)
@@ -4,6 +4,6 @@
http://developer.yahoo.net/yui/license.txt
version: 2.3.1
*/
-/*reset.css*/body{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup,sub{line-height:-1px;vertical-align:text-top;}sub{vertical-align:text-bottom;}input, textarea, select{font-family:inherit;font-size:inherit;font-weight:inherit;}
+/*reset.css*/body{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,textarea,p,blockquote,th,td{margin:0;padding:0}input{margin:0;padding-top:0;padding-bottom:0}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup,sub{line-height:-1px;vertical-align:text-top;}sub{vertical-align:text-bottom;}input, textarea, select{font-family:inherit;font-size:inherit;font-weight:inherit;}
/*fonts.css*/body {font:13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:99%;}
-/*grids.css*/body{text-align:center;}#ft{clear:both;}#doc,#doc2,#doc3,#doc4,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7{margin:auto;text-align:left;width:57.69em;*width:56.301em;min-width:750px;}#doc2{width:73.074em;*width:71.313em;}#doc3{margin:auto 10px;width:auto;}#doc4{width:74.923em;*width:73.117em;}.yui-b{position:relative;}.yui-b{_position:static;}#yui-main .yui-b{position:static;}#yui-main{width:100%;}.yui-t1 #yui-main,.yui-t2 #yui-main,.yui-t3 #yui-main{float:right;margin-left:-25em;}.yui-t4 #yui-main,.yui-t5 #yui-main,.yui-t6 #yui-main{float:left;margin-right:-25em;}.yui-t1 .yui-b{float:left;width:12.3207em;*width:12.0106em;}.yui-t1 #yui-main .yui-b{margin-left:13.3207em;*margin-left:13.0106em;}.yui-t2 .yui-b{float:left;width:13.8456em;*width:13.512em;}.yui-t2 #yui-main .yui-b{margin-left:14.8456em;*margin-left:14.512em;}.yui-t3 .yui-b{float:left;width:23.0759em;*width:22.52em;}.yui-t3 #yui-main .yui-b{margin-left:24.0759em;*margin-left:23.52em;}.yui-t4 .yui-b{float:right;width:13.8456em;*width:13.512em;}.yui-t4 #yui-main .yui-b{margin-right:14.8456em;*margin-right:14.512em;}.yui-t5 .yui-b{float:right;width:18.4608em;*width:18.016em;}.yui-t5 #yui-main .yui-b{margin-right:19.4608em;*margin-right:19.016em;}.yui-t6 .yui-b{float:right;width:23.0759em;*width:22.52em;}.yui-t6 #yui-main .yui-b{margin-right:24.0759em;*margin-right:23.52em;}.yui-t7 #yui-main .yui-b{display:block;margin:0 0 1em 0;}#yui-main .yui-b{float:none;width:auto;}.yui-g .yui-gb .yui-u,.yui-gb .yui-g,.yui-gb .yui-gb,.yui-gb .yui-gc,.yui-gb .yui-gd,.yui-gb .yui-ge,.yui-gb .yui-gf,.yui-gb .yui-u,.yui-gc .yui-u,.yui-gc .yui-g,.yui-gd .yui-u{float:left;margin-left:2%;width:32%;}.yui-gb .yui-gb .yui-u,.yui-gb .yui-gc .yui-u{*margin-left:1.8%;_margin-left:4%;}.yui-g .yui-gb .yui-u{_margin-left:.8%;}.yui-gb .yui-u{float:right;}.yui-gb div.first{margin-left:0;float:left;}.yui-g .yui-gb div.first,.yui-gb .yui-gb div.first{*margin-right:0;*width:32%;_width:31.7%;}.yui-gb .yui-gc div.first,.yui-gb .yui-gd div.first{*margin-right:0;}.yui-gb .yui-gd .yui-u{*width:66%;_width:61.2%;}.yui-gb .yui-gd div.first{*width:31%;_width:29.5%;}.yui-g .yui-gc .yui-u,.yui-gb .yui-gc .yui-u{width:32%;_float:right;margin-right:0;_margin-left:0;}.yui-gb .yui-gc div.first{width:66%;*float:left;*margin-left:0;}.yui-gb .yui-ge .yui-u,.yui-gb .yui-gf .yui-u{margin:0;}.yui-g .yui-u,.yui-g .yui-g,.yui-g .yui-gb,.yui-g .yui-gc,.yui-g .yui-gd,.yui-g .yui-ge,.yui-g .yui-gf,.yui-gc .yui-u,.yui-gd .yui-g,.yui-g .yui-gc .yui-u,.yui-ge .yui-u,.yui-ge .yui-g,.yui-gf .yui-g,.yui-gf .yui-u{float:right;}.yui-g .yui-gc div.first,.yui-g .yui-ge div.first,.yui-g div.first,.yui-gc div.first,.yui-gc div.first div.first,.yui-gd div.first,.yui-ge div.first,.yui-gf div.first{float:left;}.yui-g .yui-g .yui-u,.yui-gb .yui-g .yui-u,.yui-gc .yui-g .yui-u,.yui-gd .yui-g .yui-u,.yui-ge .yui-g .yui-u,.yui-gf .yui-g .yui-u{width:49%;*width:48.1%;*margin-left:0;}.yui-g .yui-g div.first{*margin:0;}.yui-gb .yui-g div.first{*margin-right:4%;_margin-right:1.3%;}.yui-gb .yui-gb .yui-u{_margin-left:.7%;}.yui-gb .yui-g div.first,.yui-gb .yui-gb div.first{*margin-left:0;}.yui-gc .yui-g .yui-u,.yui-gd .yui-g .yui-u{*width:48.1%;*margin-left:0;}.yui-g .yui-u,.yui-g .yui-g,.yui-g .yui-gb,.yui-g .yui-gc,.yui-g .yui-gd,.yui-g .yui-ge,.yui-g .yui-gf{width:49.1%;}.yui-g .yui-gb div.first,.yui-gb div.first,.yui-gc div.first,.yui-gd div.first{margin-left:0;}.yui-g .yui-gc div.first,.yui-gc div.first,.yui-gd .yui-g,.yui-gd .yui-u{width:66%;}.yui-gd div.first,.yui-gb .yui-gd div.first{width:32%;}.yui-g .yui-gd div.first{_width:29.9%;}.yui-ge .yui-u,.yui-ge .yui-g,.yui-gf div.first{width:24%;}.yui-gb .yui-ge div.yui-u,.yui-gb .yui-gf div.yui-u{float:right;}.yui-gb .yui-ge div.first,.yui-gb .yui-gf div.first {float:left;}.yui-ge div.first,.yui-gf .yui-g,.yui-gf .yui-u{width:74.2%;}.yui-gb .yui-ge .yui-u,.yui-gb .yui-gf div.first{*width:24%;_width:20%;}.yui-gb .yui-ge div.first,.yui-gb .yui-gf .yui-u{*width:73.5%;_width:65.5%;}#bd:after,.yui-g:after,.yui-gb:after,.yui-gc:after,.yui-gd:after,.yui-ge:after,.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd,.yui-g,.yui-gb,.yui-gc,.yui-gd,.yui-ge,.yui-gf{zoom:1;}.yui-gb .yui-u{float:left;}
\ No newline at end of file
+/*grids.css*/body{text-align:center;}#ft{clear:both;}#doc,#doc2,#doc3,#doc4,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7{margin:auto;text-align:left;width:57.69em;*width:56.301em;min-width:750px;}#doc2{width:73.074em;*width:71.313em;}#doc3{margin:auto 10px;width:auto;}#doc4{width:74.923em;*width:73.117em;}.yui-b{position:relative;}.yui-b{_position:static;}#yui-main .yui-b{position:static;}#yui-main{width:770px;}.yui-t1 #yui-main,.yui-t2 #yui-main,.yui-t3 #yui-main{float:right;margin-left:-180px;}.yui-t4 #yui-main,.yui-t5 #yui-main,.yui-t6 #yui-main{float:left;margin-right:-180px;}.yui-t1 .yui-b{float:left;width:12.3207em;*width:12.0106em;}.yui-t1 #yui-main .yui-b{margin-left:13.3207em;*margin-left:13.0106em;}.yui-t2 .yui-b{float:left;width:13.8456em;*width:13.512em;}.yui-t2 #yui-main .yui-b{margin-left:12px;}.yui-t3 .yui-b{float:left;width:23.0759em;*width:22.52em;}.yui-t3 #yui-main .yui-b{margin-left:24.0759em;*margin-left:23.52em;}.yui-t4 .yui-b{float:right;width:13.8456em;*width:13.512em;}.yui-t4 #yui-main .yui-b{margin-right:12px;}.yui-t5 .yui-b{float:right;width:18.4608em;*width:18.016em;}.yui-t5 #yui-main .yui-b{margin-right:19.4608em;*margin-right:19.016em;}.yui-t6 .yui-b{float:right;width:23.0759em;*width:22.52em;}.yui-t6 #yui-main .yui-b{margin-right:24.0759em;*margin-right:23.52em;}.yui-t7 #yui-main .yui-b{display:block;margin:0 0 1em 0;}#yui-main .yui-b{float:none;width:auto;}.yui-g .yui-gb .yui-u,.yui-gb .yui-g,.yui-gb .yui-gb,.yui-gb .yui-gc,.yui-gb .yui-gd,.yui-gb .yui-ge,.yui-gb .yui-gf,.yui-gb .yui-u,.yui-gc .yui-u,.yui-gc .yui-g,.yui-gd .yui-u{float:left;margin-left:2%;width:32%;}.yui-gb .yui-gb .yui-u,.yui-gb .yui-gc .yui-u{*margin-left:1.8%;_margin-left:4%;}.yui-g .yui-gb .yui-u{_margin-left:.8%;}.yui-gb .yui-u{float:right;}.yui-gb div.first{margin-left:0;float:left;}.yui-g .yui-gb div.first,.yui-gb .yui-gb div.first{*margin-right:0;*width:32%;_width:31.7%;}.yui-gb .yui-gc div.first,.yui-gb .yui-gd div.first{*margin-right:0;}.yui-gb .yui-gd .yui-u{*width:66%;_width:61.2%;}.yui-gb .yui-gd div.first{*width:31%;_width:29.5%;}.yui-g .yui-gc .yui-u,.yui-gb .yui-gc .yui-u{width:32%;_float:right;margin-right:0;_margin-left:0;}.yui-gb .yui-gc div.first{width:66%;*float:left;*margin-left:0;}.yui-gb .yui-ge .yui-u,.yui-gb .yui-gf .yui-u{margin:0;}.yui-g .yui-u,.yui-g .yui-g,.yui-g .yui-gb,.yui-g .yui-gc,.yui-g .yui-gd,.yui-g .yui-ge,.yui-g .yui-gf,.yui-gc .yui-u,.yui-gd .yui-g,.yui-g .yui-gc .yui-u,.yui-ge .yui-u,.yui-ge .yui-g,.yui-gf .yui-g,.yui-gf .yui-u{float:right;}.yui-g .yui-gc div.first,.yui-g .yui-ge div.first,.yui-g div.first,.yui-gc div.first,.yui-gc div.first div.first,.yui-gd div.first,.yui-ge div.first,.yui-gf div.first{float:left;}.yui-g .yui-g .yui-u,.yui-gb .yui-g .yui-u,.yui-gc .yui-g .yui-u,.yui-gd .yui-g .yui-u,.yui-ge .yui-g .yui-u,.yui-gf .yui-g .yui-u{width:49%;*width:48.1%;*margin-left:0;}.yui-g .yui-g div.first{*margin:0;}.yui-gb .yui-g div.first{*margin-right:4%;_margin-right:1.3%;}.yui-gb .yui-gb .yui-u{_margin-left:.7%;}.yui-gb .yui-g div.first,.yui-gb .yui-gb div.first{*margin-left:0;}.yui-gc .yui-g .yui-u,.yui-gd .yui-g .yui-u{*width:48.1%;*margin-left:0;}.yui-g .yui-u,.yui-g .yui-g,.yui-g .yui-gb,.yui-g .yui-gc,.yui-g .yui-gd,.yui-g .yui-ge,.yui-g .yui-gf{width:49.1%;}.yui-g .yui-gb div.first,.yui-gb div.first,.yui-gc div.first,.yui-gd div.first{margin-left:0;}.yui-g .yui-gc div.first,.yui-gc div.first,.yui-gd .yui-g,.yui-gd .yui-u{width:66%;}.yui-gd div.first,.yui-gb .yui-gd div.first{width:32%;}.yui-g .yui-gd div.first{_width:29.9%;}.yui-ge .yui-u,.yui-ge .yui-g,.yui-gf div.first{width:24%;}.yui-gb .yui-ge div.yui-u,.yui-gb .yui-gf div.yui-u{float:right;}.yui-gb .yui-ge div.first,.yui-gb .yui-gf div.first {float:left;}.yui-ge div.first,.yui-gf .yui-g,.yui-gf .yui-u{width:74.2%;}.yui-gb .yui-ge .yui-u,.yui-gb .yui-gf div.first{*width:24%;_width:20%;}.yui-gb .yui-ge div.first,.yui-gb .yui-gf .yui-u{*width:73.5%;_width:65.5%;}#bd:after,.yui-g:after,.yui-gb:after,.yui-gc:after,.yui-gd:after,.yui-ge:after,.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd,.yui-g,.yui-gb,.yui-gc,.yui-gd,.yui-ge,.yui-gf{zoom:1;}.yui-gb .yui-u{float:left;}
Modified: branches/wf4ever/public/stylesheets/skin_template.css (3142 => 3143)
--- branches/wf4ever/public/stylesheets/skin_template.css 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/public/stylesheets/skin_template.css 2012-10-08 12:24:24 UTC (rev 3143)
@@ -5,6 +5,9 @@
background-color: #317EFF;
}
+.pagination a, .tabnav li a:hover, .tabnav li#selected_tabnav a {
+ background-image: none;
+}
#myexp_searchbar {
background-image: url('/images/searchfade_alpha.png');
}
Modified: branches/wf4ever/public/stylesheets/styles.css (3142 => 3143)
--- branches/wf4ever/public/stylesheets/styles.css 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/public/stylesheets/styles.css 2012-10-08 12:24:24 UTC (rev 3143)
@@ -7,18 +7,12 @@
http://developer.yahoo.com/yui/fonts/#fontsize
*/
body {
- background: #8e8e8e url('/images/body-bg.gif') repeat-y center;
- /* Only need to define one font here because the
- YUI Fonts CSS provides a degradation path
- (see: http://developer.yahoo.com/yui/fonts/) */
+ background: #8e8e8e;
font-family: arial;
- /*background-color: #FFFFFF;*/
-
line-height: 1.0;
}
p {
- font-family: arial;
padding: 0.3em 0;
line-height: 1.4;
text-align: left;
@@ -30,7 +24,6 @@
}
h1,h2,h3,h4,h5,h6 {
- font-family: arial;
line-height: 1.0;
color: #333333;
}
@@ -127,10 +120,15 @@
#doc2 {
background-color: #FFFFFF;
+ width: 950px;
+ padding-left: 12px;
+ padding-right: 12px;
+ box-shadow: 0 0 16px 4px #666666;
}
#myexp_header {
- margin: 1em 0.5em 0 0.5em;
+ padding-top: 1em;
+ margin: 0 0.5em 0 0.5em;
}
.logo {
@@ -159,12 +157,19 @@
}
#myexp_searchbar {
+
+ background-image: -moz-linear-gradient(top, #317EFF 0%, #456AAA 100%);
+ background-image: -o-linear-gradient(top, #317EFF 0%, #456AAA 100%);
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #317EFF), color-stop(1, #456AAA));
+ background-image: -webkit-linear-gradient(top, #317EFF 0%, #456AAA 100%);
+ background-image: linear-gradient(to bottom, #317EFF 0%, #456AAA 100%);
+
+ background-color: #456AAA;
+
height: 20px;
text-align: center;
- background-image: url('/images/searchfade.png');
- background-repeat: no-repeat;
- background-position: top center;
padding: 10px 0;
+
-moz-border-radius: 22px 22px 0px 0px;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
@@ -183,10 +188,9 @@
}
#myexp_sidebar {
- padding: 0 0.5em 0 0.5em;
+ padding: 0 6px 0 6px;
background-color: #456AAA;
- border-left: 0px solid #DEDEDE;
- border-width: 0 0 1px 1px;
+ width: 180px;
}
/* Begin Footer styles */
@@ -288,7 +292,7 @@
.framed {
border: 1px solid #CCCCCC;
- padding: 3px;
+ padding: 2px;
background-color: #FFFFFF;
}
@@ -313,14 +317,8 @@
.tabnav li a {
padding: 2px 12px;
margin-left: 3px;
- border-style: solid;
- border-color: #BBB;
- border-width: 1px 1px 0;
text-decoration: none;
- background-image: url('/images/tab-bg.png');
- background-position: top;
- background-repeat: repeat-x;
- background-color: #EDEDED;
+ background-color: #E0E0E0;
display: inline-block;
}
@@ -333,8 +331,14 @@
}
.tabnav li a:hover, .tabnav li#selected_tabnav a {
- background-color: #317eff;
- background-image: none;
+
+ background-image: -moz-linear-gradient(top, #317EFF 0%, #317EFF 100%);
+ background-image: -o-linear-gradient(top, #317EFF 0%, #317EFF 100%);
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #317EFF), color-stop(1, #317EFF));
+ background-image: -webkit-linear-gradient(top, #317EFF 0%, #317EFF 100%);
+ background-image: linear-gradient(to bottom, #317EFF 0%, #317EFF 100%);
+
+ background-color: #456AAA;
color: #FFFFFF;
}
@@ -347,8 +351,7 @@
font-size: 85%;
text-decoration: none;
padding: 0.4em 0.5em;
- background-color: #EEEEEE;
- border: 1px solid #DEDEDE;
+ background-color: #E0E0E0;
}
#myexp_breadcrumbs_bar table {
@@ -377,6 +380,10 @@
color: #000033;
}
+UL.breadcrumb_list LI + LI:before {
+ content: " > ";
+}
+
/* end css breadcrumbs */
/* begin css tooltips/boxovers */
@@ -2107,9 +2114,6 @@
.pivot .filter {
margin-bottom: 1em;
padding: 2px;
- background: #f0f0f0;
- border-radius: 6px;
- -moz-border-radius: 6px;
}
.pivot .category {
@@ -2140,24 +2144,6 @@
background: #ffe0c0;
}
-.pivot .options > DIV.selected:hover {
- background: #dfc0a0;
-}
-
-.pivot .options > DIV:first-child {
- border-top-left-radius: 6px;
- border-top-right-radius: 6px;
- -moz-border-radius-topleft: 6px;
- -moz-border-radius-topright: 6px;
-}
-
-.pivot .options > DIV:last-child {
- border-bottom-left-radius: 6px;
- border-bottom-right-radius: 6px;
- -moz-border-radius-bottomleft: 6px;
- -moz-border-radius-bottomright: 6px;
-}
-
.pivot .checkbox {
display: inline;
padding-top: 0;
@@ -2316,10 +2302,15 @@
}
#user-check-list .sleep TD {
- border: 1px solid #808080;
- background: #c0c0c0;
+ border: 1px solid #c0e0c0;
+ background: #e0ffe0;
}
+#user-check-list .suspect TD {
+ border: 1px solid #e0c0c0;
+ background: #ffe0e0;
+}
+
#user-check-list .delete TD {
border: 1px solid #c08080;
background: #ffc0c0;
@@ -2380,6 +2371,15 @@
font-size: 85%;
}
+.new-session-sign-in {
+ width: 190px;
+ border: 1px solid #CCCCCC;
+ border-radius: 6px 6px 6px 6px;
+ -moz-border-radius: 6px 6px 6px 6px;
+ -webkit-border-bottom-left-radius: 6px;
+ -webkit-border-bottom-right-radius: 6px;
+}
+
#annotation_list TABLE {
border-collapse: collapse;
margin-bottom: 16px;
Modified: branches/wf4ever/test/fixtures/content_types.yml (3142 => 3143)
--- branches/wf4ever/test/fixtures/content_types.yml 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/test/fixtures/content_types.yml 2012-10-08 12:24:24 UTC (rev 3143)
@@ -31,3 +31,13 @@
created_at: 2008-04-22 15:32:01
updated_at: 2008-04-22 15:32:01
+taverna2:
+ id: 4
+ user_id: 1
+ title: Taverna 2
+ description: The Taverna 2 workflow file format.
+ description_html: "<p>The Taverna 2 workflow file format.</p>"
+ mime_type: application/vnd.taverna.t2flow+xml
+ created_at: 2008-04-22 15:32:01
+ updated_at: 2008-04-22 15:32:01
+
Copied: branches/wf4ever/test/fixtures/files/workflow_xkcd.t2flow (from rev 3142, trunk/test/fixtures/files/workflow_xkcd.t2flow) (0 => 3143)
--- branches/wf4ever/test/fixtures/files/workflow_xkcd.t2flow (rev 0)
+++ branches/wf4ever/test/fixtures/files/workflow_xkcd.t2flow 2012-10-08 12:24:24 UTC (rev 3143)
@@ -0,0 +1,332 @@
+<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow" version="1" producedBy="taverna-2.2.0"><dataflow id="8b032490-948e-4983-b632-d16653755fcd" role="top"><name>Fetch_today_s_xkcd_comic</name><inputPorts /><outputPorts><port><name>todaysXkcd</name><annotations /></port></outputPorts><processors><processor><name>getPage</name><inputPorts><port><name>url</name><depth>0</depth></port></inputPorts><outputPorts><port><name>contents</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>localworker-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap><map from="url" to="url" /></inputMap><outputMap><map from="contents" to="contents" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+ <localworkerName>org.embl.ebi.escience.scuflworkers.java.WebPageFetcher</localworkerName>
+ <script>URL inputURL = null;
+if (base != void) {
+ inputURL = new URL(new URL(base), url);
+}
+else {
+ inputURL = new URL(url);
+}
+URLConnection con = inputURL.openConnection();
+InputStream in = con.getInputStream();
+
+InputStreamReader isr = new InputStreamReader(in);
+Reader inReader = new BufferedReader(isr);
+
+StringBuffer buf = new StringBuffer();
+int ch;
+while ((ch = inReader.read()) > -1) {
+ buf.append((char)ch);
+}
+inReader.close();
+contents = buf.toString();
+
+
+//String NEWLINE = System.getProperty("line.separator");
+//
+//URL inputURL = null;
+//if (base != void) {
+// inputURL = new URL(new URL(base), url);
+//} else {
+// inputURL = new URL(url);
+//}
+//StringBuffer result = new StringBuffer();
+//BufferedReader reader = new BufferedReader(new InputStreamReader(inputURL.openStream()));
+//String line = null;
+//while ((line = reader.readLine()) != null) {
+// result.append(line);
+// result.append(NEWLINE);
+//}
+//
+//contents = result.toString();
+</script>
+ <dependencies />
+ <classLoaderSharing>workflow</classLoaderSharing>
+ <localDependencies />
+ <artifactDependencies />
+ <inputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>url</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/x-taverna-web-url'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>base</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/x-taverna-web-url'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </inputs>
+ <outputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <granularDepth>0</granularDepth>
+ <name>contents</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/plain,text/html'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </outputs>
+</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>1000</initialDelay>
+ <maxDelay>5000</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="url" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>xkcdURL</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>stringconstant-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
+ <value>http://xkcd.com/</value>
+</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>1000</initialDelay>
+ <maxDelay>5000</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy /></iteration></iterationStrategyStack></processor><processor><name>getImageLinks</name><inputPorts><port><name>document</name><depth>0</depth></port></inputPorts><outputPorts><port><name>imagelinks</name><depth>1</depth><granularDepth>1</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>localworker-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap><map from="document" to="document" /></inputMap><outputMap><map from="imagelinks" to="imagelinks" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+ <localworkerName>org.embl.ebi.escience.scuflworkers.java.ExtractImageLinks</localworkerName>
+ <script>String lowerCaseContent = document.toLowerCase();
+int index = 0;
+List imagelinks = new ArrayList();
+while ((index = lowerCaseContent.indexOf("<img", index)) != -1) {
+ if ((index = lowerCaseContent.indexOf("src", index)) == -1)
+ break;
+ if ((index = lowerCaseContent.indexOf("=", index)) == -1)
+ break;
+ index++;
+ String remaining = document.substring(index);
+ StringTokenizer st = new StringTokenizer(remaining, "\t\n\r\">#");
+ String strLink = st.nextToken();
+ imagelinks.add(strLink);
+}
+
+</script>
+ <dependencies />
+ <classLoaderSharing>workflow</classLoaderSharing>
+ <localDependencies />
+ <artifactDependencies />
+ <inputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>document</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/html'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </inputs>
+ <outputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <granularDepth>1</granularDepth>
+ <name>imagelinks</name>
+ <depth>1</depth>
+ <mimeTypes>
+ <string>l('text/x-taverna-web-url')</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </outputs>
+</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>1000</initialDelay>
+ <maxDelay>5000</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="document" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>findComicURL</name><inputPorts><port><name>regex</name><depth>0</depth></port><port><name>stringlist</name><depth>1</depth></port></inputPorts><outputPorts><port><name>filteredlist</name><depth>1</depth><granularDepth>1</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>localworker-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap><map from="regex" to="regex" /><map from="stringlist" to="stringlist" /></inputMap><outputMap><map from="filteredlist" to="filteredlist" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+ <localworkerName>org.embl.ebi.escience.scuflworkers.java.FilterStringList</localworkerName>
+ <script>filteredlist = new ArrayList();
+for (Iterator i = stringlist.iterator(); i.hasNext();) {
+ String item = (String) i.next();
+ if (item.matches(regex)) {
+ filteredlist.add(item);
+ }
+}
+</script>
+ <dependencies />
+ <classLoaderSharing>workflow</classLoaderSharing>
+ <localDependencies />
+ <artifactDependencies />
+ <inputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>stringlist</name>
+ <depth>1</depth>
+ <mimeTypes>
+ <string>l('text/plain')</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>regex</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/plain'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </inputs>
+ <outputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <granularDepth>1</granularDepth>
+ <name>filteredlist</name>
+ <depth>1</depth>
+ <mimeTypes>
+ <string>l('text/plain')</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </outputs>
+</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>1000</initialDelay>
+ <maxDelay>5000</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="regex" depth="0" /><port name="stringlist" depth="1" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>comicURLRegex</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>stringconstant-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
+ <value>.*/comics/.*</value>
+</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>1000</initialDelay>
+ <maxDelay>5000</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy /></iteration></iterationStrategyStack></processor><processor><name>getComicStrip</name><inputPorts><port><name>base</name><depth>0</depth></port><port><name>url</name><depth>0</depth></port></inputPorts><outputPorts><port><name>image</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>localworker-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap><map from="base" to="base" /><map from="url" to="url" /></inputMap><outputMap><map from="image" to="image" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+ <localworkerName>org.embl.ebi.escience.scuflworkers.java.WebImageFetcher</localworkerName>
+ <script>URL inputURL = null;
+if (base != void) {
+ inputURL = new URL(new URL(base), url);
+} else {
+ inputURL = new URL(url);
+}
+
+byte[] contents;
+if (inputURL.openConnection().getContentLength() == -1) {
+ // Content size unknown, must read first...
+ byte[] buffer = new byte[1024];
+ int bytesRead = 0;
+ int totalBytesRead = 0;
+ InputStream is = inputURL.openStream();
+ while (bytesRead != -1) {
+ totalBytesRead += bytesRead;
+ bytesRead = is.read(buffer, 0, 1024);
+ }
+ contents = new byte[totalBytesRead];
+} else {
+ contents = new byte[inputURL.openConnection().getContentLength()];
+}
+int bytesRead = 0;
+int totalBytesRead = 0;
+InputStream is = inputURL.openStream();
+while (bytesRead != -1) {
+ bytesRead = is.read(contents, totalBytesRead, contents.length - totalBytesRead);
+ totalBytesRead += bytesRead;
+ if (contents.length==totalBytesRead) break;
+}
+
+image = contents;
+</script>
+ <dependencies />
+ <classLoaderSharing>workflow</classLoaderSharing>
+ <localDependencies />
+ <artifactDependencies />
+ <inputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>url</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/x-taverna-web-url'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>base</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/x-taverna-web-url'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </inputs>
+ <outputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <granularDepth>0</granularDepth>
+ <name>image</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'image/*'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </outputs>
+</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+ <maxJobs>1</maxJobs>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>1000</initialDelay>
+ <maxDelay>5000</maxDelay>
+ <maxRetries>0</maxRetries>
+</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="base" depth="0" /><port name="url" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>getPage</processor><port>url</port></sink><source type="processor"><processor>xkcdURL</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>getImageLinks</processor><port>document</port></sink><source type="processor"><processor>getPage</processor><port>contents</port></source></datalink><datalink><sink type="processor"><processor>findComicURL</processor><port>regex</port></sink><source type="processor"><processor>comicURLRegex</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>findComicURL</processor><port>stringlist</port></sink><source type="processor"><processor>getImageLinks</processor><port>imagelinks</port></source></datalink><datalink><sink type="processor"><processor>getComicStrip</processor><port>base</port></sink><source type="processor"><processor>xkcdURL</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>getComicStrip</processor><port>url</port></sink><source type="processor"><processor>findComicURL</processor><port>filteredlist</port></source></datalink><datalink><sink type="dataflow"><port>todaysXkcd</port></sink><source type="processor"><processor>getComicStrip</processor><port>image</port></source></datalink></datalinks><annotations><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+ <annotationAssertions>
+ <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.DescriptiveTitle">
+ <text>Fetch today's xkcd comic</text>
+ </annotationBean>
+ <date>2009-12-15 20:39:06.623 GMT</date>
+ <creators />
+ <curationEventList />
+ </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+ <annotationAssertions>
+ <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.Author">
+ <text>Tom Oinn, Stian Soiland-Reyes</text>
+ </annotationBean>
+ <date>2009-12-15 20:38:58.43 GMT</date>
+ <creators />
+ <curationEventList />
+ </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+ <annotationAssertions>
+ <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.FreeTextDescription">
+ <text>Use the local java plugins and some filtering operations to fetch the comic strip image from http://xkcd.com/
+
+Based on the FetchDailyDilbert workflow.</text>
+ </annotationBean>
+ <date>2009-12-15 20:39:17.683 GMT</date>
+ <creators />
+ <curationEventList />
+ </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+ <annotationAssertions>
+ <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <identification>8b032490-948e-4983-b632-d16653755fcd</identification>
+ </annotationBean>
+ <date>2010-07-04 18:16:02.491 BST</date>
+ <creators />
+ <curationEventList />
+ </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotationAssertions>
+</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2></annotations></dataflow></workflow>
\ No newline at end of file
Modified: branches/wf4ever/test/functional/api_controller_test.rb (3142 => 3143)
--- branches/wf4ever/test/functional/api_controller_test.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/test/functional/api_controller_test.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -45,7 +45,7 @@
extra_workflows = Workflow.find(:all) - existing_workflows
- assert_equal(extra_workflows.length, 1)
+ assert_equal(1, extra_workflows.length)
@workflow_id = extra_workflows.first.id
@@ -94,6 +94,67 @@
assert_equal(title2, response.find_first('/workflow/title').inner_xml)
assert_equal(description, response.find_first('/workflow/description').inner_xml)
+ # upload a new version of the workflow
+
+ content2 = Base64.encode64(File.read('test/fixtures/files/workflow_xkcd.t2flow'))
+
+ # post a new version of the workflow
+
+ rest_request(:post, 'workflow', "<?xml version='1.0'?>
+ <workflow>
+ <type>Taverna 2</type>
+ <content>#{content2}</content>
+ </workflow>", "id" => @workflow_id)
+
+ assert_response(:success)
+
+ workflow = Workflow.find(@workflow_id)
+
+ assert_equal(2, workflow.versions.length)
+
+ # get different versions of the workflow
+
+ response = rest_request(:get, 'workflow', nil, "id" => @workflow_id, "version" => "1",
+ "elements" => "title,type,content-type,content,components")
+
+ assert_response(:success)
+
+ assert_equal(title2, response.find_first('/workflow/title').inner_xml)
+ assert_equal("Taverna 1", response.find_first('/workflow/type').inner_xml)
+ assert_equal("application/vnd.taverna.scufl+xml", response.find_first('/workflow/content-type').inner_xml)
+ assert_equal(1815, Base64.decode64(response.find_first('/workflow/content').inner_xml).length)
+
+ response = rest_request(:get, 'workflow', nil, "id" => @workflow_id, "version" => "2",
+ "elements" => "title,type,content-type,content,components")
+
+ assert_equal("Fetch today's xkcd comic", response.find_first('/workflow/title').inner_xml)
+ assert_equal("Taverna 2", response.find_first('/workflow/type').inner_xml)
+ assert_equal("application/vnd.taverna.t2flow+xml", response.find_first('/workflow/content-type').inner_xml)
+ assert_equal(30218, Base64.decode64(response.find_first('/workflow/content').inner_xml).length)
+
+ # edit a particular version of a workflow
+
+ rest_request(:put, 'workflow', "<?xml version='1.0'?>
+ <workflow>
+ <title>Oranges</title>
+ </workflow>", "id" => @workflow_id, "version" => "1")
+
+ assert_response(:success)
+
+ # Verify that only version 1 was changed
+
+ response = rest_request(:get, 'workflow', nil, "id" => @workflow_id, "version" => "1",
+ "elements" => "title")
+
+ assert_response(:success)
+
+ assert_equal("Oranges", response.find_first('/workflow/title').inner_xml)
+
+ response = rest_request(:get, 'workflow', nil, "id" => @workflow_id, "version" => "2",
+ "elements" => "title")
+
+ assert_equal("Fetch today's xkcd comic", response.find_first('/workflow/title').inner_xml)
+
# delete the workflow
rest_request(:delete, 'workflow', nil, "id" => @workflow_id)
@@ -590,7 +651,7 @@
assert_equal(rating.rateable, workflow);
assert_equal(rating.rating, 4);
- # update the rating (which should fail)
+ # update the rating
rest_request(:put, 'rating', "<?xml version='1.0'?>
<rating>
@@ -601,7 +662,7 @@
rating.reload
- assert_equal(rating.rating, 3);
+ assert_equal(3, rating.rating);
# delete the rating
Modified: branches/wf4ever/test/functional/authorization_test.rb (3142 => 3143)
--- branches/wf4ever/test/functional/authorization_test.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/test/functional/authorization_test.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -13,156 +13,119 @@
assert true
end
- def test_is_owner
- assert Authorization.is_owner?(users(:john).id, workflows(:workflow_dilbert).contribution)
- end
-
- def test_is_not_owner
- assert !Authorization.is_owner?(users(:jane).id, workflows(:workflow_dilbert).contribution)
- end
-
- def test_is_friend
- assert Authorization.is_friend?(users(:john).id, users(:jane).id)
- end
-
- def test_is_not_friend
- assert !Authorization.is_friend?(users(:john).id, users(:admin).id)
- end
-
- def test_is_member_of_group
- assert Authorization.is_network_member?(users(:john).id, networks(:another_network).id)
- assert Authorization.is_network_member?(users(:jane).id, networks(:dilbert_appreciation_network).id)
- end
-
- def test_is_not_member_of_group
- assert !Authorization.is_network_member?(users(:admin).id, networks(:dilbert_appreciation_network).id)
- end
-
def test_is_owner_authorized_to_view
- # "thing" referenced by ID and Type; only user_id, not instance supplied
- assert Authorization.is_authorized?("view", "Blob", blobs(:for_true_policy).id, users(:john).id)
-
- # "thing" referenced by ID and Type; user instance supplied
- assert Authorization.is_authorized?("view", "Blob", blobs(:for_false_policy).id, users(:john))
-
- # "thing" supplied as instance; user instance supplied
- assert Authorization.is_authorized?("view", nil, blobs(:for_protected_policy), users(:john))
-
- # "thing" supplied as instance; only user_id, not instance supplied
- assert Authorization.is_authorized?("view", nil, blobs(:for_public_policy), users(:john).id)
+ assert Authorization.check("view", blobs(:for_true_policy), users(:john))
+ assert Authorization.check("view", blobs(:for_false_policy), users(:john))
+ assert Authorization.check("view", blobs(:for_protected_policy), users(:john))
+ assert Authorization.check("view", blobs(:for_public_policy), users(:john))
end
def test_is_owner_authorized_to_edit
- assert Authorization.is_authorized?("edit", nil, blobs(:for_true_policy), users(:john))
- assert Authorization.is_authorized?("edit", nil, blobs(:for_false_policy), users(:john))
- assert Authorization.is_authorized?("edit", nil, blobs(:for_protected_policy), users(:john))
- assert Authorization.is_authorized?("edit", nil, blobs(:for_public_policy), users(:john))
+ assert Authorization.check("edit", blobs(:for_true_policy), users(:john))
+ assert Authorization.check("edit", blobs(:for_false_policy), users(:john))
+ assert Authorization.check("edit", blobs(:for_protected_policy), users(:john))
+ assert Authorization.check("edit", blobs(:for_public_policy), users(:john))
end
def test_is_owner_authorized_to_download
- assert Authorization.is_authorized?("download", nil, blobs(:for_true_policy), users(:john))
- assert Authorization.is_authorized?("download", nil, blobs(:for_false_policy), users(:john))
- assert Authorization.is_authorized?("download", nil, blobs(:for_protected_policy), users(:john))
- assert Authorization.is_authorized?("download", nil, blobs(:for_public_policy), users(:john))
+ assert Authorization.check("download", blobs(:for_true_policy), users(:john))
+ assert Authorization.check("download", blobs(:for_false_policy), users(:john))
+ assert Authorization.check("download", blobs(:for_protected_policy), users(:john))
+ assert Authorization.check("download", blobs(:for_public_policy), users(:john))
end
def test_is_anonymous_authorized_to_view
- # "anonymous" indicated as a default parameter (not even supplied)
- assert Authorization.is_authorized?("view", nil, blobs(:for_true_policy))
- assert !Authorization.is_authorized?("view", nil, blobs(:for_false_policy))
- assert !Authorization.is_authorized?("view", nil, blobs(:for_protected_policy))
- assert Authorization.is_authorized?("view", nil, blobs(:for_public_policy))
- # "anonymous" indicated as NIL
- assert Authorization.is_authorized?("view", nil, blobs(:for_true_policy), nil)
- assert !Authorization.is_authorized?("view", nil, blobs(:for_false_policy), nil)
- assert !Authorization.is_authorized?("view", nil, blobs(:for_protected_policy), nil)
- assert Authorization.is_authorized?("view", nil, blobs(:for_public_policy), nil)
+ # "anonymous" indicated as nil
+ assert Authorization.check("view", blobs(:for_true_policy), nil)
+ assert !Authorization.check("view", blobs(:for_false_policy), nil)
+ assert !Authorization.check("view", blobs(:for_protected_policy), nil)
+ assert Authorization.check("view", blobs(:for_public_policy), nil)
# "anonymous" indicated as "0" - the same way as AuthenticadSystem module will
# do for not logged in users
- assert Authorization.is_authorized?("view", nil, blobs(:for_true_policy), 0)
- assert !Authorization.is_authorized?("view", nil, blobs(:for_false_policy), 0)
- assert !Authorization.is_authorized?("view", nil, blobs(:for_protected_policy), 0)
- assert Authorization.is_authorized?("view", nil, blobs(:for_public_policy), 0)
+ assert Authorization.check("view", blobs(:for_true_policy), 0)
+ assert !Authorization.check("view", blobs(:for_false_policy), 0)
+ assert !Authorization.check("view", blobs(:for_protected_policy), 0)
+ assert Authorization.check("view", blobs(:for_public_policy), 0)
end
def test_is_anonymous_authorized_to_edit
- assert Authorization.is_authorized?("edit", nil, blobs(:for_true_policy), 0)
- assert !Authorization.is_authorized?("edit", nil, blobs(:for_false_policy), 0)
- assert !Authorization.is_authorized?("edit", nil, blobs(:for_protected_policy), 0)
- assert Authorization.is_authorized?("edit", nil, blobs(:for_public_policy), 0)
+ assert Authorization.check("edit", blobs(:for_true_policy), 0)
+ assert !Authorization.check("edit", blobs(:for_false_policy), 0)
+ assert !Authorization.check("edit", blobs(:for_protected_policy), 0)
+ assert Authorization.check("edit", blobs(:for_public_policy), 0)
end
def test_is_anonymous_authorized_to_download
- assert Authorization.is_authorized?("download", nil, blobs(:for_true_policy), nil)
- assert !Authorization.is_authorized?("download", nil, blobs(:for_false_policy), nil)
- assert !Authorization.is_authorized?("download", nil, blobs(:for_protected_policy), nil)
- assert Authorization.is_authorized?("download", nil, blobs(:for_public_policy), nil)
+ assert Authorization.check("download", blobs(:for_true_policy), nil)
+ assert !Authorization.check("download", blobs(:for_false_policy), nil)
+ assert !Authorization.check("download", blobs(:for_protected_policy), nil)
+ assert Authorization.check("download", blobs(:for_public_policy), nil)
end
def test_is_friend_authorized_to_view
- assert Authorization.is_authorized?("view", nil, blobs(:for_true_policy), users(:johns_friend))
- assert !Authorization.is_authorized?("view", nil, blobs(:for_false_policy), users(:johns_friend))
- assert Authorization.is_authorized?("view", nil, blobs(:for_protected_policy), users(:johns_friend))
- assert Authorization.is_authorized?("view", nil, blobs(:for_public_policy), users(:johns_friend))
+ assert Authorization.check("view", blobs(:for_true_policy), users(:johns_friend))
+ assert !Authorization.check("view", blobs(:for_false_policy), users(:johns_friend))
+ assert Authorization.check("view", blobs(:for_protected_policy), users(:johns_friend))
+ assert Authorization.check("view", blobs(:for_public_policy), users(:johns_friend))
end
def test_is_friend_authorized_to_edit
- assert Authorization.is_authorized?("edit", nil, blobs(:for_true_policy), users(:johns_friend))
- assert !Authorization.is_authorized?("edit", nil, blobs(:for_false_policy), users(:johns_friend))
- assert Authorization.is_authorized?("edit", nil, blobs(:for_protected_policy), users(:johns_friend))
- assert Authorization.is_authorized?("edit", nil, blobs(:for_public_policy), users(:johns_friend))
+ assert Authorization.check("edit", blobs(:for_true_policy), users(:johns_friend))
+ assert !Authorization.check("edit", blobs(:for_false_policy), users(:johns_friend))
+ assert Authorization.check("edit", blobs(:for_protected_policy), users(:johns_friend))
+ assert Authorization.check("edit", blobs(:for_public_policy), users(:johns_friend))
end
def test_is_friend_authorized_to_download
- assert Authorization.is_authorized?("download", nil, blobs(:for_true_policy), users(:johns_friend))
- assert !Authorization.is_authorized?("download", nil, blobs(:for_false_policy), users(:johns_friend))
- assert Authorization.is_authorized?("download", nil, blobs(:for_protected_policy), users(:johns_friend))
- assert Authorization.is_authorized?("download", nil, blobs(:for_public_policy), users(:johns_friend))
+ assert Authorization.check("download", blobs(:for_true_policy), users(:johns_friend))
+ assert !Authorization.check("download", blobs(:for_false_policy), users(:johns_friend))
+ assert Authorization.check("download", blobs(:for_protected_policy), users(:johns_friend))
+ assert Authorization.check("download", blobs(:for_public_policy), users(:johns_friend))
end
def test_is_group_authorized_to_view
- assert Authorization.is_authorized?("view", nil, blobs(:for_true_policy), users(:spare_user))
- assert !Authorization.is_authorized?("view", nil, blobs(:for_false_policy), users(:spare_user))
- assert !Authorization.is_authorized?("view", nil, blobs(:for_protected_policy), users(:spare_user))
- assert Authorization.is_authorized?("view", nil, blobs(:for_public_policy), users(:spare_user))
+ assert Authorization.check("view", blobs(:for_true_policy), users(:spare_user))
+ assert !Authorization.check("view", blobs(:for_false_policy), users(:spare_user))
+ assert !Authorization.check("view", blobs(:for_protected_policy), users(:spare_user))
+ assert Authorization.check("view", blobs(:for_public_policy), users(:spare_user))
end
def test_is_group_authorized_to_edit
- assert Authorization.is_authorized?("edit", nil, blobs(:for_true_policy), users(:spare_user))
- assert !Authorization.is_authorized?("edit", nil, blobs(:for_false_policy), users(:spare_user))
- assert !Authorization.is_authorized?("edit", nil, blobs(:for_protected_policy), users(:spare_user))
- assert Authorization.is_authorized?("edit", nil, blobs(:for_public_policy), users(:spare_user))
+ assert Authorization.check("edit", blobs(:for_true_policy), users(:spare_user))
+ assert !Authorization.check("edit", blobs(:for_false_policy), users(:spare_user))
+ assert !Authorization.check("edit", blobs(:for_protected_policy), users(:spare_user))
+ assert Authorization.check("edit", blobs(:for_public_policy), users(:spare_user))
end
def test_is_group_authorized_to_download
- assert Authorization.is_authorized?("download", nil, blobs(:for_true_policy), users(:spare_user))
- assert !Authorization.is_authorized?("download", nil, blobs(:for_false_policy), users(:spare_user))
- assert !Authorization.is_authorized?("download", nil, blobs(:for_protected_policy), users(:spare_user))
- assert Authorization.is_authorized?("download", nil, blobs(:for_public_policy), users(:spare_user))
+ assert Authorization.check("download", blobs(:for_true_policy), users(:spare_user))
+ assert !Authorization.check("download", blobs(:for_false_policy), users(:spare_user))
+ assert !Authorization.check("download", blobs(:for_protected_policy), users(:spare_user))
+ assert Authorization.check("download", blobs(:for_public_policy), users(:spare_user))
end
def test_user_permissions
- assert Authorization.is_authorized?("view", nil, blobs(:for_false_policy), users(:admin))
- assert !Authorization.is_authorized?("edit", nil, blobs(:for_false_policy), users(:admin))
- assert Authorization.is_authorized?("download", nil, blobs(:for_false_policy), users(:admin))
+ assert Authorization.check("view", blobs(:for_false_policy), users(:admin))
+ assert !Authorization.check("edit", blobs(:for_false_policy), users(:admin))
+ assert Authorization.check("download", blobs(:for_false_policy), users(:admin))
end
def test_group_permissions
- assert Authorization.is_authorized?("view", nil, blobs(:for_false_policy), users(:jane))
- assert Authorization.is_authorized?("edit", nil, blobs(:for_false_policy), users(:jane))
+ assert Authorization.check("view", blobs(:for_false_policy), users(:jane))
+ assert Authorization.check("edit", blobs(:for_false_policy), users(:jane))
# in the fixture "view"/"edit" flags are set to TRUE, but "download" is set to FALSE;
# cascading permissions should provide permission to download in this case
- assert Authorization.is_authorized?("download", nil, blobs(:for_false_policy), users(:jane))
+ assert Authorization.check("download", blobs(:for_false_policy), users(:jane))
end
def test_is_authorized_to_destroy
- assert Authorization.is_authorized?("destroy", nil, blobs(:for_true_policy), users(:john))
- assert !Authorization.is_authorized?("destroy", nil, blobs(:for_true_policy), users(:jane))
- assert !Authorization.is_authorized?("destroy", nil, blobs(:for_true_policy), users(:admin))
- assert !Authorization.is_authorized?("destroy", nil, blobs(:for_true_policy), users(:johns_friend))
- assert !Authorization.is_authorized?("destroy", nil, blobs(:for_true_policy), users(:spare_user))
+ assert Authorization.check("destroy", blobs(:for_true_policy), users(:john))
+ assert !Authorization.check("destroy", blobs(:for_true_policy), users(:jane))
+ assert !Authorization.check("destroy", blobs(:for_true_policy), users(:admin))
+ assert !Authorization.check("destroy", blobs(:for_true_policy), users(:johns_friend))
+ assert !Authorization.check("destroy", blobs(:for_true_policy), users(:spare_user))
end
end
Modified: branches/wf4ever/vendor/plugins/acts_as_taggable_redux/lib/tag.rb (3142 => 3143)
--- branches/wf4ever/vendor/plugins/acts_as_taggable_redux/lib/tag.rb 2012-10-08 12:08:14 UTC (rev 3142)
+++ branches/wf4ever/vendor/plugins/acts_as_taggable_redux/lib/tag.rb 2012-10-08 12:24:24 UTC (rev 3143)
@@ -44,7 +44,7 @@
def tagged_auth(user)
tagged.select do |taggable|
- Authorization.is_authorized?('view', nil, taggable, user)
+ Authorization.check('view', taggable, user)
end
end