aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 00cfc4b..109e951 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -132,6 +132,23 @@ protected
Participant.touch_ttl(@participant) if @participant.anonymous
end
+ def block_anonymous_participants
+ if @participant.anonymous
+ raise Ecs::AuthenticationException, "Anonymous participants not allowed."
+ end
+ end
+
+ def block_subparticipants
+ if @participant.subparticipant
+ raise Ecs::AuthenticationException, "Subparticipants not allowed."
+ end
+ end
+
+ def check_json_contenttype
+ unless Mime::Type.lookup(request.headers["CONTENT_TYPE"]) =~ "application/json"
+ raise Ecs::InvalidMimetypeException, "Please provide \"Content-Type: application/json\" header for json data."
+ end unless request.raw_post.empty?
+ end
# error pages