Commit 786c04e0 authored by Rafael Monnerat's avatar Rafael Monnerat

erp5_certificate_authority: Prefer use Mixin them extend the class

This is simpler to manage and include extra methods
parent cd88a38a
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2023 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from AccessControl import ClassSecurityInfo, Unauthorized, getSecurityManager
from erp5.component.document.erp5_version.Person import Person as ERP5Person
from Products.ERP5Type import Permissions
class Person(ERP5Person):
class PersonCertificateLoginMixin:
security = ClassSecurityInfo()
def checkCertificateRequest(self):
......@@ -32,17 +59,3 @@ class Person(ERP5Person):
This API was kept for backward compatibility"""
self.checkCertificateRequest()
return self._generateCertificate()
\ No newline at end of file
security.declareProtected(Permissions.AccessContentsInformation,
'getTitle')
def getTitle(self, **kw):
"""
Returns the title if it exists or a combination of
first name and last name
"""
title = ERP5Person.getTitle(self, **kw)
test_title = title.replace(' ', '')
if test_title == '':
return self.getDefaultEmailCoordinateText(test_title)
else:
return title
......@@ -2,27 +2,29 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
<global name="Mixin Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Person</string> </value>
<value> <string>PersonCertificateLoginMixin</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<key> <string>default_source_reference</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5_certificate_authority.Person</string> </value>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document Component</string> </value>
<key> <string>id</string> </key>
<value> <string>mixin.erp5.PersonCertificateLoginMixin</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
......@@ -44,7 +46,7 @@
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5_certificate_authority</string> </value>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
......
......@@ -2,4 +2,7 @@
<portal_type id="Certificate Login">
<item>CertificateLoginMixin</item>
</portal_type>
<portal_type id="Person">
<item>PersonCertificateLoginMixin</item>
</portal_type>
</type_mixin>
\ No newline at end of file
document.erp5.CaucaseConnector
\ No newline at end of file
document.erp5_certificate_authority.Person
\ No newline at end of file
mixin.erp5.CertificateLoginMixin
mixin.erp5.PersonCertificateLoginMixin
\ No newline at end of file
Certificate Login | CertificateLoginMixin
Person | PersonCertificateLoginMixin
\ No newline at end of file
tool.erp5.CertificateAuthorityTool
\ 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