Diff
Modified: trunk/app/controllers/api_controller.rb (2289 => 2290)
--- trunk/app/controllers/api_controller.rb 2009-10-27 13:36:34 UTC (rev 2289)
+++ trunk/app/controllers/api_controller.rb 2009-10-27 15:54:27 UTC (rev 2290)
@@ -41,6 +41,22 @@
rules = TABLES['REST'][:data][uri][method]
+ # validate id and version query options
+
+ case rules['Allow id']
+ when 'required'
+ return rest_response(400, :reason => "Must specify an id") if query['id'].nil?
+ when 'no'
+ return rest_response(400, :reason => "Cannot specify an id") if query['id']
+ end
+
+ case rules['Allow version']
+ when 'required'
+ return rest_response(400, :reason => "Must specify a version") if query['version'].nil?
+ when 'no'
+ return rest_response(400, :reason => "Cannot specify a version") if query['version']
+ end
+
# key check - if an oauth access token is in use, this means that we must
# only allow requests where explicit permission has been given
Modified: trunk/config/environment.rb (2289 => 2290)
--- trunk/config/environment.rb 2009-10-27 13:36:34 UTC (rev 2289)
+++ trunk/config/environment.rb 2009-10-27 15:54:27 UTC (rev 2290)
@@ -19,7 +19,7 @@
# Only load the plugins named here, by default all plugins in vendor/plugins are loaded
# config.plugins = %W( exception_notification ssl_requirement )
- config.plugins = ["engines", "encrypted_strings", "widgets", "*"]
+ config.plugins = ["engines", "encrypted_strings", "widgets", "white_list", "*"]
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )
Modified: trunk/config/tables.xml
(Binary files differ)
Modified: trunk/lib/rest.rb (2289 => 2290)
--- trunk/lib/rest.rb 2009-10-27 13:36:34 UTC (rev 2289)
+++ trunk/lib/rest.rb 2009-10-27 15:54:27 UTC (rev 2290)
@@ -843,7 +843,11 @@
case action
when 'create':
return rest_response(401) unless Authorization.is_authorized_for_type?('create', 'Workflow', user, nil)
- ob = Workflow.new(:contributor => user)
+ if query['id']
+ ob = obtain_rest_resource('Workflow', query['id'], query['version'], user, action)
+ else
+ ob = Workflow.new(:contributor => user)
+ end
when 'read', 'update', 'destroy':
ob = obtain_rest_resource('Workflow', query['id'], query['version'], user, action)
else