summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
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