summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-15 11:17:47 +0200
committerAzul <azul@leap.se>2014-05-19 14:24:47 +0200
commit71dcf3f4e5d423b78b47f675297fc98b28ef3442 (patch)
tree7415f1f5825abf2d21b2232ccd1ff820f1f513d2 /app/controllers
parent5dd6c1529f8f4fc5089c71b0a44e360acaea900d (diff)
SmtpCertsController, routes and tests
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/v1/smtp_certs_controller.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/controllers/v1/smtp_certs_controller.rb b/app/controllers/v1/smtp_certs_controller.rb
new file mode 100644
index 0000000..001425d
--- /dev/null
+++ b/app/controllers/v1/smtp_certs_controller.rb
@@ -0,0 +1,21 @@
+class V1::SmtpCertsController < ApplicationController
+
+ before_filter :require_login
+ before_filter :require_email_account
+
+ # GET /cert
+ def show
+ @cert = ClientCertificate.new prefix: current_user.email_address
+ render text: @cert.to_s, content_type: 'text/plain'
+ end
+
+ protected
+
+ def require_email_account
+ access_denied unless service_level.provides? 'email'
+ end
+
+ def service_level
+ current_user.effective_service_level
+ end
+end