[Product-Developers] [PAS] auth'ed against relational db, but...

Kevin J kevin.jingqiu at caseware.com
Thu Jul 24 13:12:26 UTC 2008


Could you provide more details on how I provide user data from external
database to Plone?  'cause on line 8 of the code I quoted, it gets member
data directly from portal_membership...where can I insert my member lookup
code for Plone to use my external member data?


Aruna Kahiriya wrote:
> 
> Hi:
> You have member in relational database, not on Plone membership, so you
> will not get member_info from tools.membership. You should write ZSQL to
> get the user data from external database. (if you are not using any ORM).
> 
> Regards,
> Aruna Kathiriya
> CIGNEX Technologies.
> 
> 
> 
> 
> Kevin J wrote:
>> 
>> Hi,
>> 
>> I've written a plugin that let users to use their login stored in a
>> relational database to sign in the plone site.  The login process passed,
>> but when the I was redirected to the portal, I got the following message:
>> 
>>   File
>> "[...]/eggs/plone.app.layout-1.0.5-py2.4.egg/plone/app/layout/viewlets/common.py",
>> line 178, in update
>>     fullname = member_info.get('fullname', '')
>> AttributeError: 'NoneType' object has no attribute 'get'
>> 
>> The following is the code in question:
>> File: plone/app/layout/viewlets/common.py
>> [quote]
>> 1        if not self.anonymous:
>> 2          member = portal_state.member()
>> 3          userid = member.getId()
>>             
>> 4          if sm.checkPermission('Portlets: Manage own portlets',
>> self.context):
>> 5              self.homelink_url = self.portal_url + '/dashboard'
>> 6          else:
>> 7              self.homelink_url = self.portal_url + '/author/' +
>> quote_plus(userid)
>>             
>> 8          member_info = tools.membership().getMemberInfo(member.getId())
>> 9          fullname = member_info.get('fullname', '')
>> 10        if fullname:
>> 11            self.user_name = fullname
>> 12        else:
>> 13            self.user_name = userid
>> [/quote]
>> I traced the code, and found that after line 2, member is assigned with
>> the username that I logged in with (the user in the external database),
>> however, at line 8, member_info is None (because I don't have memberdata
>> for that particular user), so line 9 gives me an error.
>> 
>> How do I remedy this problem? i.e., how do I tell plone to read the
>> member info stored in the external database?  I've tried writing a
>> PropertiesPlugin, but it doesn't work...
>> 
>> Thanks,
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/-PAS--auth%27ed-against-relational-db%2C-but...-tp579153p580248.html
Sent from the Product Developers mailing list archive at Nabble.com.





More information about the Product-Developers mailing list