[EMAIL PROTECTED] wrote:
Thanks for your help, but I still seem to be doing something wrong. The product is listed on the additional products screen, but when i select it to install it, it does nothing. It doesn't install, apparently, because when I look up the transverse in the author info, it returns {'username': 'admin', 'description': '', 'language': '', 'home_page': '', 'location': '', 'fullname': ''}, without
any additional fields.

For instance, in this particular case, I'm trying to get aditional information
obtained by SQLPASPlugin, which I map via the col_mapping option in this
plugin. For what I understood, this should be enough to allow access to if from another part of the site (in fact, I can do just that using getmemberproperties, only I want to do it by extending the MembershipTool and registering fields as
"harmless"), without special permissions.

I've stripped down the producto to a minimum and I basically have:

What you show here is your customization of the member info returned
but did you also add your custom properties in the member *data* tool?
(can be done in ZMI or via GS)

Raphael



------------------------------- MembershipTool.py--------------------------
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from DateTime import DateTime
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.MembershipTool import MembershipTool as BaseTool


class MembershipTool(BaseTool):

   meta_type = "ERS Membership Tool"
   title="ERS custom membership tool"

   security = ClassSecurityInfo()
   plone_tool = 1


   security.declarePublic('getMemberInfo')
   def getMemberInfo(self, memberId=None):
       """
       Return 'harmless' Memberinfo of any member, such as Full name,
       Location, etc
       """
       if not memberId:
           member = self.getAuthenticatedMember()
       else:
           member = self.getMemberById(memberId)

       if member is None:
           return None

       memberinfo = { 'fullname'    : member.getProperty('fullname'),
                      'description' : member.getProperty('description'),
                      'location'    : member.getProperty('location'),
                      'language'    : member.getProperty('language'),
                      'home_page'   : member.getProperty('home_page'),
                      'applicationname'   :
member.getProperty('applicationname'),
                      'username'    : member.getUserName(),
                    }

       return memberinfo

MembershipTool.__doc__ = BaseTool.__doc__

InitializeClass(MembershipTool)


------------------------------- config.py--------------------------
from Products.CMFCore.permissions import AddPortalContent

ADD_CONTENT_PERMISSION = AddPortalContent
PROJECTNAME = "ERSExtendMemberInfo"
SKINS_DIR = 'skins'

GLOBALS = globals()


------------------------------- __init__.py--------------------------

from Products.CMFCore import utils
from Products.CMFCore.DirectoryView import registerDirectory
from Products.Archetypes.public import process_types, listTypes

from config import SKINS_DIR, GLOBALS, PROJECTNAME

import MembershipTool

registerDirectory(SKINS_DIR, GLOBALS)


tools = (MembershipTool.MembershipTool,)


def initialize(context):
   content_types, constructors, ftis = process_types(
       listTypes(PROJECTNAME),
       PROJECTNAME)

   utils.ToolInit(PROJECTNAME + ' Tool',
                  tools=tools,
                  product_name=PROJECTNAME,
                  icon="tool.gif",
                  ).initialize(context)


Thanks for your help, btw ;D

----------------------------------------------------------------
Departamento de Ciencia de Computadores
Faculdade de Ciencias da Universidade do Porto
http://www.dcc.fc.up.pt/





_______________________________________________
Setup mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/setup

Reply via email to