Add an option to require the CTs to be agreed to edit

This commit is contained in:
Tom Hughes 2011-06-14 21:16:21 +01:00
parent 83ecb516a4
commit 540e56a9cc
2 changed files with 8 additions and 1 deletions

View file

@ -50,7 +50,7 @@ class ApplicationController < ActionController::Base
# method, otherwise an OAuth token was used, which has to be checked.
unless current_token.nil?
unless current_token.read_attribute(cap)
render :text => "OAuth token doesn't have that capability.", :status => :forbidden
report_error "OAuth token doesn't have that capability.", :forbidden
return false
end
end
@ -84,6 +84,11 @@ class ApplicationController < ActionController::Base
end
def require_allow_write_api
require_capability(:allow_write_api)
if REQUIRE_TERMS_AGREED and @user.terms_agreed.nil?
report_error "You must accept the contributor terms before you can edit.", :forbidden
return false
end
end
def require_allow_read_gpx
require_capability(:allow_read_gpx)

View file

@ -69,6 +69,8 @@ standard_settings: &standard_settings
#potlatch2_key: ""
# Whether to require users to view the CTs before continuing to edit...
require_terms_seen: false
# Whether to require users to agree to the CTs before editing
require_terms_agreed: false
development:
<<: *standard_settings