blob: fa53b2612d9119ad3d8638e952dc73ee11d62c8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
class V1::SmtpCertsController < ApiController
before_filter :require_login
before_filter :require_email_account
before_filter :fetch_identity
# POST /1/smtp_cert
def create
@cert = ClientCertificate.new prefix: current_user.email_address
@identity.register_cert(@cert)
@identity.save
render text: @cert.to_s, content_type: 'text/plain'
end
protected
#
# Filters
#
def require_email_account
access_denied unless service_level.provides? 'email'
end
def fetch_identity
@identity = current_user.identity
end
#
# Helper methods
#
def service_level
current_user.effective_service_level
end
end
|