Commit de5cff7c authored by Łukasz Nowak's avatar Łukasz Nowak

Introduce own Person document class.

It allows to get/revoke certificates for Person. Protected in same way as setting Person's password.
parent 4733e8cd
from AccessControl import ClassSecurityInfo
from Products.ERP5.Document.Person import Person as ERP5Person
class Person(ERP5Person):
security = ClassSecurityInfo()
security.declarePublic('getCertificate')
def _checkReference(self):
if not self.getReference():
raise ValueError('No reference set.')
def _getCertificate(self):
return self.getPortalObject().portal_certificate_authority\
.getNewCertificate(self.getReference())
def _revokeCertificate(self):
return self.getPortalObject().portal_certificate_authority\
.revokeCertificateByCommonName(self.getReference())
def getCertificate(self):
"""Returns new SSL certificate"""
self._checkReference()
self.checkUserCanChangePassword()
return self._getCertificate()
security.declarePublic('revokeCertificate')
def revokeCertificate(self):
"""Revokes existing certificate"""
self._checkReference()
self.checkUserCanChangePassword()
self._revokeCertificate()
239
\ No newline at end of file
240
\ No newline at end of file
SoftwareInstance
Person
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment