+class MemberAdapter(BaseMemberAdapter, SimpleItem, DynamicType, CMFCatalogAware):
+
+ """Member data adapter.
+ """
+
+ adapts(IUser, IMemberDataTool)
+ implements(IMember)
+
+ portal_type = 'Member Data'
+
+ security = ClassSecurityInfo()
+
+ def __init__(self, user, tool):
+ super(MemberAdapter, self).__init__(user, tool)
+ self.id = self.getId()
+
+ security.declarePublic('getMemberFullName')
+ def getMemberFullName(self, nameBefore=1) :
+ """ Return the best full name representation """
+ memberName = self.getProperty('name', default='')
+ memberGivenName = self.getProperty('given_name', default='')
+ memberId = self.getId()
+ return formatFullName(memberName, memberGivenName, memberId, nameBefore=nameBefore)
+
+ def getMemberSortableFormat(self) :
+ """ Return a specific format of full name for alphabetical sorting """
+ return self.getMemberFullName(nameBefore = 1).lower()
+
+ # security overload
+ security.declareProtected(SetMemberProperties, 'setMemberProperties')
+ def setMemberProperties(self, mapping):
+ super(MemberAdapter, self).setMemberProperties(mapping)
+ self.reindexObject()
+
+
+InitializeClass(MemberAdapter)
+
+