summaryrefslogtreecommitdiff
path: root/certs/app/controllers
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-02-25 13:15:50 +0100
committerAzul <azul@leap.se>2013-02-25 13:15:50 +0100
commit494ebdab860a4db792e1c61836f1efcb7593dfe7 (patch)
tree21a7300c8332944c3a76510a4080c8dcfd6cc3b2 /certs/app/controllers
parentd99bcf4b0d0b8716ab0da58ea7320fb33bac78bb (diff)
added configuration setting for disabling free certs
Diffstat (limited to 'certs/app/controllers')
-rw-r--r--certs/app/controllers/certs_controller.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/certs/app/controllers/certs_controller.rb b/certs/app/controllers/certs_controller.rb
index 3b7d35d..977e03e 100644
--- a/certs/app/controllers/certs_controller.rb
+++ b/certs/app/controllers/certs_controller.rb
@@ -1,9 +1,16 @@
class CertsController < ApplicationController
+ before_filter :logged_in_or_free_certs
+
# GET /cert
def show
@cert = ClientCertificate.new(free: !logged_in?)
render text: @cert.to_s, content_type: 'text/plain'
end
+ protected
+
+ def logged_in_or_free_certs
+ authorize unless APP_CONFIG[:free_certs_enabled]
+ end
end